typeddict

How can I type annotate a general nested TypedDict?

How can I type annotate a general nested TypedDict? Question: I’m trying to remove the Any type hint from code similar to the following: from typing import TypedDict, Any class NestedDict(TypedDict): foo: str class EventDict(TypedDict): nested: NestedDict class BaseEventDict(TypedDict): nested: Any # this should accept NestedDict but also other TypedDicts which may contain additional fields …

Total answers: 2

TypedDict class is an Incompatible Type for function expecting Dict

TypedDict class is an Incompatible Type for function expecting Dict Question: I created the below TypedDict class; class Appinfo(TypedDict): appid: int extended: dict[str, Any] config: dict[str, Any] depots: dict[str, Any] ufs: dict[str, Any] class SteamAppInfo(TypedDict): appid: int data: dict[str, Appinfo] In my application I’m passing a variable of this class to a function expecting a …

Total answers: 1