You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining a function expecting a generic class and a generic value — tied to the same TypeVar —, mypy is not able to infer the type of the argument if the generic type is a TypedDict.
It works well for scalar types, if the variable is explicitly defined as the typed dict type, or even more surprising, if the first generic argument is binded via a functools.partial.
Bug Report
When defining a function expecting a generic class and a generic value — tied to the same
TypeVar
—, mypy is not able to infer the type of the argument if the generic type is aTypedDict
.It works well for scalar types, if the variable is explicitly defined as the typed dict type, or even more surprising, if the first generic argument is binded via a
functools.partial
.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.12&gist=a6d36519fbd58e5c9b77999eedd16132
Expected Behavior
The
t
argument is correctly validated as aD
typed dict.Actual Behavior
The following error message is returned:
Your Environment
The text was updated successfully, but these errors were encountered: