Skip to content

Commit c3b0b46

Browse files
committed
added optional null in generated types if the given field is optional
1 parent a6bbf20 commit c3b0b46

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib/tsgen/factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export default function (userOptions: TSGenOptions) {
219219

220220
return [
221221
field.uid + op_required(field.mandatory) + ':',
222-
fieldType || visit_field_type(field) + ';',
222+
fieldType || visit_field_type(field), field.mandatory?'':'| null', ';'
223223
].join(' ')
224224
}
225225

@@ -272,7 +272,7 @@ export default function (userOptions: TSGenOptions) {
272272
}
273273

274274
function type_text() {
275-
return 'string'
275+
return 'string'
276276
}
277277

278278
function type_number() {

0 commit comments

Comments
 (0)