Skip to content

Setting the same key name "x" in an extended TypedDict class as the same parameter name "x" gets the wrong error message saying argument but not parameter #20933

@hyperkai

Description

@hyperkai

*Notes:

  • mypy test.py
  • mypy 1.19.1
  • Python 3.14.0

Setting the same key name "x" in an extended TypedDict class as the same parameter name "x" gets the wrong error message saying argument but not parameter as shown below:

from typing import TypedDict, Unpack

class MyDict(TypedDict):
    x: str
    y: bool

def func(x: int, **kwargs: Unpack[MyDict]): ...
# Error

error: Overlap between argument names and ** TypedDict items: "x"

So the error message should say parameter as shown below:

error: Overlap between parameter names and ** TypedDict items: "x"

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