You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constfoo: number=1typeFoo=typeoffoo// type Foo = numberfunctionbar(x: string): void{}typeBar=typeofbar// type Bar = (x: string) => void
Pitch
The expected way in future python.
use the predefined method type is not possible because type(foo) returns string.
so we need to introduce an additinal method for example typing.typeof:
fromtypingimporttypeoffoo: int=1Foo=typeof(foo) # equivalent to Foo = intdefbar(x: string) ->None :
...
Bar=typeof(bar) # equivalent to Bar = Callable[[str], None]
or make typing.Type callable:
fromtypingimportTypefoo: int=1Foo=Type(foo) # equivalent to Foo = int
The text was updated successfully, but these errors were encountered:
Feature
A similar feature in typescript
Pitch
The expected way in future python.
use the predefined method
type
is not possible becausetype(foo)
returns string.so we need to introduce an additinal method for example
typing.typeof
:or make
typing.Type
callable:The text was updated successfully, but these errors were encountered: