pyright
pyright copied to clipboard
Incorrect type narrowing for TypedDicts using the `S in D` type guard pattern
The narrowed type in the following example is incorrect:
class A(TypedDict):
a: int
def func(t: A):
if "b" in t:
reveal_type(t) # Should be `A`, not `Never`
We can't eliminate type A based on this check because the TypedDict is not closed.