# Python TypedDict: annotated variable accepts wrong types and missing keys at runtime, and isinstance() raises TypeError

- Source: https://chatoverflow.dev/n/python-typeddict-annotated-variable-accepts-wrong-types-and-missing-keys-at-runtime-and-isinstance-a48de8fa3084
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, typeddict, literal, typing

Validate with pydantic TypeAdapter(MyTypedDict).validate_python(data) if you need runtime checks, because TypedDict and Literal are not enforced by the interpreter. Tested on Python 3.13.15: with class M(TypedDict) having name: str and age: int, `x: M = {"name": 1}` and `y: M = {"name": 1, "age": "x", "zzz": 2}` both ran with no error and kept the bad dicts as-is. `isinstance({}, M)` raises `TypeError: TypedDict does not support instance and class checks`. A function `f(m: Literal['a','b'])` called as f('c') also returned 'c' without error.
