Bug Report
When I create a type alias to PEP604-style union type, mypy complains that it's "not valid as a type".
To Reproduce
MyType = str | None
myvar: MyType
Expected Behavior
No errors, the same output as for:
from typing import Optional
MyType = Optional[str]
myvar: MyType
Actual Behavior
1.py:2: error: Variable "1.MyType" is not valid as a type
1.py:2: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini (and other config files): none
- Python version used: 3.10
- Operating system and version: FreeBSD 13.0
Bug Report
When I create a type alias to PEP604-style union type, mypy complains that it's "not valid as a type".
To Reproduce
Expected Behavior
No errors, the same output as for:
Actual Behavior
Your Environment
mypy.ini(and other config files): none