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 passing at least part of the function parameter as an ** expanded dictionary, if one or more of the parameters is missing, a misleading "incomaptible type" is shown, instead of "missing parameter".
See also stackoverflow for a way to get a better (but still not correct, since it lists all the parameters as missing) message
This report is a bit misleading since it might appear that in the example, the problem is that mypy understands that input_kwargs provides parameter b but not a and c, which in practice input_kwargs is seen as an opaque dict[str, bool].
main.py:6: error: Argument 1 to "f" has incompatible type "**Dict[str, str]"; expected "int" [arg-type]
main.py:6: error: Argument 1 to "f" has incompatible type "**Dict[str, str]"; expected "bool" [arg-type]
Now, as to what's "expected", maybe something like this?
main.py:6: error: Argument 1 to "f" has incompatible type "**Dict[str, str]"; expected named arguments "(foo: int, bar: bool)"
or maybe, if we want to nudge users towards TypedDict:
... or a TypedDict:
class ...(TypedDict):
foo: int
bar: bool
Bug Report
When passing at least part of the function parameter as an
**
expanded dictionary, if one or more of the parameters is missing, a misleading "incomaptible type" is shown, instead of "missing parameter".See also stackoverflow for a way to get a better (but still not correct, since it lists all the parameters as missing) message
To Reproduce
or see the gist
Actual Behavior
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: