Skip to content

NumberFormatOptions interface is missing compactDisplay and signDisplay properties #40038

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
wyze opened this issue Aug 13, 2020 · 3 comments · Fixed by #40039
Closed

NumberFormatOptions interface is missing compactDisplay and signDisplay properties #40038

wyze opened this issue Aug 13, 2020 · 3 comments · Fixed by #40039
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue

Comments

@wyze
Copy link
Contributor

wyze commented Aug 13, 2020

TypeScript Version: 3.9.2

Search Terms: NumberFormatOptions compactDisplay signDisplay

Code

console.log(new Intl.NumberFormat('en', {
    currency: 'USD',
    signDisplay: 'never',
    style: 'currency',
}).format(-1.5));

console.log(new Intl.NumberFormat('en', {
    compactDisplay: 'long',
    notation: 'compact'
}).format(100000));

Expected behavior:

compactDisplay and signDisplay should be usable for NumberFormatOptions.

Actual behavior:

Argument of type '{ currency: string; signDisplay: string; style: string; }' is not assignable to parameter of type 'NumberFormatOptions'. Object literal may only specify known properties, and 'signDisplay' does not exist in type 'NumberFormatOptions'.

Argument of type '{ compactDisplay: string; notation: string; }' is not assignable to parameter of type 'NumberFormatOptions'. Object literal may only specify known properties, and 'compactDisplay' does not exist in type 'NumberFormatOptions'.

Playground Link: https://www.typescriptlang.org/play?#code/MYewdgziA2CmB00QHMAUZYHcAEBJMALtPAHICuAtgEawBOAYiLRQIYGoDksYHANNgG8AUNlHZgZWrW7AAngC5sHAKoBlACJ8RYiAEtkYdbogAHaCwVKMANzpax2CAVlxFHCVJmytAXwCU8ABmTKzsALQAjPAArH5+ANxCQqCQMAhIaBg4+ESklDQMIWyc3HyC2qKgFCYswARGpuaWHEhgyPZiYCAEbLrgblU1dRxC-kFF7BEADDMzcfFAA

Related Issues:

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Aug 20, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 20, 2020
@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Aug 21, 2020
@DanielRosenwasser
Copy link
Member

Thanks!

@daniyaniazi
Copy link

Hey , I am facing this issue any solution yet

@yassin-assim
Copy link

I have the same issue with currencyDisplay:

Argument type { minimumFractionDigits: number, currencyDisplay: string, style: string, currency: string } is not assignable to parameter type NumberFormatOptions | undefined

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 Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants