Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
views_util: Convert module to typescript.
evykassirer16bf8d3df6d5
diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex f65760dce04..1af5f14c742 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -182,7 +182,6 @@ EXEMPT_FILES = make_set("web/src/realm_playground.ts","web/src/realm_user_settings_defaults.ts","web/src/recent_view_ui.js",- "web/src/recent_view_util.js","web/src/reload.js","web/src/reload_setup.js","web/src/reminder.js",@@ -285,7 +284,7 @@ EXEMPT_FILES = make_set("web/src/user_topic_popover.js","web/src/user_topics.ts","web/src/user_topics_ui.js",- "web/src/views_util.js",+ "web/src/views_util.ts","web/src/zcommand.ts","web/src/zform.js","web/src/zulip.js",diff --git a/web/src/views_util.js b/web/src/views_util.tssimilarity index 84%rename from web/src/views_util.jsrename to web/src/views_util.tsindex 9582471bdce..09cba27aae4 100644--- a/web/src/views_util.js+++ b/web/src/views_util.ts@@ -33,7 +33,12 @@ export const COMMON_DROPDOWN_WIDGET_PARAMS = {disable_for_spectators: true,};-export function filters_dropdown_options(current_value) {+export function filters_dropdown_options(current_value: string | number | undefined): {+ unique_id: string;+ name: string;+ description: string;+ bold_current_selection: boolean;+}[] {return [{unique_id: FILTERS.FOLLOWED_TOPICS,@@ -58,7 +63,15 @@ export function filters_dropdown_options(current_value) {];}-export function show(opts) {+export function show(opts: {+ highlight_view_in_left_sidebar: () => void;+ $view: JQuery;+ update_compose: () => void;+ is_visible: () => boolean;+ set_visible: (value: boolean) => void;+ complete_rerender: () => void;+ is_recent_view?: boolean;+}): void {if (narrow_state.has_shown_message_list_view) {message_lists.save_pre_narrow_offset_for_reload();}@@ -99,10 +112,10 @@ export function show(opts) {}}-export function hide(opts) {- const $focused_element = $(document.activeElement);- if (opts.$view.has($focused_element)) {- $focused_element.trigger("blur");+export function hide(opts: {$view: JQuery; set_visible: (value: boolean) => void}): void {+ const active_element = document.activeElement;+ if (active_element !== null && opts.$view.has(active_element)) {+ $(active_element).trigger("blur");}$("#message_feed_container").show();