Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (generator): fix type error with WhereUniqueInput schemas #1014

Closed
wants to merge 2 commits into from

Conversation

kevin-dp
Copy link
Contributor

This PR fixes type errors in the generated client with WhereUniqueInput schemas, as reported in: https://discord.com/channels/933657521581858818/1211387122351870072.
The type errors come from the fact that we are now using Prisma v5 for generating the Prisma client but in Prisma v5 the type for WhereUniqueInput schemas is now wrapped in an AtLeast<..., ...> type which is a breaking type change compared to the generated type in v4. Since our Zod schemas are generated using v4 the types are incompatible. This PR patches the AtLeast type such that the resulting type is equivalent to the type in v4.

Copy link
Contributor

@samwillis samwillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love a bit of regex 👍

@kevin-dp
Copy link
Contributor Author

I would hold off merging this for the moment because this does not seem to be the only problem introduced by our upgrade to Prisma v5. There is another open issue which is related to that upgrade: #1001. I tested that issue and it works when our generator uses Prisma v4 but not when we use Prisma v5. Again, due to a breaking type change in v5. Perhaps we should revert back to using Prisma v4 also for generating the Prisma client, even though we know that leads to the generator crashing if the user has Prisma v5 installed in their project.

@kevin-dp
Copy link
Contributor Author

Created a PR for reverting to Prisma v4: #1016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants