From 8113dcf3ba8669d29b72a6257d05dc893b3e2571 Mon Sep 17 00:00:00 2001 From: SpacingBat3 Date: Mon, 10 Oct 2022 21:02:19 +0200 Subject: [PATCH] Minior type fixes in `Config` class. Use `T` generic type directly (instead of `typeof` on `this` object. --- sources/code/main/modules/config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/code/main/modules/config.ts b/sources/code/main/modules/config.ts index aadb132d..dac4e389 100644 --- a/sources/code/main/modules/config.ts +++ b/sources/code/main/modules/config.ts @@ -169,13 +169,13 @@ class Config { * @param object A JavaScript object that will be merged with the configuration object. */ - public set(object: Partial): void { + public set(object: Partial): void { const oldObject = this.get(); const newObject = deepmerge(oldObject, object); if(objectsAreSameType(newObject, oldObject)) this.write(newObject); } /** Returns the entire parsed configuration file in form of the JavaScript object. */ - public get(): typeof this.defaultConfig { + public get(): T { const parsedConfig:unknown = this.read(); const mergedConfig:unknown = deepmerge(this.defaultConfig, parsedConfig); if(objectsAreSameType(mergedConfig, this.defaultConfig))