Skip to content

Commit 5062c55

Browse files
committed
adding null only for select, date, file and number
1 parent 5bacf6a commit 5062c55

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/lib/stack/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type FieldOptions = {
1616
multiple: boolean;
1717
non_localizable: boolean;
1818
max_instance: boolean | undefined;
19+
display_type: string;
1920
} & Identifier;
2021

2122
export type Block = {

src/lib/tsgen/factory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ export default function (userOptions: TSGenOptions) {
216216
fieldType += "[]";
217217
}
218218
}
219-
219+
console.log(field.data_type)
220+
console.log(['isodate','file','number'].includes(field.data_type))
220221
return [
221222
field.uid + op_required(field.mandatory) + ':',
222-
fieldType || visit_field_type(field), field.mandatory?'':'| null', ';'
223+
fieldType || visit_field_type(field), (['isodate','file','number'].includes(field.data_type) || ['radio','dropdown'].includes(field.display_type))?field.mandatory?'':'| null':'', ';'
223224
].join(' ')
224225
}
225226

0 commit comments

Comments
 (0)