diff --git a/src/types/Plugin.ts b/src/types/Plugin.ts index 36c36863..a69371b4 100644 --- a/src/types/Plugin.ts +++ b/src/types/Plugin.ts @@ -9,5 +9,4 @@ export type Plugin = (...args: unknown[]) => { name: string; settings?: Settings; styles?: Styles; - themes?: Theme | Array; } \ No newline at end of file diff --git a/src/utils/configParser.ts b/src/utils/configParser.ts index 3688c22a..0b7635a8 100644 --- a/src/utils/configParser.ts +++ b/src/utils/configParser.ts @@ -80,7 +80,9 @@ export const parseConfig = async (botId: string, providedSettings: Settings | un export const getCombinedConfig = (preferredConfig: Settings | Styles, baseConfig: Settings | Styles): Settings | Styles => { - const stack: Array<{ source: object, target: object }> = [{ source: preferredConfig, target: baseConfig }]; + const stack: Array<{ source: { [key: string]: any }, target: { [key: string]: any } }> = [ + { source: preferredConfig, target: baseConfig } + ]; while (stack.length) { const poppedItem = stack.pop(); @@ -98,6 +100,9 @@ export const getCombinedConfig = (preferredConfig: Settings | Styles, baseConfig source[keyAsObjectType] !== null && !Array.isArray(source[keyAsObjectType]) ) { + if (typeof target[keyAsObjectType] !== "object" || target[keyAsObjectType] === null) { + target[keyAsObjectType] = {}; + } stack.push({ source: source[keyAsObjectType], target: target[keyAsObjectType] }); } else { try {