From 2628f35012dfeb25dbf33f9a03df04f8bf2f332f Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Mon, 19 Sep 2022 18:49:59 -0400 Subject: [PATCH] client: fix lints in scripts/hotkey.ts --- packages/client/src/scripts/hotkey.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/scripts/hotkey.ts b/packages/client/src/scripts/hotkey.ts index faeb83d18..6e5ae2b29 100644 --- a/packages/client/src/scripts/hotkey.ts +++ b/packages/client/src/scripts/hotkey.ts @@ -17,7 +17,7 @@ type Action = { allowRepeat: boolean; }; -const parseKeymap = (keymap: Keymap) => Object.entries(keymap).map(([_patterns, callback]): Action => { +const parseKeymap = (keymap: Keymap): Action[] => Object.entries(keymap).map(([_patterns, callback]): Action => { let patterns = _patterns; const result = { patterns: [], @@ -66,12 +66,12 @@ function match(ev: KeyboardEvent, patterns: Action['patterns']): boolean { ); } -export const makeHotkey = (keymap: Keymap) => { +export const makeHotkey = (keymap: Keymap): (ev: KeyboardEvent) => void => { const actions = parseKeymap(keymap); return (ev: KeyboardEvent) => { if (document.activeElement) { - if (ignoreElemens.some(el => document.activeElement!.matches(el))) return; + if (ignoreElemens.some(el => document.activeElement?.matches(el))) return; if (document.activeElement.attributes['contenteditable']) return; }