-
-
Notifications
You must be signed in to change notification settings - Fork 3k
TypeAlias does not work with Union types #11665
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
It seems slightly more complicated than I initially thought. Type alias |
All variants you've described should work on master |
I have the same specs as @realharry and am experiencing the same issue. Using an explicit |
These work with newer mypy (e.g. 0.931). |
Bug Report
Union types are valid types, just like any other types. That's at least my expectation. However, you cannot currently type alias union types.
For example,
Mypy will issue the following errors:
To Reproduce
typing.Union
or the 3.10 vert bar syntax.Expected Behavior
Union types should be treated as just any other types.
Actual Behavior
Union types cannot be type-aliased in the current impl of mypy.
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: