From 3c89da8ea57019512f72a39ef3b6ea9b2abeeeb7 Mon Sep 17 00:00:00 2001 From: MillenniumEarl Date: Sun, 21 Feb 2021 12:50:14 +0100 Subject: [PATCH] Add types --- src/scripts/shared.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/scripts/shared.ts b/src/scripts/shared.ts index bdae569..2c5e343 100644 --- a/src/scripts/shared.ts +++ b/src/scripts/shared.ts @@ -13,6 +13,8 @@ import Session from "./classes/session.js"; // Types declaration export type DictType = { [n: number]: string; }; +type KeyPrefixesType = "engines" | "statuses" | "tags" | "others"; +type PrefixesType = { [key in KeyPrefixesType]: DictType } /** * Class containing variables shared between modules. @@ -26,7 +28,7 @@ export default abstract class Shared { /** * List of platform prefixes and tags. */ - static _prefixes: {[s: string]: DictType} = {} + static _prefixes: PrefixesType = {} as PrefixesType; /** * Logger object used to write to both file and console. */ @@ -71,7 +73,7 @@ export default abstract class Shared { //#endregion Getters //#region Setters - static setPrefixPair(key: string, val: DictType): void { + static setPrefixPair(key: KeyPrefixesType, val: DictType): void { this._prefixes[key] = val; }