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
{{ message }}
Repository navigation
Array<number>.sort() uses lexicographic comparator by default #32593
Related Issues: #18286 is related but it recommends a breaking change. Instead, the default comparator should take the element type into consideration.
Goal 6.: Align with current and future ECMAScript proposals.
Goal 7.: Preserve runtime behavior of all JavaScript code.
Non-goal 5.: Add or rely on run-time type information in programs, or emit different code based on the results of the type system. Instead, encourage programming patterns that do not require run-time metadata.
Activity
MartinJohns commentedon Jul 28, 2019
This is unrelated to TypeScript, it's up to the runtime.
Also this is the correct behavior: MDN documentation of Array.prototype.sort()
Changing this would violate several of the TypeScript Design Goals:
RyanCavanaugh commentedon Jul 29, 2019
TypeScript doesn't change the behavior of JavaScript code.
Rudxain commentedon Nov 12, 2024