Skip to content

"exceptZero" for "signDisplay" option of Intl.NumberFormat() constructor options object  #46712

Closed
@bolatovumar

Description

@bolatovumar

lib Update Request

In TS 4.4.4 signDisplay options of Intl.NumberFormat() constructor options object used to be of type string. See here:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions