💾 Archived View for envs.net › ~saurabh › dev › js-coercion-syndrome.gmi captured on 2023-04-19 at 22:56:25. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-03-20)
-=-=-=-=-=-=-
type Mapish = { [k: string]: boolean }; type M = keyof Mapish;
Try to guess the type of M
type M = string | number
Surprised?
According to the Typescript documentation:
Note that in this example, M is string | number — this is because JavaScript object keys are always coerced to a string, so obj[0] is always the same as obj["0"].
hashtag just-js-things