diff --git a/src/auto-generator.ts b/src/auto-generator.ts index 9d3b4252..95ce2ccb 100644 --- a/src/auto-generator.ts +++ b/src/auto-generator.ts @@ -698,7 +698,13 @@ export class AutoGenerator { if (!this.options.skipFields || !this.options.skipFields.includes(field)){ const name = this.quoteName(recase(this.options.caseProp, field)); const isOptional = this.getTypeScriptFieldOptional(table, field); - str += `${sp}${name}${isOptional ? '?' : notNull}: ${this.getTypeScriptType(table, field)};\n`; + str += `${sp}${name}${isOptional ? '?' : notNull}: ${this.getTypeScriptType(table, field)}`; + + if (isOptional) { + str += ' | null' + } + + str += ';\n' } }); return str;