"Extra argument ..." error of `TypeDict` should be more clear
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
*Notes:
- mypy test.py
- mypy 1.19.1
- Python 3.14.3
Passing an extended TypeDict class to a function missing y parameter gets the error message as shown below:
from typing import TypedDict
class MyDict(TypedDict):
x: int
y: str
v = MyDict(x=100, y="Hello")
def func(x: int) -> None: ...
func(**v) # Error
error: Extra argument "y" from **args for "func"
But **args in the error message is confusing with *args and **kwargs so it should be like below:
error: Extra argument "y" from **TypedDict for "func"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the diagnostic produced by running mypy test.py from the issue example, and trace where the Extra argument message is formatted. Change the source label from **args to **TypedDict, then rerun the example and verify that the error for the extra y argument uses the new wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100