Skip to content

string also allows as args in Intl.NumberFormat.format #61629

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

Closed
hengistchan opened this issue Apr 29, 2025 · 4 comments · May be fixed by #61628
Closed

string also allows as args in Intl.NumberFormat.format #61629

hengistchan opened this issue Apr 29, 2025 · 4 comments · May be fixed by #61628
Labels
Unactionable There isn't something we can do with this issue

Comments

@hengistchan
Copy link

⚙ Compilation target

ES2020

⚙ Library

Intl

Missing / Incorrect Definition

declare namespace Intl {
    interface NumberFormat {
        format(value: number | bigint): string;
    }
}

Sample Code

declare namespace Intl {
    interface NumberFormat {
        format(value: number | bigint | string): string;
    }
}

Documentation Link

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/format#parameters

@MartinJohns
Copy link
Contributor

MartinJohns commented Apr 29, 2025

string is intentionally not part of the signature.

Essentially the same as #43232. Just because it's possible to pass string in some cases does not make it generally valid, safe or advisable.

Edit: I guess there are some rare valid cases? Still seems bad to me tho. #52124 (comment)

@IllusionMH
Copy link
Contributor

IllusionMH commented Apr 29, 2025

Duplicate of #52124

searchable by intl format string

@RyanCavanaugh RyanCavanaugh added the Unactionable There isn't something we can do with this issue label May 2, 2025
@RyanCavanaugh
Copy link
Member

It's not clear why you want this beyond the changes that already happened at #52124. "Sample Code" should be the kind of user-land code that you want to be accepted, not your proposed diff.

@typescript-bot
Copy link
Collaborator

This issue has been marked as "Unactionable" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unactionable There isn't something we can do with this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants