Selaa lähdekoodia

fix union types for vars (#4152)

Khaleel Al-Adhami 7 kuukautta sitten
vanhempi
säilyke
210c1ed902
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      reflex/vars/base.py

+ 2 - 2
reflex/vars/base.py

@@ -441,7 +441,7 @@ class Var(Generic[VAR_TYPE]):
 
         if issubclass(output, NumberVar):
             if fixed_type is not None:
-                if fixed_type is Union:
+                if fixed_type in types.UnionTypes:
                     inner_types = get_args(base_type)
                     if not all(issubclass(t, (int, float)) for t in inner_types):
                         raise TypeError(
@@ -530,7 +530,7 @@ class Var(Generic[VAR_TYPE]):
 
         fixed_type = get_origin(var_type) or var_type
 
-        if fixed_type is Union:
+        if fixed_type in types.UnionTypes:
             inner_types = get_args(var_type)
 
             if all(