Skip to content

Commit

Permalink
refactor: Update types in combine config function
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Oct 31, 2024
1 parent e41b620 commit b880f1e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils/configParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ export const parseConfig = async (botId: string, providedSettings: Settings | un
export const getCombinedConfig = (preferredConfig: Settings | Styles, baseConfig: Settings |
Styles): Settings | Styles => {

const stack: Array<{ source: { [key: string]: any }, target: { [key: string]: any } }> = [
{ source: preferredConfig, target: baseConfig }
];
const stack: Array<{ source: object, target: object }> = [{ source: preferredConfig, target: baseConfig }];

while (stack.length) {
const poppedItem = stack.pop();
Expand All @@ -101,7 +99,7 @@ export const getCombinedConfig = (preferredConfig: Settings | Styles, baseConfig
!Array.isArray(source[keyAsObjectType])
) {
if (typeof target[keyAsObjectType] !== "object" || target[keyAsObjectType] === null) {
target[keyAsObjectType] = {};
(target as Record<string, object>)[keyAsObjectType] = {};
}
stack.push({ source: source[keyAsObjectType], target: target[keyAsObjectType] });
} else {
Expand Down

0 comments on commit b880f1e

Please sign in to comment.