Closed Shtsh closed 4 days ago
while i can't find any mention in the docs anywhere that Optional
is deprecated, the general consensus seems to be that the new | None
syntax is preferred. there's some discussion about it here where one of the typeshed maintainers makes some solid arguments against using it.
also the depreciation comes from upstream pyright, and this is a decision i agree with. but if you prefer to continue using Optional
you can disable this error by setting deprecateTypingAliases
to false
.
that said, i'm not opposed to changing the behaviour if there's a good reason to do so, which i've done before because there are some deprecations i think are really stupid, such as deprecating typing.Callable
in favor of collections.abc.Callable
even though Callable
has literally nothing to do with collections.
related: #242
closing for the reasons mentioned above, feel free to raise a new issue if you disagree
Basedpyright marks typing.Optional as deprecated
It is not deprecated even though
Type | None
is a preferable way. This error misguiding and might make person to break compatibility without any proper reason.