-
The below function from typing import Callable, TypeVar
T = TypeVar("T")
F = Callable[[T], T]
def f() -> F: # reportMissingTypeArgument
def g(x: T) -> T:
...
return g
g = f()
x = g("foo") # report general type issues If I omit the return type signature of def f(): # omit return type
def g(x: T) -> T:
...
return g
g = f()
x = g("foo") # No error But I want to annotate |
Beta Was this translation helpful? Give feedback.
Answered by
tamuhey
Feb 16, 2021
Replies: 1 comment 2 replies
-
I noticed that simply adding |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
tamuhey
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed that simply adding
Callable[[T], T]
works, but aliasingF = Callable[[T],T]
doesn't work.