diff --git a/.eslintrc.json b/.eslintrc.json index c691da952f..94e0a0846c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -127,6 +127,9 @@ "parserOptions": { "project": "tsconfig.json" }, + "globals": { + "JQuery": false + }, "rules": { // Disable base rule to avoid conflict "no-duplicate-imports": "off", diff --git a/static/js/keydown_util.js b/static/js/keydown_util.ts similarity index 80% rename from static/js/keydown_util.js rename to static/js/keydown_util.ts index b8a1b0e5f4..0cb2419513 100644 --- a/static/js/keydown_util.js +++ b/static/js/keydown_util.ts @@ -7,7 +7,12 @@ export const vim_down = "j"; export const vim_up = "k"; export const vim_right = "l"; -export function handle(opts) { +export function handle(opts: { + elem: JQuery; + handlers: { + [handler: string]: (() => boolean) | undefined; + }; +}): void { opts.elem.on("keydown", (e) => { if (e.altKey || e.ctrlKey || e.shiftKey) { return;