Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Intl.Collator#compare method type does not match spec #62048

Copy link
Copy link
@thw0rted

Description

@thw0rted
Issue body actions

⚙ Compilation target

ES2022

⚙ Library

N/A

Missing / Incorrect Definition

The Intl.Collator object has a compare method which is declared as compare(x: string, y: string): number; but according to the relevant spec is actually get compare(): (this: void, x: string, y: string) => number. Importantly, the spec states that

The returned function is bound to collator so that it can be passed directly to Array.prototype.sort or other functions

Sample Code

I'm having trouble putting together a Playground example that cares about the difference (which is admittedly subtle!) but it's the cause of typescript-eslint/typescript-eslint#7098

Documentation Link

Collator#compare spec
MDN docs on compare method

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.