Skip to content

NumberFormatOptions interface is missing unit and unitDisplay properties. #38012

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
obber opened this issue Apr 16, 2020 · 0 comments · Fixed by #38013
Closed

NumberFormatOptions interface is missing unit and unitDisplay properties. #38012

obber opened this issue Apr 16, 2020 · 0 comments · Fixed by #38013
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

@obber
Copy link
Contributor

obber commented Apr 16, 2020

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:

@obber obber changed the title NumberFormatOptions interface is missing unit and unitDisplay properties. NumberFormatOptions interface is missing unit and unitDisplay properties. Apr 16, 2020
@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 Apr 17, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 17, 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