Skip to content

TypedDict diamond inheritance fails with Overwriting TypedDict field "x" while merging #8714

Description

@EvanKrall

This file:

from mypy_extensions import TypedDict
class Grandparent(TypedDict):
a: str
class ParentB(Grandparent):
b: str
class ParentC(Grandparent):
c: str
class Child(ParentB, ParentC):
pass

Produces the error test.py:16: error: Overwriting TypedDict field "a" while merging

I expected this to not error - in some sense, we aren't overwriting field a -- it's ultimately coming from the same place through both branches of the inheritance graph.

Maybe more generally, it should not be an error to overwrite a TypedDict field with the exact same type?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions