Skip to content

NumberFormatOptions interface is missing unit and unitDisplay properties. #38012

Closed
@obber

Description

@obber

TypeScript Version: 3.8.3 and Nightly

Search Terms: NumberFormatOptions unit unitDisplay

Code

console.log(new Intl.NumberFormat('en', {
    style: 'unit',
    unit: 'kilobyte',
    unitDisplay: 'short',
}).format(1.5));

Expected behavior:

unit and unitDisplay should be usable for NumberFormatOptions.

Actual behavior:

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

Playground Link: https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=5&pc=17#code/MYewdgziA2CmB00QHMAUZYHcAEBJMALtPAHICuAtgEawBOAYiLRQIYGoDksYHANNgG8AUNlHYIBAJ5wAXNg5kwASwJ8RYxSrkcA1kqRVJBWGrHZNBACJKIAB2gtJ2iAAsmq3kIC+ASngAzJlZ2AEZ4AFYfHwBuIA

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions