File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3788,6 +3788,40 @@ b.py:4: error: TypedDict "A" has no key "b"
37883788b.py:9: error: TypedDict "B" has no key "a"
37893789==
37903790
3791+ [case testTypedDictUpdateClosedPassingToFailing]
3792+ import b
3793+ [file a.py]
3794+ from typing import TypedDict, Union
3795+ class A(TypedDict, closed=True):
3796+ a: int
3797+ class B(TypedDict, closed=True):
3798+ b: int
3799+ C = Union[A, B]
3800+ [file a.py.2]
3801+ from typing import TypedDict, Union
3802+ class A(TypedDict):
3803+ a: int
3804+ class B(TypedDict, closed=True):
3805+ b: int
3806+ C = Union[A, B]
3807+ [file b.py]
3808+ from a import C
3809+ def foo(x: C) -> int:
3810+ if "b" in x:
3811+ return x["b"]
3812+ else:
3813+ return x["a"]
3814+ def bar(x: C) -> int:
3815+ if "a" in x:
3816+ return x["a"]
3817+ else:
3818+ return x["b"]
3819+ [builtins fixtures/dict.pyi]
3820+ [typing fixtures/typing-typeddict.pyi]
3821+ [out]
3822+ ==
3823+ b.py:4: error: TypedDict "A" has no key "b"
3824+
37913825[case testBasicAliasUpdate]
37923826import b
37933827[file a.py]
You can’t perform that action at this time.
0 commit comments