Fix type errors in extensions-slashcommands

0c0582b1398af7e58eec5ab4a2dc358def96f734

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +5 -4Ignore whitespace
public/scripts/extensions-slashcommands.js+5 -4
@@ -9,7 +9,8 @@ import { equalsIgnoreCaseAndAccents, isFalseBoolean, isTrueBoolean } from './uti
99
1010/**
1111 * @param {'enable' | 'disable' | 'toggle'} action - The action to perform on the extension
12- * @returns {(args: {[key: string]: string | SlashCommandClosure}, extensionName: string | SlashCommandClosure) => Promise<string>}
12+ * @typedef {import('./slash-commands/SlashCommand.js').NamedArguments | import('./slash-commands/SlashCommand.js').NamedArgumentsCapture} NamedArgumentsAssignment
13+ * @returns {(args: NamedArgumentsAssignment, extensionName: string | SlashCommandClosure) => Promise<string>}
1314 */
1415function getExtensionActionCallback(action) {
1516 return async (args, extensionName) => {
@@ -20,7 +21,7 @@ function getExtensionActionCallback(action) {
2021 return '';
2122 }
2223
2324 const reload = !isFalseBoolean(args?.reload?.toString());
2425 const internalExtensionName = findExtension(extensionName);
2526 if (!internalExtensionName) {
2627 toastr.warning(`Extension ${extensionName} does not exist.`);
@@ -186,8 +187,8 @@ export function registerExtensionSlashCommands() {
186187 if (args?.state instanceof SlashCommandClosure) throw new Error('\'state\' argument cannot be a closure.');
187188 if (typeof extensionName !== 'string') throw new Error('Extension name must be a string. Closures or arrays are not allowed.');
188189
189190 const action = isTrueBoolean(args?.state?.toString()) ? 'enable' :
190191 isFalseBoolean(args?.state?.toString()) ? 'disable' :
191192 'toggle';
192193
193194 return await getExtensionActionCallback(action)(args, extensionName);