Skip to content

Intl.NumberFormatOptions options are missing #52072

Closed
@nick-korolev

Description

@nick-korolev

Bug Report

Hi. According to specification Intl.NumberFormat contains numberingSystem option, but typescript throws the error Object literal may only specify known properties, and 'numberingSystem' does not exist in type 'NumberFormatOptions'

🔎 Search Terms

Intl, NumberFormatOptions

🕗 Version & Regression Information

"typescript": "^4.9.4"

💻 Code

I have a monorepo with this structure

root

  • base.tsconfig.json
  • package.json
  • app1
    • index.ts
    • tsconfig.json
    • package.json

base.tsconfig.json

{
  "compilerOptions": {
    "module": "ESNext",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "target": "ESNext",
    "noImplicitAny": true,
    "strictNullChecks": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "allowJs": true,
    "checkJs": false,
    "lib": [
      "esnext",
      "dom"
    ],
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "emitDecoratorMetadata": true,
    "baseUrl": "."
  }
}

app1/tsconfig.json

{
  "extends": "../base.tsconfig.json",
  "compilerOptions": {
    "module": "ESNext",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "target": "ESNext",
    "noImplicitAny": true,
    "strictNullChecks": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "allowJs": true,
    "checkJs": false,
    "lib": [
      "esnext",
      "dom"
    ],
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "emitDecoratorMetadata": true,
    "baseUrl": "."
  }
}

app1/index.ts

const amount = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
  numberingSystem: 'latn'
}).format(1000);

console.log(amount);

🙁 Actual behavior

After type checking typescript throws error

index.ts:4:3 - error TS2345: Argument of type '{ style: string; currency: string; numberingSystem: string; }' is not assignable to parameter of type 'NumberFormatOptions'.
  Object literal may only specify known properties, and 'numberingSystem' does not exist in type 'NumberFormatOptions'.

4   numberingSystem: 'latn'
    ~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in index.ts:4

🙂 Expected behavior

The typescript correctly checks the types that are specified in the specification

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