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

Typescript error when a string value is passed to formatNumber #3949

Closed
shermanhui opened this issue Dec 29, 2022 · 3 comments
Closed

Typescript error when a string value is passed to formatNumber #3949

shermanhui opened this issue Dec 29, 2022 · 3 comments

Comments

@shermanhui
Copy link

shermanhui commented Dec 29, 2022

Which package?

intl (react-intl) and potentially intl-numberformat

Describe the bug

Typescript throws a type error when a string value is passed to formatNumber

To Reproduce

Pass a string value to these formatters in a Typescript project

intl.formatNumberToParts("199.9213154");
intl.formatNumber("199.9213154");

Codesandbox URL

https://codesandbox.io/s/nervous-joji-b8i01h?file=/src/App.tsx

Reproducible Steps/Repo

N/A

Expected behavior

Should not throw a TS error as Intl.NumberFormat docs indicate that string values are supported.

Screenshots

If applicable, add screenshots to help explain your problem.
Screen Shot 2022-12-29 at 11 20 16

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome, Safari
  • Version: latest

Smartphone (please complete the following information):

N/A

Additional context

Intl.NumberFormat docs indicate that string values should be supported here

Tests within intl package also indicate that string values are supported here

It also looks like the numberformat tests in the v8 mirror on Github also have tests that indicate support for
string type values here

@shermanhui shermanhui added the bug label Dec 29, 2022
@shermanhui shermanhui changed the title Typescript error when a string value is passed to formatNumber and formatNumberToParts Typescript error when a string value is passed to formatNumber Dec 29, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jan 14, 2023
@shermanhui
Copy link
Author

I think there's still an issue here, if not I'd appreciate some clarification on why I may be mistaken here :)

@github-actions github-actions bot removed the Stale label Jan 19, 2023
@github-actions
Copy link

github-actions bot commented Feb 3, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

1 participant