I am attempting to create a static Map that will store key value pairs with strings only. These values are meant to be constant and never change.
Here is an example of what I'm trying to achieve:
static KEY_VALUE_PAIR: Map<string, string>: {
'space' : 'jump',
'enter' : 'hit'
}
However, when I implement this, I encounter an error message stating
Type '{ 'space': string; }' is not assignable to type 'Map<string, string>'.
Do you have any insights on why this might be happening?
If I remove the return type Map<string, string>
, it functions as a regular object without issue.