From d07484867334856cbf2a2bbef8ee14ce5ed09f2d Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 31 Jul 2024 12:43:41 -0700 Subject: [PATCH] web: Condense unnecessarily verbose function signatures. Signed-off-by: Anders Kaseorg --- web/src/compose_call_ui.ts | 2 +- web/src/info_overlay.ts | 3 +-- web/src/lightbox.ts | 3 +-- web/src/navbar_alerts.ts | 5 +---- web/src/portico/landing-page.ts | 6 +++--- web/src/settings_profile_fields.ts | 2 +- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/web/src/compose_call_ui.ts b/web/src/compose_call_ui.ts index 4c920e705e..ccdd609688 100644 --- a/web/src/compose_call_ui.ts +++ b/web/src/compose_call_ui.ts @@ -70,7 +70,7 @@ export function generate_and_insert_audio_or_video_call_link( is_video_call: !is_audio_call, }; - const make_zoom_call: () => void = () => { + const make_zoom_call = (): void => { const xhr = channel.post({ url: "/json/calls/zoom/create", data: request, diff --git a/web/src/info_overlay.ts b/web/src/info_overlay.ts index 69be3cc39b..821bbfbc0a 100644 --- a/web/src/info_overlay.ts +++ b/web/src/info_overlay.ts @@ -24,13 +24,12 @@ import {user_settings} from "./user_settings"; export let toggler: Toggle | undefined; function format_usage_html(...keys: string[]): string { - const get_formatted_keys: () => string = () => keys.map((key) => `${key}`).join("+"); return $t_html( { defaultMessage: "(or )", }, { - "key-html": get_formatted_keys, + "key-html": () => keys.map((key) => `${key}`).join("+"), }, ); } diff --git a/web/src/lightbox.ts b/web/src/lightbox.ts index 83add091c6..e520090832 100644 --- a/web/src/lightbox.ts +++ b/web/src/lightbox.ts @@ -424,8 +424,7 @@ export function show_from_selected_message(): void { const $message_selected = $(".selected_message"); let $message = $message_selected; // This is a function to satisfy eslint unicorn/no-array-callback-reference - const media_classes: () => string = () => - ".message_inline_image img, .message_inline_image video"; + const media_classes = (): string => ".message_inline_image img, .message_inline_image video"; let $media = $message.find(media_classes()); let $prev_traverse = false; diff --git a/web/src/navbar_alerts.ts b/web/src/navbar_alerts.ts index fb08711c58..769a6e3e78 100644 --- a/web/src/navbar_alerts.ts +++ b/web/src/navbar_alerts.ts @@ -25,10 +25,7 @@ import * as unread_ops from "./unread_ops"; import * as unread_ui from "./unread_ui"; import * as util from "./util"; -const show_step: ($process: JQuery, step: number) => void = function ( - $process: JQuery, - step: number, -) { +const show_step = function ($process: JQuery, step: number): void { $process .find("[data-step]") .hide() diff --git a/web/src/portico/landing-page.ts b/web/src/portico/landing-page.ts index 8c394b2a2f..cf34c0340b 100644 --- a/web/src/portico/landing-page.ts +++ b/web/src/portico/landing-page.ts @@ -53,7 +53,7 @@ export function path_parts(): string[] { return window.location.pathname.split("/").filter((chunk) => chunk !== ""); } -const apps_events: () => void = function () { +const apps_events = function (): void { const info: Record = { windows: { alt: "Windows", @@ -168,7 +168,7 @@ const apps_events: () => void = function () { update_page(); }; -const events: () => void = function () { +const events = function (): void { if (path_parts().includes("apps")) { apps_events(); } @@ -291,7 +291,7 @@ $(document).on("click", ".comparison-tab", function (this: HTMLElement) { // on subheaders of interest (those about to be sticky) let previous_entry_y = 0; - const isScrollingUp: () => boolean = () => { + const isScrollingUp = (): boolean => { let is_scrolling_up = true; if (window.scrollY > previous_y_position) { is_scrolling_up = false; diff --git a/web/src/settings_profile_fields.ts b/web/src/settings_profile_fields.ts index 5a45708a7c..4668ace80a 100644 --- a/web/src/settings_profile_fields.ts +++ b/web/src/settings_profile_fields.ts @@ -556,7 +556,7 @@ function open_edit_form_modal(this: HTMLElement): void { } if (Object.keys(deleted_values).length !== 0) { - const edit_select_field_modal_callback: () => void = () => { + const edit_select_field_modal_callback = (): void => { show_modal_for_deleting_options(field, deleted_values, update_profile_field); }; dialog_widget.close(edit_select_field_modal_callback);