You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
T = TypeVar("T")
OptionalT: TypeAlias = Optional[T]
OptionalT[int] # error: Type application is only supported for generic classes
Expected Behavior
I was surprised that you couldn't have a free expression of the subscripted generic type alias. Standalone expressions like Optional[int] obviously work, as does X where X: TypeAlias = int.
Actual Behavior
The free expression gives the error: Type application is only supported for generic classes in the playground
Your Environment
The environment is python 3.10, mypy 0.971.
The text was updated successfully, but these errors were encountered:
Bug Report
Standalone subscripted alias expression raises the error "Type application is only supported for generic classes"
To Reproduce
Here's a reproducible playground link: https://mypy-play.net/?mypy=0.971&python=3.10&gist=e262d3dd99f2a708e96eb28338792632
Code:
Expected Behavior
I was surprised that you couldn't have a free expression of the subscripted generic type alias. Standalone expressions like
Optional[int]
obviously work, as doesX
whereX: TypeAlias = int
.Actual Behavior
The free expression gives the error:
Type application is only supported for generic classes
in the playgroundYour Environment
The environment is python 3.10, mypy 0.971.
The text was updated successfully, but these errors were encountered: