瀏覽代碼

add overload for typeddict mapping since their value type is any (#4949)

Khaleel Al-Adhami 2 月之前
父節點
當前提交
7e9f928675
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      reflex/vars/object.py

+ 6 - 0
reflex/vars/object.py

@@ -202,6 +202,12 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
         key: Var | Any,
     ) -> ObjectVar[Mapping[OTHER_KEY_TYPE, VALUE_TYPE]]: ...
 
+    @overload
+    def __getitem__(
+        self: ObjectVar[Mapping[Any, VALUE_TYPE]],
+        key: Var | Any,
+    ) -> Var[VALUE_TYPE]: ...
+
     def __getitem__(self, key: Var | Any) -> Var:
         """Get an item from the object.