-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Intl.Collator#compare method type does not match spec #62048
Copy link
Copy link
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 thisNeeds Human ReviewThis issue has a backlog check awaiting maintainer review.This issue has a backlog check awaiting maintainer review.
Milestone
Description
Activity
Metadata
Metadata
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 thisNeeds Human ReviewThis issue has a backlog check awaiting maintainer review.This issue has a backlog check awaiting maintainer review.
⚙ Compilation target
ES2022
⚙ Library
N/A
Missing / Incorrect Definition
The Intl.Collator object has a
comparemethod which is declared ascompare(x: string, y: string): number;but according to the relevant spec is actuallyget compare(): (this: void, x: string, y: string) => number. Importantly, the spec states thatSample 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