Python — From Basics to Advanced · Advanced Typing
TypedDict — Typed Dictionaries
Advanced Typing
Introduction
TypedDict (PEP 589) brings static typing to dictionaries with a known shape (API responses, configs, kwargs). Keys and value types are declared upfront, but at runtime it is still a plain dict. A strong alternative to dataclass when you do not need attribute access.