Skip to content
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

"Type variable is invalid as target for type alias" error on new union syntax when not using TypeAlias type #14824

Open
DetachHead opened this issue Mar 3, 2023 · 1 comment
Labels
bug mypy got something wrong

Comments

@DetachHead
Copy link
Contributor

from typing import TypeVar, TypeAlias

T = TypeVar("T")

MaybeList = T | list[T] # error: Type variable "__main__.T" is invalid as target for type alias
MaybeList2: TypeAlias = T | list[T] # no error

playground

@DetachHead DetachHead added the bug mypy got something wrong label Mar 3, 2023
@KotlinIsland
Copy link
Contributor

related to: #13376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants