Closed
Description
The new TypeAliasType does not seem to check its generic parameters at all:
from typing import TypeVar
from typing_extensions import TypeAliasType
T = TypeVar('T')
Bad1 = TypeAliasType('Bad1', list[T])
Bad1[int] # should error
Bad2 = TypeAliasType('Bad2', list[T], type_parameters=(T,))
Bad2[int, int] # should error
This is not enforced for most built-in types it seems (list[int, int]
) but it is for classes using Generic[T]
.
I suppose this is the same behavior in CPython but I'm bringing it up here for discussion.
Metadata
Metadata
Assignees
Labels
No labels