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 list_util module to TypeScript.

Priyank Pateld660f512fa30
diff --git a/static/js/list_util.js b/static/js/list_util.ts
similarity index 64%
rename from static/js/list_util.js
rename to static/js/list_util.ts
index 84e9b330161..59ec3ef8b40 100644
--- a/static/js/list_util.js
+++ b/static/js/list_util.ts
@@ -2,18 +2,18 @@ import $ from "jquery";
const list_selectors = ["#stream_filters", "#global_filters", "#user_presences"];
-export function inside_list(e) {
+export function inside_list(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): boolean {
const $target = $(e.target);
const in_list = $target.closest(list_selectors.join(", ")).length > 0;
return in_list;
}
-export function go_down(e) {
+export function go_down(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): void {
const $target = $(e.target);
$target.closest("li").next().find("a").trigger("focus");
}
-export function go_up(e) {
+export function go_up(e: JQuery.KeyDownEvent | JQuery.KeyPressEvent): void {
const $target = $(e.target);
$target.closest("li").prev().find("a").trigger("focus");
}
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 327b0de0a1d..e2d31643aa7 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -76,7 +76,7 @@ EXEMPT_FILES = {
"static/js/invite.js",
"static/js/lightbox_canvas.js",
"static/js/lightbox.js",
- "static/js/list_util.js",
+ "static/js/list_util.ts",
"static/js/loading.js",
"static/js/local_message.js",
"static/js/localstorage.js",