Version-Specific Features

Python 3.15 — Typed extra items in TypedDict

TypedDict can describe additional keys beyond its declared fields using an extra item type, or explicitly close the shape. This is a static contract: runtime instances remain ordinary dictionaries. Checker support must be verified independently. Requires Python 3.15 or the relevant build; example is not executed locally.

Formal Syntax & Structure

python syntaxpython
class Record(TypedDict, extra_items=int): ...

Return Value

Feature-specific

No single return type; see the example and feature description.

Working Example

Example Snippetpython
from typing import TypedDictclass Record(TypedDict, extra_items=int):    name: strrecord: Record = {'name': 'Ada', 'score': 8}print(record['score'])
Python Reference