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:

Activity

added
BugA bug in TypeScript
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScript
on Aug 20, 2020
added this to the Backlog milestone on Aug 20, 2020
DanielRosenwasser

DanielRosenwasser commented on Aug 21, 2020

@DanielRosenwasser
Member

Thanks!

daniyaniazi

daniyaniazi commented on Apr 1, 2022

@daniyaniazi

Hey , I am facing this issue any solution yet

yassin-assim

yassin-assim commented on Aug 24, 2022

@yassin-assim

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

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

      Participants

      @wyze@DanielRosenwasser@RyanCavanaugh@yassin-assim@daniyaniazi

      Issue actions

        NumberFormatOptions interface is missing compactDisplay and signDisplay properties · Issue #40038 · microsoft/TypeScript