typeddicts_inheritance
error
Invalid TypedDict inheritance
PEP 589 and the typing spec place constraints on TypedDict inheritance:
1. A TypedDict cannot inherit from both a TypedDict and a non-TypedDict base class (except Generic).
2. A TypedDict subclass cannot change the type of a field declared in a parent TypedDict class. PEP 705 refines this for the ReadOnly, Required, and NotRequired qualifiers: - A writable (non-ReadOnly) item may not be redeclared ReadOnly. - A required item may not be redeclared as not-required. - A writable item's value type is invariant; a ReadOnly item's value type may be narrowed to a subtype.
3. Multiple TypedDict inheritance is not allowed when two bases declare the same field with conflicting types or qualifiers.
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
typeddicts_inheritance 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/typeddicts_inheritance