Typing and Generics

typing.Required

Marks an individual TypedDict key as required even when the enclosing dictionary is total=False. It concerns key presence, not whether the value can be None. Added in 3.11.

Formal Syntax & Structure

python syntaxpython
typing.Required[T]

Return Value

type qualifier

Typing construct or runtime result as described; static typing rules are not runtime validation.

Working Example

Example Snippetpython
from typing import Required, TypedDict
class Job(TypedDict,total=False):    id: Required[int]    note: strprint((sorted(Job.__required_keys__), sorted(Job.__optional_keys__)))
Python Reference