-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
I know this issue has been discussed before, however I think that one point is left undiscussed.
The issue:
Using Optional:
from typing import Optional
results in: This type is deprecated as of Python 3.10; use "| None" instead (reportDeprecated)
However it is not deprecated.
The reason that pyright currently reports this as deprecated seems to be based on a comment by a python core dev on the python forums, and I think he makes a valid point.
However, python users usually wont visit the python forums, and would consult the official docs instead. That is where the confusion arises, because those docs does not have any wording that may indicate that the feature is deprecated, or even discouraged. This results in users questioning there sanity and/or no longer trust there tools (pyright in this case).
Therefore I would suggest:
- Rephrase the error to something like:
While Optional is not specifically deprecated, it's recommended to use int | None instead - Moving the rule away from the
deprecateTypingAliasessetting to a (new?)suggestedTypeAliases(or something like that) setting.