barvian / number-flow

A component to transition, format, and localize numbers.
https://number-flow.barvian.me
MIT License
4.68k stars 72 forks source link

Allow newer options from `Intl.NumberFormat` like `trailingZeroDisplay` #64

Closed piotrkulpinski closed 2 weeks ago

piotrkulpinski commented 2 weeks ago

NumberFlow version

@number-flow/react@0.2.3

Framework version

react@18.3.0

Describe the bug and the steps to reproduce it

Hi, Would it be possible to allow setting newer options from Intl.NumberFormat like trailingZeroDisplay? I assume it's just a matter of updating the TypeScript target option, as the option works correctly.

CleanShot 2024-11-15 at 11 18 57

Minimal reproduction (greatly appreciated)

No response

barvian commented 2 weeks ago

Hi 👋, thanks for filing. I think this is determined by your project's tsconfig because the Intl.NumberFormatOptions types aren't bundled in. I can see the type in the site/ project which uses the same package:

image
piotrkulpinski commented 2 weeks ago

You're right. I had to update the target option in tsconfig to ESNext 👍