@@ -203,17 +203,6 @@ export class TypescriptConversion {
203203 return TypescriptConversion . indexTemplate ( templateData ) ;
204204 }
205205
206- /**
207- * Returns whether the field is nullable.
208- * @param fieldAttributes The attributes of the field
209- * @returns Whether the field is nullable
210- */
211- private getTypescriptFieldNullable (
212- fieldAttributes : SchemaInterface [ "fields" ] [ 0 ]
213- ) {
214- return fieldAttributes . required || "defaultValue" in fieldAttributes ;
215- }
216-
217206 /**
218207 * Creates getter and setter methods for the fields and adds them to the attributes and getter arrays.
219208 * @param fieldEntries The entries of the fields
@@ -269,29 +258,40 @@ export class TypescriptConversion {
269258 this . getter . push ( {
270259 fieldname : field ,
271260 type : type . type ,
272- returnType : `super.relation("${ field } ");` ,
261+ returnType : ` super.relation("${ field } ");` ,
273262 } ) ;
274263 } else {
275264 this . attributes . push ( {
276265 fieldname : `${ field } ${ nullable ? "?" : "" } ` ,
277- type : type . type + ( nullable ? " | null " : "" ) ,
266+ type : type . type + ( nullable ? " | undefined " : "" ) ,
278267 } ) ;
279268
280269 this . getter . push ( {
281270 fieldname : field ,
282271 type : `${ type . type } ${ nullable ? " | undefined" : "" } ` ,
283- returnType : `super.get("${ field } ");` ,
272+ returnType : ` super.get("${ field } ");` ,
284273 } ) ;
285274
286275 this . setter . push ( {
287276 fieldname : field ,
288277 type : `${ type . type } ${ nullable ? " | undefined" : "" } ` ,
289- action : `super.set("${ field } ", value);` ,
278+ action : ` super.set("${ field } ", value);` ,
290279 } ) ;
291280 }
292281 }
293282 }
294283
284+ /**
285+ * Returns whether the field is nullable.
286+ * @param fieldAttributes The attributes of the field
287+ * @returns Whether the field is nullable
288+ */
289+ private getTypescriptFieldNullable (
290+ fieldAttributes : SchemaInterface [ "fields" ] [ 0 ]
291+ ) {
292+ return fieldAttributes . required || "defaultValue" in fieldAttributes ;
293+ }
294+
295295 /**
296296 * Returns custom type and importfrom if defined in config for a class/field.
297297 */
0 commit comments