From b7e57714bfe349cfa537fee8bfa6050a5568fd43 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Thu, 9 Jan 2025 17:07:12 -0800 Subject: [PATCH] add support for typeddict (to some degree) --- reflex/vars/object.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reflex/vars/object.py b/reflex/vars/object.py index 7c0190994..6e0263a1c 100644 --- a/reflex/vars/object.py +++ b/reflex/vars/object.py @@ -16,6 +16,7 @@ from typing import ( TypeVar, Union, get_args, + is_typeddict, overload, ) @@ -272,8 +273,11 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping): var_type = get_args(var_type)[0] fixed_type = var_type if isclass(var_type) else get_origin(var_type) - if (isclass(fixed_type) and not issubclass(fixed_type, Mapping)) or ( - fixed_type in types.UnionTypes + + if ( + (isclass(fixed_type) and not issubclass(fixed_type, Mapping)) + or (fixed_type in types.UnionTypes) + or is_typeddict(fixed_type) ): attribute_type = get_attribute_access_type(var_type, name) if attribute_type is None: