-
Notifications
You must be signed in to change notification settings - Fork 310
Closed
Labels
pythonPythonPython
Description
Description
The following F# code
open Fable.Core
[<AttachMembers>]
type Foo(zeroArgFunc) =
member this.ZeroArgMethod() = zeroArgFunc()
is transpiled to
from __future__ import annotations
from collections.abc import Callable
from typing import Any
from fable_library_js.reflection import (TypeInfo, class_type)
def _expr2() -> TypeInfo:
return class_type("Test.Foo", None, Foo)
class Foo:
def __init__(self, zero_arg_func: Callable[[], Any]) -> None:
self.zero_arg_func: Callable[[], Any] = zero_arg_func
def ZeroArgMethod(self, __unit: None=None) -> Any:
this: Foo = self
return this.zero_arg_func(None)
Foo_reflection = _expr2
def Foo__ctor_3689BAF1(zero_arg_func: Callable[[], Any]) -> Foo:
return Foo(zero_arg_func)
the zero_arg_func
is typed as Callable[[], Any]
but being passed a None
as arg at the same time
self.zero_arg_func: Callable[[], Any] = zero_arg_func
return this.zero_arg_func(None)
Tooling info
https://fable.io/repl/
REPL: 4.2.0
Fable: 4.23.0
Metadata
Metadata
Assignees
Labels
pythonPythonPython