kimjbstar/prisma-class-generator

Add an option of adding `!` after generated class properties name

lxmfly123 opened this issue · 0 comments

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

  1. set compilerOptions.strict: true in tsconfig
  2. generate the class from prisma schema
  3. open generated class file

Specifications

  • Version:
  • Prisma Version:
  • Platform: