used to test gettypehints on a crossmodule inherited typeddict class this script uses future annotations to postpone a type that won t be available on the module inheriting from to foo the subclass in the other module should look something like this class bartypeddicthelper foo totalfalse b int in addition it uses multiple levels of annotated to test the interaction between the future import annotated and required
from __future__ import annotations

from typing import Annotated, Generic, Optional, Required, TypedDict, TypeVar


OptionalIntType = Optional[int]

class Foo(TypedDict):
    a: OptionalIntType

T = TypeVar("T")

class FooGeneric(TypedDict, Generic[T]):
    a: Optional[T]

class VeryAnnotated(TypedDict, total=False):
    a: Annotated[Annotated[Annotated[Required[int], "a"], "b"], "c"]