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.

web: Condense unnecessarily verbose function signatures.

Anders Kaseorgd07484867334
diff --git a/web/src/compose_call_ui.ts b/web/src/compose_call_ui.ts
index 4c920e705e1..ccdd609688a 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 69be3cc39b4..821bbfbc0a0 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) => `<kbd>${key}</kbd>`).join("+");
return $t_html(
{
defaultMessage: "(or <key-html></key-html>)",
},
{
- "key-html": get_formatted_keys,
+ "key-html": () => keys.map((key) => `<kbd>${key}</kbd>`).join("+"),
},
);
}
diff --git a/web/src/lightbox.ts b/web/src/lightbox.ts
index 83add091c66..e5200908324 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<HTMLMediaElement>(media_classes());
let $prev_traverse = false;
diff --git a/web/src/navbar_alerts.ts b/web/src/navbar_alerts.ts
index fb08711c58a..769a6e3e78f 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 8c394b2a2f5..cf34c0340b6 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<UserOS, VersionInfo> = {
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 5a45708a7c7..4668ace80a9 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);