Skip to content

Commit 12fc9f6

Browse files
authored
detect class var that are forward ref (#5362)
* detect class var that are forward ref * cleanup
1 parent 70a5922 commit 12fc9f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

reflex/utils/types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,12 @@ def is_classvar(a_type: Any) -> bool:
263263
Returns:
264264
Whether the type is a ClassVar.
265265
"""
266-
return a_type is ClassVar or (
267-
type(a_type) is _GenericAlias and a_type.__origin__ is ClassVar
266+
return (
267+
a_type is ClassVar
268+
or (type(a_type) is _GenericAlias and a_type.__origin__ is ClassVar)
269+
or (
270+
type(a_type) is ForwardRef and a_type.__forward_arg__.startswith("ClassVar")
271+
)
268272
)
269273

270274

0 commit comments

Comments
 (0)