-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Report error when type alias has multiple TypeVarTuples (PEP 695) #20554
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
Report error when type alias has multiple TypeVarTuples (PEP 695) #20554
Conversation
When defining a type alias using the PEP 695 syntax with multiple TypeVarTuple-based type parameters (e.g., `type TA[*Ts1, *Ts2] = ...`), mypy now reports an error at definition time rather than only when the alias is used. This is consistent with how mypy handles classes with multiple TypeVarTuples and matches the behavior of other type checkers like pyright and pyrefly. Fixes python#20544.
This comment has been minimized.
This comment has been minimized.
A5rocks
commented
Jan 13, 2026
Could you support old-style type aliases too? The linked issue has that too, simply uncomment it.
This comment has been minimized.
This comment has been minimized.
A5rocks
commented
Jan 13, 2026
CI failures look like it's because testVariadicAliasMultipleUnpacks's output changed. I think the new output is more accurate (there's two issues: 1) the alias requires 2 typevartuples to use, 2) the type has 2 Unpacks within. Therefore reporting 2 errors is good, actually).
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅
Report error when type alias has multiple TypeVarTuples (PEP 695)
When defining a type alias using the PEP 695 syntax with multiple TypeVarTuple-based type parameters (e.g.,
type TA[*Ts1, *Ts2] = ...), mypy now reports an error at definition time rather than only when the alias is used.This is consistent with how mypy handles classes with multiple TypeVarTuples and matches the behavior of other type checkers like pyright and pyrefly.
Fixes #20544.