Skip to content

NumberFormatOptions interface is missing compactDisplay and signDisplay properties #40038

Closed
@wyze

Description

@wyze

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions