Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,8 @@ def analyze_typeddict_classdef(self, defn: ClassDef) -> bool:
and not has_placeholder(defn.info.typeddict_type)
):
# This is a valid TypedDict, and it is fully analyzed.
for decorator in defn.decorators:
decorator.accept(self)
return True
is_typeddict, info = self.typed_dict_analyzer.analyze_typeddict_classdef(defn)
if is_typeddict:
Expand Down
12 changes: 12 additions & 0 deletions test-data/unit/check-typeddict.test
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ class D(TypedDict):
d = D()
reveal_type(d) # N: Revealed type is "TypedDict('__main__.D', {})"
[builtins fixtures/dict.pyi]
[case testTypedDictDecoratorUndefinedNames]
from typing import TypedDict

@abc # E: Name "abc" is not defined
@efg.hij # E: Name "efg" is not defined
@klm[nop] # E: Name "klm" is not defined \
# E: Name "nop" is not defined
@qrs.tuv[wxy] # E: Name "qrs" is not defined \
# E: Name "wxy" is not defined
class A(TypedDict):
x: int
[builtins fixtures/dict.pyi]
[typing fixtures/typing-typeddict.pyi]

[case testTypedDictWithClassmethodAlternativeConstructorDoesNotCrash]
Expand Down
Loading