diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-24 23:47:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-25 04:47:57 +0000 |
commit | 73169f06dff767020718a5715eba97d3575ba7e1 (patch) | |
tree | 99d458f9d2ca74e67dbb4bccd148ef549f7ce2cf /ext/js/input | |
parent | a21948daf6210f67955ae4f98a81e21b8cf9f1f2 (diff) |
Turn on @typescript-eslint/no-unsafe-argument (#728)24.2.26.0
Diffstat (limited to 'ext/js/input')
-rw-r--r-- | ext/js/input/hotkey-help-controller.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/js/input/hotkey-help-controller.js b/ext/js/input/hotkey-help-controller.js index dbb430dc..1fa9372f 100644 --- a/ext/js/input/hotkey-help-controller.js +++ b/ext/js/input/hotkey-help-controller.js @@ -89,10 +89,10 @@ export class HotkeyHelpController { // Private /** - * @param {Map<string, string>} commandMap + * @returns {Promise<chrome.commands.Command[]>} */ - async _setupGlobalCommands(commandMap) { - const commands = await new Promise((resolve, reject) => { + _getAllCommands() { + return new Promise((resolve, reject) => { if (!(isObject(chrome.commands) && typeof chrome.commands.getAll === 'function')) { resolve([]); return; @@ -107,10 +107,17 @@ export class HotkeyHelpController { } }); }); + } + + /** + * @param {Map<string, string>} commandMap + */ + async _setupGlobalCommands(commandMap) { + const commands = await this._getAllCommands(); commandMap.clear(); for (const {name, shortcut} of commands) { - if (shortcut.length === 0) { continue; } + if (typeof name !== 'string' || typeof shortcut !== 'string' || shortcut.length === 0) { continue; } const {key, modifiers} = this._hotkeyUtil.convertCommandToInput(shortcut); commandMap.set(name, this._hotkeyUtil.getInputDisplayValue(key, modifiers)); } |