Add types

pull/73/head
MillenniumEarl 2021-02-21 12:50:14 +01:00
parent e1dbd2effb
commit 3c89da8ea5
1 changed files with 4 additions and 2 deletions

View File

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