Closed
Description
Feature
Similar to tagged unions, I wish an in
check could discriminate the following:
class A(TypedDict)
foo: int
class B(TypedDict):
bar: int
union = Union[A, B]
value: int
if 'foo' in union:
value = union['foo']
else:
value = union['bar']
Similarly:
value: int
if foo := union.get('foo'):
value = foo
else:
value = union['bar']