narrowing_typeguard error

TypeGuard or TypeIs on method with no narrowing parameter

The typing spec requires that a TypeGuard or TypeIs function must have at least one user-facing parameter to narrow. When a method returns TypeGuardX or TypeIsX but only has self or cls, there is no parameter to narrow and the guard is invalid.

How to handle it

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