This answer assumes that it is valid to declare a card that presses number as the key.
However, when I try the following in the playground , I get an error message.
class Foo { stringMap: { [s: string]: string; } = {}; numberMap: { [s: number]: string; } = {}; }
numberMap generates the following compiler error:
Unable to convert '{}' to '{ [s: number]: string; }' '{ [s: number]: string; }' : Index signatures types '{}' and '{ [s: number]: string; }' '{ [s: number]: string; }' incompatible {}
What is the right way to declare this?
source share