basedmypy
basedmypy copied to clipboard
generic bound `TypeVar` broke with `Callable`
from typing import Callable, TypeVar
R = TypeVar("R")
StrFn = TypeVar("StrFn", bound=Callable[[str], R])
def deco(fn: StrFn) -> StrFn:
return fn
@deco
def foo(value: str): # error, incorrect
...
@deco
def bar(value: str, value2: str = ""): # error, incorrect
...
@deco
def baz(value: str, value2: str): # error, correct
...