-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-hightopic-typed-dict
Description
@b0g3r reported an issue with TypedDict keys not being accepted with literal types. Example code from #6262 (comment):
from mypy_extensions import TypedDict
from typing_extensions import Literal, Final
class MyDict(TypedDict):
field_name: int
d: MyDict
d = {'field_name': 1} # OK
name_in_var = 'field_name'
d = {name_in_var: 1} # Correct error
name_in_literal2: Literal['field_name'] = 'field_name'
d = {name_in_literal2: 1} # Unexpected error
name_in_final: Final = 'field_name'
d = {name_in_final: 1} # Unexpected error
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-hightopic-typed-dict