generics_typevartuple_basic_2
error
TypeVarTuple must be unpacked with * operator
When a TypeVarTuple is used in a generic class base list or as a direct type annotation, it must be unpacked using the * operator. Using a TypeVarTuple without unpacking is invalid per PEP 646.
from typing import Generic, TypeVarTuple
Ts = TypeVarTuple("Ts")
# BAD
class Cls(Generic[Ts]): # E: TypeVarTuple must be unpacked with *
...
def f(*args: Ts) -> None: # E: TypeVarTuple must be unpacked with *
...
# GOOD
class Cls2(Generic[*Ts]): # OK
...
def f2(*args: *Ts) -> None: # OK
...
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
generics_typevartuple_basic_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_basic_2