Explorar el Código

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

Khaleel Al-Adhami hace 2 meses
padre
commit
7e9f928675
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  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.