Closed
Description
Mypy doesn't support a function that tries to return a generic callable. I wonder if mypy could make this code work properly:
from typing import TypeVar, Callable, Any
T = TypeVar('T', bound=Callable[..., Any])
def deco() -> Callable[[T], T]:
def inner(x):
return x
return inner
@deco()
def g(x: str) -> int: ...
g('') # should be fine? currently "Argument 1 to "g" has incompatible type "str"; expected None"
g(1) # should be an error