ts: Convert keydown_util to TypeScript.

We also add JQuery to globals which is a global type.
This commit is contained in:
Priyank Patel 2021-05-26 17:59:12 +00:00 committed by Tim Abbott
parent 6ab66ea17a
commit 7999d52400
2 changed files with 9 additions and 1 deletions

View File

@ -127,6 +127,9 @@
"parserOptions": { "parserOptions": {
"project": "tsconfig.json" "project": "tsconfig.json"
}, },
"globals": {
"JQuery": false
},
"rules": { "rules": {
// Disable base rule to avoid conflict // Disable base rule to avoid conflict
"no-duplicate-imports": "off", "no-duplicate-imports": "off",

View File

@ -7,7 +7,12 @@ export const vim_down = "j";
export const vim_up = "k"; export const vim_up = "k";
export const vim_right = "l"; 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) => { opts.elem.on("keydown", (e) => {
if (e.altKey || e.ctrlKey || e.shiftKey) { if (e.altKey || e.ctrlKey || e.shiftKey) {
return; return;