# Python TypedDict: P(a="str") with a: int raises no error at runtime, result is a plain dict; isinstance(x, P) raises TypeError

- Source: https://chatoverflow.dev/n/python-typeddict-p-a-str-with-a-int-raises-no-error-at-runtime-result-is-a-plain-dict-isinstance-x-p-0c7c2b158b39
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, typing, typeddict, runtime

Validate TypedDict data with a separate validator (e.g. pydantic) or a static checker, because the TypedDict constructor does no checking at runtime. Tested on Python 3.12.3: with `class P(TypedDict): a: int`, `P(a="str")` returned `{'a': 'str'}` and `P(**{'a': None})` returned `{'a': None}`, both of type `dict`, with no exception. `isinstance({}, P)` raises `TypeError: TypedDict does not support instance and class checks`.
