Skip to content

"Extra argument ..." error of TypeDict should be more clear #20986

@hyperkai

Description

@hyperkai

*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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions