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

Decimal validation wrong for data loaded from database #151

Open
michiim opened this issue Sep 16, 2022 · 0 comments
Open

Decimal validation wrong for data loaded from database #151

michiim opened this issue Sep 16, 2022 · 0 comments

Comments

@michiim
Copy link

michiim commented Sep 16, 2022

Helper schema for Decimal fields has to be modified because decimal data loaded from db by prisma are not instance of Decimal but Prisma.Decimal. Find more information here: https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields#working-with-decimal

But i think it is not a good idea to import the Prisma client library because this make the zod schemas not usable for frontend projects.

You could check by using Decimal.isDecimal(value). Seem to return true when it is instance of Decimal as well when it is instance of Prisma.Decimal.

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

No branches or pull requests

1 participant