-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
lib Update Request
In TS 4.4.4 signDisplay options of Intl.NumberFormat() constructor options object used to be of type string. See here:
TypeScript/src/lib/es2020.intl.d.ts
Line 267 in f633446
| signDisplay?: string; |
That was changed in this PR: #45647. Now it's of type "auto" | "never" | "always" | undefined. However, I believe this type union is incomplete and should also include "exceptZero" (see MDN and spec links below). As a result starting from TS 4.5.0-beta (or possibly earlier, I didn't test versions between 4.4.4 and 4.5.0-beta) you now get an error if you try to instantiate Intl.NumberFormat with signDisplay option set to "exceptZero".
Configuration Check
My compilation target is ES2015 and my lib is the default.
Missing / Incorrect Definition
I'm expecting "exceptZero" to be a valid value for signDisplay option of Intl.NumberFormat() constructor options object.
Sample Code
const numberFormatter = new Intl.NumberFormat('en', {
signDisplay: 'exceptZero' // expect `exceptZero` to be a valid value but it's not according to type definitions
});Documentation Link
See MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#parameters
See spec: https://402.ecma-international.org/7.0/#sec-getoption