Q:

TypeError: '_TypedDict' object is not subscriptable

You can't subscript TypedDict; you're meant to instantiate or subclass one according to the docs:

Point2D = TypedDict('Point2D', x=int, y=int, label=str)
Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
With that in mind, you can just inline that in your signature:

def x(a: TypedDict('A', x=int)):
  pass
0

New to Communities?

Join the community