File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
@plotly/dash-generator-test-component-typescript/src Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export type TypescriptComponentProps = {
25
25
array_obj ?: { a : string } [ ] ;
26
26
array_any ?: any [ ] ;
27
27
enum_string ?: 'one' | 'two' ;
28
+ enum_number ?: 2 | 3 | 4 | 5 | 6 ;
28
29
union ?: number | string ;
29
30
union_shape ?: { a : string } | string ;
30
31
array_union_shape ?: ( { a : string } | string ) [ ] ;
Original file line number Diff line number Diff line change @@ -103,18 +103,17 @@ def _get_literal_value(value):
103
103
if value is None :
104
104
return "None"
105
105
106
+ if isinstance (value , str ):
107
+ value = json .loads (value .replace ("'" , '"' ))
108
+
106
109
if isinstance (value , bool ):
107
110
return str (value )
108
111
109
112
return json .dumps (value )
110
113
111
114
112
115
def generate_enum (type_info , * _ ):
113
- values = [
114
- _get_literal_value (json .loads (v ["value" ].replace ("'" , '"' )))
115
- for v in type_info ["value" ]
116
- if v
117
- ]
116
+ values = [_get_literal_value (v ["value" ]) for v in type_info ["value" ] if v ]
118
117
return f"Literal[{ ', ' .join (values )} ]"
119
118
120
119
You can’t perform that action at this time.
0 commit comments