You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
⚙ 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