-
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
lib Update Request
If I read the spec right, baseName
and language
properties of Intl.Locale.prototype
can't be undefined
, as the spec says these property accessors return a substring.
In comparison, for script it's explicitly mentioned that returned value can be undefined.
In practice, Intl.Locale
constructor throws if you don't supply at least a language identifier, so it checks out.
Currently, in es2020.intl.d.ts
Locale
is extended from LocaleOptions
that have these properties as optional.
Configuration Check
My compilation target is ES2020
and my lib is the default
.
Missing / Incorrect Definition
Intl.Locale.prototype.baseName
Intl.Locale.prototype.language
Sample Code
{
"compilerOptions": {
"target": "ES2020",
"strict": true
}
}
const locale = new Intl.Locale("en");
// @ts-expect-error Intl.Locale.prototype.language currently is `string | undefined`
let language: string = locale.language;
// @ts-expect-error Intl.Locale.prototype.baseName currently is `string | undefined`
let baseName: string = locale.baseName;
Documentation Link
https://tc39.es/ecma402/#sec-Intl.Locale.prototype.baseName
https://tc39.es/ecma402/#sec-Intl.Locale.prototype.language
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