typeddicts_usage error

TypedDict runtime violation

PEP 589 defines constraints on what you can do with TypedDict type objects at runtime:

- TypedDict type objects cannot be used in isinstance() tests.

from typing import TypedDict

class Movie(TypedDict):
    name: str
    year: int

movie: Movie = {"name": "Blade Runner", "year": 1982}

if isinstance(movie, Movie):  # E — TypedDict cannot be used in isinstance
    ...

How to handle it

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