microsoft / microsoft/TypeScript

Intl.Collator#compare method type does not match spec

Aberta
#62,048 5 comentários 1 reação 2 responsáveis Ver no GitHub

@RyanCavanaugh já está trabalhando nisso.

Desde 19/9/2026.

  • #64344 de @copilot-swe-agent — aberto
Bug Domain: lib.d.ts Help Wanted Needs Human Review
Linguagem predominante
Go
Estrelas
111k
Forks
14.3k
Merge médio
2d 4h
PRs com merge (30d)
132

Descrição

⚙ 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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.