@JelleZijlstra:
the stubs appear to be wrong here:
|
openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ..., |
Only the openhook argument constrains the TypeVar, but it has a default, and if the argument is not given there's nothing for the type checker to use to decide on the value of the TypeVar. The typeshed stub should be changed to add a separate overload where openhook is not given.
microsoft/pyright#3494 (comment)
@JelleZijlstra:
microsoft/pyright#3494 (comment)