File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
crates/ty_python_semantic Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1100,6 +1100,20 @@ emp_invalid1 = Employee(department="HR")
11001100emp_invalid2 = Employee(id = 3 )
11011101```
11021102
1103+ Fields from functional ` TypedDict ` s are not currently inherited:
1104+
1105+ ``` py
1106+ from typing import TypedDict
1107+
1108+ class X (TypedDict (" Y" , { " y" : int })):
1109+ x: int
1110+
1111+ x: X = {" x" : 0 }
1112+
1113+ # error: [invalid-key] "Invalid key access on TypedDict `X`: Unknown key "y""
1114+ x: X = {" y" : 0 , " x" : 0 }
1115+ ```
1116+
11031117## Generic ` TypedDict `
11041118
11051119` TypedDict ` s can also be generic.
Original file line number Diff line number Diff line change @@ -169,11 +169,12 @@ impl<'db> ClassBase<'db> {
169169 KnownInstanceType :: SubscriptedProtocol ( _) => Some ( Self :: Protocol ) ,
170170 KnownInstanceType :: TypeAliasType ( _)
171171 | KnownInstanceType :: TypeVar ( _)
172- | KnownInstanceType :: TypedDictType ( _)
173172 | KnownInstanceType :: TypedDictSchema ( _)
174173 | KnownInstanceType :: Deprecated ( _)
175174 | KnownInstanceType :: Field ( _)
176175 | KnownInstanceType :: ConstraintSet ( _) => None ,
176+ // TODO: Inherit the fields of synthesized `TypedDict`s.
177+ KnownInstanceType :: TypedDictType ( _) => Some ( Self :: TypedDict ) ,
177178 } ,
178179
179180 Type :: SpecialForm ( special_form) => match special_form {
You can’t perform that action at this time.
0 commit comments