Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ts: Convert keydown_util to TypeScript.

Priyank Patel7999d52400c8
diff --git a/.eslintrc.json b/.eslintrc.json
index c691da952f1..94e0a0846c8 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 b8a1b0e5f43..0cb2419513f 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;