Use Record type where applicable
This commit is contained in:
parent
d5ba388698
commit
266d627597
2 changed files with 4 additions and 4 deletions
|
@ -1,8 +1,8 @@
|
||||||
export function mapFromObject<T>(obj: {[key: string]: T}): Map<string, T> {
|
export function recordToMap<T>(r: Record<string, T>): Map<string, T> {
|
||||||
const ret = new Map();
|
const ret = new Map();
|
||||||
|
|
||||||
for (const k of Object.keys(obj))
|
for (const k of Object.keys(r))
|
||||||
ret.set(k, obj[k]);
|
ret.set(k, r[k]);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ export enum ButtonCode {
|
||||||
Menu,
|
Menu,
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttonMapping: {[key: string]: ButtonCode} = {
|
const buttonMapping: Record<string, ButtonCode> = {
|
||||||
KeyZ: ButtonCode.Action,
|
KeyZ: ButtonCode.Action,
|
||||||
KeyX: ButtonCode.Back,
|
KeyX: ButtonCode.Back,
|
||||||
KeyC: ButtonCode.Menu,
|
KeyC: ButtonCode.Menu,
|
||||||
|
|
Reference in a new issue