Skip to content

Intl.PluralRules constructor should not be callable without new #63606

Description

@ptomato

⚙ Compilation target

esnext

⚙ Library

lib.es2020.intl.d.ts

Missing / Incorrect Definition

(locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules;
makes Intl.PluralRules callable without new, but this is not the case according to the Intl specification (step 1 of https://tc39.es/ecma402/#sec-intl.pluralrules).

Sample Code

Intl.PluralRules('en')
Intl.DurationFormat('en')
Intl.DateTimeFormat('en')


TSC produces an error on line 2, but it should also produce the same error on line 1. It should _not_ produce an error on line 3, since DateTimeFormat has the legacy behaviour of being callable without `new`.

Documentation Link

https://tc39.es/ecma402/#sec-intl.pluralrules

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions