File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -182,14 +182,22 @@ end
182182 str *= indent * " }\n "
183183 elseif f[:is_enum ]
184184 str *= indent * " if (_json['$field_name '] != null) {\n "
185- str *= indent * " " * " this.$field_name = Number($(get_typescript_type_of_elt_type (f[:field_type ])) [_json['$field_name ']]);\n "
185+ str *= indent * " " * " if (isNaN(Number(_json['$field_name ']))) {\n "
186+ str *= indent * " " * " " * " this.$field_name = Number($(get_typescript_type_of_elt_type (f[:field_type ])) [_json['$field_name ']]);\n "
187+ str *= indent * " " * " } else {\n "
188+ str *= indent * " " * " " * " this.$field_name = Number(_json['$field_name ']);\n "
189+ str *= indent * " " * " }\n "
186190 str *= indent * " }\n "
187191 elseif f[:is_vectorofenum ]
188192 elt_type = get_typescript_elt_type (f)
189193 str *= indent * " if (_json['$field_name '] != null) {\n "
190194 str *= indent * " " * " this.$field_name = [];\n "
191195 str *= indent * " " * " for (let e of _json['$field_name ']) {\n "
192- str *= indent * " " * " this.$field_name .push(Number($elt_type [e]));\n "
196+ str *= indent * " " * " " * " if (isNaN(Number(e))) {\n "
197+ str *= indent * " " * " " * " " * " this.$field_name .push(Number($elt_type [e]));\n "
198+ str *= indent * " " * " " * " } else {\n "
199+ str *= indent * " " * " " * " " * " this.$field_name .push(Number(e));\n "
200+ str *= indent * " " * " " * " }\n "
193201 str *= indent * " " * " }\n "
194202 str *= indent * " }\n "
195203 elseif get_typescript_type (f) == " Date"
You can’t perform that action at this time.
0 commit comments