BSK-E0093 error

Invalid key or value type in TypedDict assignment

PEP 589 defines TypedDict as a typed dict with a fixed set of keys and associated types. This rule detects:

1. Subscript assignments with invalid (non-existent) keys. 2. Subscript assignments where the value type is incompatible with the declared field type. 3. Annotated dict-literal assignments that contain invalid keys or are missing required keys.

from typing import TypedDict

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

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

movie["director"] = "Ridley Scott"  # E: invalid key
movie["year"] = "1982"              # E: wrong value type
movie2: Movie = {"title": "Blade Runner", "year": 1982}  # E: invalid/missing keys

How to handle it

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