-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Type alias as a class member is not valid as a type #7866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is intended behavior, see #3494 To give a bit more context, currently there is no explicit way to distinguish between type aliases and variables with type |
I see, thanks for the explanation. |
@ilevkivskyi Is there any issues tracking/plans for a resolution instead of a workaround? (Which does work perfectly as far as I can tell 👍 ) |
See PEP 613 |
Add typing-extensions for TypeAlias annotation. See: - python/mypy#7866 - https://peps.python.org/pep-0613/
Add typing-extensions for TypeAlias annotation. See: - python/mypy#7866 - https://peps.python.org/pep-0613/
I am not sure if this is a bug or intended behaviour but I have problems when using type aliases as class members. This is the code I thought should work:
gives the following errors:
I noticed this simpler code also does not work, I am not sure if it is connected?
This gives:
mypy_alias.py:3: error: Variable "mypy_alias.A.Alias" is not valid as a type
I am using python 3.6.9 and mypy 0.730
The text was updated successfully, but these errors were encountered: