-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-type-aliasTypeAlias and other type alias issuesTypeAlias and other type alias issues
Description
Bug Report
A valid-type
error is reported by mypy when using the type
keyword for certain expressions, but no error is reported when using TypeAlias
.
I can trigger it by using an annotated type, where the annotation is function output, and the annotated type parametrizes another type.
To Reproduce
from typing import Annotated, TypeAlias
def something() -> None: ...
type A= list[Annotated[str, something()]]
B: TypeAlias = list[Annotated[str, something()]]
Expected Behavior
Consistent reporting for type
and TypeAlias
.
Actual Behavior
main.py:5: error: Invalid type alias: expression is not a valid type [valid-type]
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.18.2
- Mypy command-line flags: null
- Mypy configuration options from
mypy.ini
(and other config files): null - Python version used: 3.12, 3.13, 3.14
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-type-aliasTypeAlias and other type alias issuesTypeAlias and other type alias issues