Open
Description
@martine says
https://influxdata.com/blog/the-chronograf-files-the-curious-case-of-javascripts-sort/
tldr array.sort() coerces to strings sorts lexicographically, you need to pass a comparator if you want otherwise.
Ideally we could catch this in the type system, e.g. only allow the no-arg sort() for arrays of strings.
But I think you can't express that in the TS type system.
Maybe this is a good motivating example for some sort of fancier static analysis pass -- it needs to know the type of the variable to properly check.
Metadata
Assignees
Labels
No labels