-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do this
Milestone
Description
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
samal-rasmussen, davidglezz and DoctypeRosenthal
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do this