Use Record type where applicable

This commit is contained in:
Matthias Schiffer 2018-11-09 15:12:26 +01:00
parent d5ba388698
commit 266d627597
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
2 changed files with 4 additions and 4 deletions

View file

@ -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;
} }

View file

@ -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,