Skip to content

BigInt.toLocaleString does not have any arguments, and Intl.NumberFormat does not support formatting BigInt #36970

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
MelnCat opened this issue Feb 24, 2020 · 0 comments · Fixed by #38526
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@MelnCat
Copy link

MelnCat commented Feb 24, 2020

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:
bigint
bigint format
bigint numberformat
Code

console.log((2000n).toLocaleString("fr"));
console.log(new Intl.NumberFormat("fr").format(3000n));

Expected behavior:
The code runs without errors, and "2 000" and "3 000" is logged to the console.
Actual behavior:
The code fails to compile, with the errors

Expected 0 arguments, but got 1. ts(2554)
Argument of type '3000n' is not assignable to parameter of type 'number'. ts(2345)

It shouldn't fail. Reference
ECMA Specification
image

Playground Link: Link

Related Issues:

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this labels Feb 24, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants