Skip to content

bad error message for wrong type of typeddict setitem #10253

@Akuli

Description

@Akuli

Bug Report

confusing error message

To Reproduce

from typing import TypedDict

Foo = TypedDict('Foo', {'a': int})
blah: Foo = {'a': 1}
blah['a'] = 'lol'

Expected Behavior

something like "value of 'a' should be int, not str"

Actual Behavior

a.py:5: error: Argument 2 has incompatible type "str"; expected "int"

Your Environment

  • Mypy version used: 0.812
  • Python version used: Python 3.8.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions