Intl.Collator#compare method type does not match spec
#62.048 aberto em 11 de jul. de 2025
Métricas do repositório
- Stars
- (48.455 stars)
- Métricas de merge de PR
- (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)
Description
⚙ 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
collatorso that it can be passed directly toArray.prototype.sortor 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 https://github.com/typescript-eslint/typescript-eslint/issues/7098