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();
|
||||
|
||||
for (const k of Object.keys(obj))
|
||||
ret.set(k, obj[k]);
|
||||
for (const k of Object.keys(r))
|
||||
ret.set(k, r[k]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ export enum ButtonCode {
|
|||
Menu,
|
||||
}
|
||||
|
||||
const buttonMapping: {[key: string]: ButtonCode} = {
|
||||
const buttonMapping: Record<string, ButtonCode> = {
|
||||
KeyZ: ButtonCode.Action,
|
||||
KeyX: ButtonCode.Back,
|
||||
KeyC: ButtonCode.Menu,
|
||||
|
|
Reference in a new issue