Closed Flusinerd closed 6 months ago
https://github.com/Flusinerd/clouts
This is the repo url.
The generated file is in the libs/models...
folder
Facing the same error using zod: 3.22.3
& prisma: 5.5.2
Types of property 'id' are incompatible.
Type 'number | IntFieldUpdateOperationsInput | undefined' is not assignable to type 'undefined'.
Type 'number' is not assignable to type 'undefined'.
The issue seems to be caused by zod
versions higher than 3.21.1
. See this issue I found.
Changing my zod
version to 3.21.1
resolved the error.
@Flusinerd @nordowl yes this is a bug in zod versions higher than 3.21.1
. To support the latest version you can use the useTypeAssertions option. But be aware that this circumvents the internal type checking. I use it in my own projects without any bugs so far but it can lead to bugs in the typesystem that are hard to debug
Just wanted to say, thank you for documenting that you have the useTypeAssertions available here. Stumbled on this thread and it helped a ton.
Describe the bug After running
prisma generate
the generated typescript file contains typescript errors that prevent building.Screenshots If applicable, add screenshots to help explain your problem.![image](https://github.com/chrishoermann/zod-prisma-types/assets/22977969/0befccf1-0376-40cd-8689-f36722e8a2ba)
Package versions (please complete the following information):
Additional context My schema: