fix(Intl): make Intl.Collator.compare a getter that returns a bound function (#62048)#62052
fix(Intl): make Intl.Collator.compare a getter that returns a bound function (#62048)#62052ahsansheikh94 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
|
@microsoft-github-policy-service agree |
| // @target: es2022 | ||
| // @lib: es2022.intl |
There was a problem hiding this comment.
es2022.intl doesn't reference lib.es5, so Collator isn't actually defined in your test script (check the baselines).
Either change this to
| // @target: es2022 | |
| // @lib: es2022.intl | |
| // @target: es5 | |
| // @lib: es5 |
or just get rid of the lib option entirely, and use the default.
|
@typescript-bot test it |
|
Hey @DanielRosenwasser, the results of running the DT tests are ready. Everything looks the same! |
|
@DanielRosenwasser Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
@DanielRosenwasser Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@DanielRosenwasser Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
What this PR does
This PR updates the type definition for
Intl.Collator.prototype.compareto align with the ECMAScript specification.Previously, compare was declared as a method:
compare(x: string, y: string): number;According to the spec, it is a getter that returns a bound function:
get compare(): (this: void, x: string, y: string) => number;Changing this to a getter would cause conflicts with the existing implementations as pointed out by @Renegade334.
Instead adding a
this: voidgets the job done.Changes made
Intl.Collatorinterface insrc/lib/es5.d.ts:tests/cases/conformance/intl/collatorCompareBoundFunction.tsRelated Issue
Fixes #62048