-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug

Description
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
typed arrays
default comparator
lexicographic comparator
numeric comparator
Code
let a: Array<number> = [12,4];
a.sort();
console.log(a);
Expected behavior:
[4, 12]
Actual behavior:
[12, 4]
Playground Link:
https://codepen.io/greddyatpt/pen/aepoaN?editors=1111
Related Issues:
#18286 is related but it recommends a breaking change. Instead, the default comparator should take the element type into consideration.
AnyhowStep, cpplearner, MartinJohns, j-oliveras, dragomirtitian and 4 more
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug