From 89de6682416f2aba651a0f2164812cbdd3ee6a2f Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Sun, 19 May 2024 06:24:32 -0400 Subject: [PATCH] fix typehints for while unnamed arg / command --- public/scripts/variables.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/public/scripts/variables.js b/public/scripts/variables.js index 57c28e126..2157f2d9b 100644 --- a/public/scripts/variables.js +++ b/public/scripts/variables.js @@ -316,14 +316,21 @@ function listVariablesCallback() { sendSystemMessage(system_message_types.GENERIC, htmlMessage); } -async function whileCallback(args, command) { +/** + * + * @param {import('./slash-commands/SlashCommand.js').NamedArguments} args + * @param {(string|SlashCommandClosure)[]} value + */ +async function whileCallback(args, value) { const isGuardOff = isFalseBoolean(args.guard); const iterations = isGuardOff ? Number.MAX_SAFE_INTEGER : MAX_LOOPS; - if (command) { - if (command[0] instanceof SlashCommandClosure) { - command = command[0]; + /**@type {string|SlashCommandClosure} */ + let command; + if (value) { + if (value[0] instanceof SlashCommandClosure) { + command = value[0]; } else { - command = command.join(' '); + command = value.join(' '); } }