basedpyright
basedpyright copied to clipboard
infer overload types
@overload
def f(a: int) -> str: ...
@overload
def f(a: str) -> None: ...
def f(a):
reveal_type(a) # int | str
return 1 # error: expected "str | None"
The types of the implementation signature should be inferred from the overload signatures.
related: #289
specifically https://github.com/DetachHead/basedpyright/issues/289#issuecomment-2283252114 needs to be addressed for both of these issues imo