From b6568cd75b795f18a30e254bc354c37d5082b0bb Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 26 Feb 2022 23:46:24 +0100 Subject: [PATCH] removed any --- frontend/src/scripts/elements/commandline.ts | 29 ++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/frontend/src/scripts/elements/commandline.ts b/frontend/src/scripts/elements/commandline.ts index 78fb8e98e..fa6080cee 100644 --- a/frontend/src/scripts/elements/commandline.ts +++ b/frontend/src/scripts/elements/commandline.ts @@ -46,7 +46,15 @@ function showFound(): void { (obj.configValueMode && obj.configValueMode === "include" && // todo figure this out without using any - (Config[list.configKey] as any[]).includes(obj.configValue)) || + ( + Config[list.configKey] as ( + | string + | number + | boolean + | number[] + | undefined + )[] + ).includes(obj.configValue)) || Config[list.configKey] === obj.configValue ) { icon = ``; @@ -260,21 +268,22 @@ function addChildCommands( commandItemDisplay = parentCommandDisplay + " > " + icon + commandItemDisplay; if ((commandItem as MonkeyTypes.Command).subgroup) { - if ((commandItem as any).beforeSubgroup) - (commandItem as any).beforeSubgroup(); + const command = commandItem as MonkeyTypes.Command; + if (command.beforeSubgroup) command.beforeSubgroup(); try { ( (commandItem as MonkeyTypes.Command) ?.subgroup as MonkeyTypes.CommandsGroup ).list?.forEach((cmd) => { (commandItem as MonkeyTypes.CommandsGroup).configKey = ( - commandItem as any - ).subgroup.configKey; + (commandItem as MonkeyTypes.Command) + .subgroup as MonkeyTypes.CommandsGroup + ).configKey; addChildCommands( unifiedCommands, cmd, commandItemDisplay, - commandItem as any + commandItem as MonkeyTypes.CommandsGroup ); }); // commandItem.exec(); @@ -286,9 +295,13 @@ function addChildCommands( // CommandlineLists.current.pop(); } catch (e) {} } else { - const tempCommandItem: any = { ...commandItem }; + const tempCommandItem: MonkeyTypes.Command = { + ...(commandItem as MonkeyTypes.Command), + }; if (parentCommand) - (tempCommandItem as any).icon = (parentCommand as any).icon; + (tempCommandItem as MonkeyTypes.Command).icon = ( + parentCommand as unknown as MonkeyTypes.Command + ).icon; if (parentCommandDisplay) tempCommandItem.display = commandItemDisplay; unifiedCommands.push(tempCommandItem); }