-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
BigInt support for useFormatter.format() #222
Comments
Hello and thanks for the question!
That sounds reasonable to me. I haven't worked with I'm currently quite busy with the RSC integration, so if you'd like to contribute this feature, I'd be happy to review a PR! |
Would be happy to. I made the change to a forked repo and I'd like to test it in a local project before submitting the PR, but I don't seem to be able to install from local or forked GitHub project as I normally would. Tried install from |
Thank you so much! 🙌 The easiest way is probably to add some tests in The packages starting with "example" are also linked to the local dependencies, you can use those to test the feature in an e2e way if you like! However, the examples are currently intended to demonstrate specific aspects that need to be pointed out, I think I wouldn't change them to show BigInt support though. Please note that to run the examples, you need to build Let me know how it goes! |
Thank you much. For now, I added two tests and broke one of the existing tests into two parts. All passing—sending PR over. |
Is your feature request related to a problem? Please describe.
In TypeScript, cannot easily use
BigInt
withuseFormatter().format(value)
as only accepted type of value isnumber
.Describe the solution you'd like
Change type of
value
parameter ofuseFormatter().number()
function fromnumber
tonumber | BigInt
.next-intl/packages/use-intl/src/core/createFormatter.tsx
Line 133 in be79c1b
Describe alternatives you've considered
Add a new function as opposed to changing existing, if compatibility is a concern. Note, however, that
Intl.NumberFormat(...).format(value)
does supportBigInt
.The text was updated successfully, but these errors were encountered: