Skip to content

Dict literal in TypedDict context #2487

Closed
@JukkaL

Description

@JukkaL

A compatible dict literal should be valid if the type context is a typed dict type. Example:

from mypy_extensions import TypedDict

Point = TypedDict('Point', {'x': int, 'y': int})

def f(p: Point) -> None: pass

f({'x': 1, 'y': 3})  # Ok
p = {'x': 2, 'y': 3}  # type: Point  # Ok

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions