narrowing_typeis_2
error
TypeIs narrows to a type inconsistent with the input type
Per the typing spec: "It is an error to narrow to a type that is not consistent with the input type." For TypeIs, the narrowed type must be a subtype of the input type.
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
narrowing_typeis_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/narrowing_typeis_2