Skip to content

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

Closed

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:

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

Activity

  1. iAziz786 commented on Nov 9, 2021

    @iAziz786
    Contributor

    I would like to pick this issue.

  2. iAziz786 commented on Nov 9, 2021

    @iAziz786
    Contributor

    I assume adding the missing type in the union will do the work?

  3. bolatovumar commented on Nov 10, 2021

    @bolatovumar
    Author

    Mohammad Aziz (@iAziz786) yeah, that's correct.

  4. iAziz786 commented on Nov 11, 2021

    @iAziz786
    Contributor

    Cool, Daniel Rosenwasser (@DanielRosenwasser) may I request for the PR to review by anyone?

  5. ArthurGuez commented on Jan 27, 2022

    @ArthurGuez

    Hi there,

    I've updated Typescript to 4.5.5 but I'm still having the aforementioned issue. Has the fix been applied?

  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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