Skip to content

Dict literal in TypedDict context #2487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JukkaL opened this issue Nov 24, 2016 · 0 comments
Closed

Dict literal in TypedDict context #2487

JukkaL opened this issue Nov 24, 2016 · 0 comments

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 24, 2016

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant