Closed richardweaver closed 1 year ago
Good point. Should be a rather easy enhancement. Maybe I'll be able to do it this week,
With the latest release, you can now set the flag definiteAssignmentAssertion = "true"
to add the definite assignment assertion operator !
to properties.
Brilliant, thanks!
Firstly, can I say kudos for taking this library forward and your enhancements - it's so great to be able to use Prisma as the single source of truth for the model, DTOs, validation and OpenAPI.
One suggestion: fields in DTO and entity classes could (optionally) be specified with the Definite Type Assertion
!
prefix. This is so that we don't need to set"strictPropertyInitialization": false
intsconfig.json
.For example, the schema:
... the generated fields are:
It would be great to be able instead to output
Definite Type Assertion was specifically added to Typescript to account for scenarios where fields are not necessarily initialised in a constructor but populated by an external library - exactly as with a DTO. Docs