Add an option of adding `!` after generated class properties name
lxmfly123 opened this issue · 0 comments
lxmfly123 commented
Expected Behavior
The generated class works well with compilerOptions.strict: true
.
Actual Behavior
After set compilerOptions.strict: true
in tsconfig, all required fileds will get an error:
Property 'usage' has no initializer and is not definitely assigned in the constructor.
This can be fixed by adding an !
to the end of property name. Like:
export class Example {
id!: number;
usage!: number;
description?: string;
}
Maybe a new genarate option can solve this?
Steps to Reproduce the Problem
- set
compilerOptions.strict: true
in tsconfig - generate the class from prisma schema
- open generated class file
Specifications
- Version:
- Prisma Version:
- Platform: