generics_typevartuple_specialization_2 error

Invalid TypeVarTuple specialization of generic alias

Two related violations are detected:

1. **Unpack in non-TypeVarTuple generic**: When a generic alias is defined using only regular TypeVars (no TypeVarTuple), you cannot specialise it with an unpacked TypeVarTuple (Ts) or an unpacked homogeneous tuple (tupleT, ...).

T = TypeVar("T")
IntTupleGeneric = tuple[int, T]

IntTupleGeneric[str]              # OK
IntTupleGeneric[*Ts]              # E — Ts is a TypeVarTuple, not a TypeVar
IntTupleGeneric[*tuple[float, ...]]  # E — unpacked tuple not allowed here

2. **Too few type arguments for TypeVarTuple+TypeVar alias**: When a generic alias contains both a TypeVarTuple and one or more regular TypeVars, every specialisation must supply at least as many arguments as there are regular TypeVars (the TypeVarTuple absorbs the rest).

T1, T2 = TypeVar("T1"), TypeVar("T2")
Ts = TypeVarTuple("Ts")
TA7 = tuple[*Ts, T1, T2]

v1: TA7[int]         # E — requires at least two type arguments (T1, T2)
v2: TA7[int, str]    # OK — T1=int, T2=str, Ts=()

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial generics_typevartuple_specialization_2 down per-file or per-path from your editor or pyproject.toml, or fix the code so it type-checks. See the Type System rules and the complete diagnostic reference.

Canonical URL: https://www.basilisk-python.dev/errors/generics_typevartuple_specialization_2