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

issue with Next.js Decimal data type (data fetched from prisma/postgres) #152

Open
krthush opened this issue Sep 1, 2021 · 2 comments
Open

Comments

@krthush
Copy link

krthush commented Sep 1, 2021

tried to use superjson as a solution for this issue vercel/next.js#11993, as suggested in https://github.com/blitz-js/superjson#using-with-nextjs

unfortunatly ran into issue with serialization of the Decimal data type as shown by the below error:

image

would be great if superjson supported this? or am I doing something wrong?

I'd rather not resort to have to using maps as shown in this fix prisma/prisma-examples#3047 and our current fallback of JSON.parse(JSON.stringify(result) is somewhat inefficient I imagine

@Skn0tt
Copy link
Collaborator

Skn0tt commented Sep 6, 2021

Hi @krthush, thank you for reporting this! Decimals are indeed not supported at the moment, but should be relatively straight-forward to add by adding a new entry to this file: https://github.com/blitz-js/superjson/blob/main/src/transformer.ts

Would you be interested in contributing a PR for this? Would love your help on it :)

@krthush
Copy link
Author

krthush commented Sep 8, 2021

Hi @Skn0tt , sounds good - a bit tight with time at the moment (since this issue isn't our highest priority atm) but yeah this is something I'll likely look into - will try to contribute a PR when I can!

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

Successfully merging a pull request may close this issue.

2 participants