microsoft / microsoft/TypeScript

Intl.Collator#compare method type does not match spec

Aperta
#62,048 5 commenti 1 reazione 2 assegnatari Vedi su GitHub

@RyanCavanaugh ci sta già lavorando.

Dal 19/9/2026.

  • #64344 di @copilot-swe-agent — aperta
Bug Domain: lib.d.ts Help Wanted Needs Human Review
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

⚙ 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 https://github.com/typescript-eslint/typescript-eslint/issues/7098

Documentation Link

Collator#compare spec
MDN docs on compare method

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.