Hacker News new | ask | show | jobs
by WorldMaker 2940 days ago
JS allows numbers as object keys (though it's one of those weird behavioral swamps where arrays act differently from objects, and sometimes they are coerced to strings [objects] and sometimes not [arrays], depending), so this mostly seems that its just about getting better at defining the existing JS behaviors of things, modulo the "quirks" of course.

A lot of this matters in "metaprogramming" like Readonly<T> and Partial<T> which use all of the existing keys in a type to produce a "new" result (none of the key can be set, and all of the keys are optional, respectively), and making sure it doesn't miss intentional keys like symbols and numbers.