⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@aviralgarg05
Copy link

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.

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.
@github-actions

This comment has been minimized.

@A5rocks
Copy link
Collaborator

A5rocks commented Jan 13, 2026

Could you support old-style type aliases too? The linked issue has that too, simply uncomment it.

@github-actions

This comment has been minimized.

@A5rocks
Copy link
Collaborator

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).

@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mypy should give error at the timing when the type alias set multiple TypeVarTuple-based type parameters is defined but not used

2 participants