generics_defaults error

Non-default TypeVar follows a default TypeVar in Generic...

PEP 696 §Ordering defines two ordering rules for type parameters in Generic...:

1. Once a TypeVar with a default= argument appears, all subsequent type variables must also have defaults.

2. A TypeVar with a default= cannot immediately follow a TypeVarTuple in Generic... because it would be ambiguous whether a type argument should be bound to the TypeVarTuple or the defaulted TypeVar. (ParamSpec with a default is allowed after a TypeVarTuple.)

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial generics_defaults 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_defaults