Closed
Description
from typing import TypeVar
T1 = TypeVar("T1")
T2 = TypeVar("T2")
def f(t1: T1, t2: T2) -> T1 | T2:
return t1
a: int = f(1, None) or 1 # error: Argument 2 to "f" has incompatible type "None"; expected "int" [arg-type]
def f1(t1: T1, t2: T1) -> T1:
return t1
b: int = f1(1, None) or 1 # no error