Skip to content

Commit 29d161a

Browse files
authored
handle value of dict being union type (#1224)
* handle value of dict being union type * use getattr
1 parent 66e3b36 commit 29d161a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pcweb/pages/docs/component.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,9 @@ def prop_docs(
479479

480480
elif origin is dict:
481481
key_type = args[0].__name__ if args else "Any"
482-
value_type = args[1].__name__ if len(args) > 1 else "Any"
482+
value_type = (
483+
getattr(args[1], "__name__", str(args[1])) if len(args) > 1 else "Any"
484+
)
483485
type_name = f"Dict[{key_type}, {value_type}]"
484486
short_type_name = "Dict"
485487

0 commit comments

Comments
 (0)