Closed
Description
I'm looking for a way to build a typeddict from another:
given:
class Foo(TypedDict):
a: int
b: int
class Bar(Foo):
c: int
foo = Foo(a=1, b=2)
I would like to do bar = Bar(**foo, c=5)
, because we perform this operation many times with many dict and many keys, and bar = Bar(a=foo["a"], b=foo["b"], c=3)
would be really too verbose.
I fear this is not possible yet. Any chance that such a functionality could be implemented?
I don't see a better workaround than bar = Bar(**foo, c=5) # type: ignore
, maybe I'm missing something?
Thanks!