Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ts: Migrate header.js to typescript.
xoldyckkc575d62d5aa8
diff --git a/web/src/portico/header.js b/web/src/portico/header.tssimilarity index 88%rename from web/src/portico/header.jsrename to web/src/portico/header.tsindex 6ca2b99af2e..c7ecf0db673 100644--- a/web/src/portico/header.js+++ b/web/src/portico/header.ts@@ -1,7 +1,9 @@import $ from "jquery";$(() => {- function on_tab_menu_selection_change(event) {+ function on_tab_menu_selection_change(+ event?: JQuery.ChangeEvent<HTMLElement> | JQuery.ClickEvent<HTMLElement>,+ ): void {// Pass event to open menu and if it is undefined, we close the menu.if (!event) {$("#top-menu-submenu-backdrop").css("height", "0px");@@ -15,7 +17,7 @@ $(() => {}}- function on_top_menu_tab_unselect_click() {+ function on_top_menu_tab_unselect_click(): void {// Close the menu.$("#top-menu-tab-close").prop("checked", true);on_tab_menu_selection_change();@@ -64,6 +66,9 @@ $(() => {e.preventDefault();e.stopPropagation();const labelID = $(e.currentTarget).attr("for");+ if (labelID === undefined) {+ throw new Error("Current target of this event must have for attribute defined.");+ }$(`#${CSS.escape(labelID)}`).trigger("click");}});