'keyof type operator with indexed signature
I was reading through typescript docs and came through this code excerpt:
type Mapish = { [k: string]: boolean };
type M = keyof Mapish;
and they gave the following explanation:
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"].
so my question is why number exclusively? why not boolean or object?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
