I use an object to map one value to another, e.g.
const wordToNumber = {
one: 1,
two: 2,
three: 3,
}
But also I have a special case that when user tries to get a value by key undefined I want it to return 1 as well.
So I change the object to this:
const wordToNumber = {
one: 1,
two: 2,
three: 3,
[undefined]: 1,
}
And it works as expected in playground:
But TS complains on undefined key: TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
And I'm wondering is there anything wrong with using undefined as an object key or it's fine and I can just hide the complaint with ts-ignore?
