Skip to content

pyright should reject *Ts as a type param in a TypeAliasType definition #7284

@hamdanal

Description

@hamdanal

It is not really called out in PEP 695 but it seems it should be rejected. Consider this example:

from typing_extensions import TypeAliasType, TypeVarTuple, Unpack

Ts = TypeVarTuple("Ts")

Alias1 = TypeAliasType("Alias1", tuple[*Ts], type_params=(Ts,))  # pyright: OK
Alias2 = TypeAliasType("Alias2", tuple[*Ts], type_params=(*Ts,))  # pyright: OK <- false negative?
Alias3 = TypeAliasType("Alias3", tuple[*Ts], type_params=(Unpack[Ts],))  # pyright: Error

I noticed this while adding support to TypeAliasType in mypy python/mypy#16926 which in its current state rejects Alias2 and Alias3 above while pyright only emits an error on Alias3 usage.

versions:
pyright 1.1.350
python 3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions