Bug Report
Mypy reports an error when a TypedDict is passed as an argument to a function that is annotated as accepting dicts more generally.
To Reproduce
class TestDict(TypedDict):
a: int
def myfunc(test: dict):
print(test)
myfunc(TestDict(a=2))
Note that:
>>> type(TestDict(a=2))
<class 'dict'>
Expected Behavior
No error.
Actual Behavior
error: Argument 1 to "myfunc" has incompatible type "TestDict"; expected "Dict[Any, Any]" [arg-type]
myfunc(TestDict(a=2))
^
Your Environment
- Mypy version used: 0.960 (compiled: yes)
- Python version used: 3.9.10
Bug Report
Mypy reports an error when a
TypedDictis passed as an argument to a function that is annotated as acceptingdicts more generally.To Reproduce
Note that:
Expected Behavior
No error.
Actual Behavior
Your Environment