Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
type: Add type HTMLSelectOneElement.
afeefuddin1a42798b1dbc
diff --git a/web/src/invite.ts b/web/src/invite.tsindex a6c4ab0f1af..f518939531f 100644--- a/web/src/invite.ts+++ b/web/src/invite.ts@@ -25,6 +25,7 @@ import * as settings_data from "./settings_data";import {current_user, realm} from "./state_data";import * as stream_data from "./stream_data";import * as timerender from "./timerender";+import type {HTMLSelectOneElement} from "./types";import * as ui_report from "./ui_report";import * as util from "./util";@@ -48,12 +49,10 @@ function get_common_invitation_data(): {invitee_emails: string;} {const invite_as = Number.parseInt(- $<HTMLSelectElement & {type: "select-one"}>("select:not([multiple])#invite_as").val()!,+ $<HTMLSelectOneElement>("select:not([multiple])#invite_as").val()!,10,);- const raw_expires_in = $<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])#expires_in",- ).val()!;+ const raw_expires_in = $<HTMLSelectOneElement>("select:not([multiple])#expires_in").val()!;// See settings_config.expires_in_values for why we do this conversion.let expires_in: number | null;if (raw_expires_in === "null") {@@ -111,9 +110,7 @@ function beforeSend(): void {}function submit_invitation_form(): void {- const $expires_in = $<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])#expires_in",- );+ const $expires_in = $<HTMLSelectOneElement>("select:not([multiple])#expires_in");const $invite_status = $("#dialog_error");const data = get_common_invitation_data();@@ -270,9 +267,7 @@ function get_expiration_time_in_minutes(): number {}function set_expires_on_text(): void {- const $expires_in = $<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])#expires_in",- );+ const $expires_in = $<HTMLSelectOneElement>("select:not([multiple])#expires_in");if ($expires_in.val() === "custom") {$("#expires_on").hide();$("#custom_expires_on").text(valid_to(get_expiration_time_in_minutes()));@@ -283,14 +278,12 @@ function set_expires_on_text(): void {}function set_custom_time_inputs_visibility(): void {- const $expires_in = $<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])#expires_in",- );+ const $expires_in = $<HTMLSelectOneElement>("select:not([multiple])#expires_in");if ($expires_in.val() === "custom") {$("#custom-expiration-time-input").val(custom_expiration_time_input);- $<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])#custom-expiration-time-unit",- ).val(custom_expiration_time_unit);+ $<HTMLSelectOneElement>("select:not([multiple])#custom-expiration-time-unit").val(+ custom_expiration_time_unit,+ );$("#custom-invite-expiration-time").show();} else {$("#custom-invite-expiration-time").hide();@@ -340,9 +333,7 @@ function open_invite_user_modal(e: JQuery.ClickEvent<Document, undefined>): void});function invite_user_modal_post_render(): void {- const $expires_in = $<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])#expires_in",- );+ const $expires_in = $<HTMLSelectOneElement>("select:not([multiple])#expires_in");const $pill_container = $("#invitee_emails_container .pill-container");pills = input_pill.create({$container: $pill_container,@@ -411,7 +402,7 @@ function open_invite_user_modal(e: JQuery.ClickEvent<Document, undefined>): voidcustom_expiration_time_input = Number.parseFloat($<HTMLInputElement>("input#custom-expiration-time-input").val()!,);- custom_expiration_time_unit = $<HTMLSelectElement & {type: "select-one"}>(+ custom_expiration_time_unit = $<HTMLSelectOneElement>("select:not([multiple])#custom-expiration-time-unit",).val()!;$("#custom_expires_on").text(valid_to(get_expiration_time_in_minutes()));diff --git a/web/src/settings_components.ts b/web/src/settings_components.tsindex 241b06461ad..5ca17aaac83 100644--- a/web/src/settings_components.ts+++ b/web/src/settings_components.ts@@ -16,6 +16,7 @@ import type {CustomProfileField} from "./state_data";import {realm} from "./state_data";import * as stream_data from "./stream_data";import type {StreamSubscription} from "./sub_store";+import type {HTMLSelectOneElement} from "./types";import type {UserGroup} from "./user_groups";import * as util from "./util";@@ -248,9 +249,7 @@ export function change_element_block_display_property(export function is_video_chat_provider_jitsi_meet(): boolean {const video_chat_provider_id = Number.parseInt(- $<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])#id_realm_video_chat_provider",- ).val()!,+ $<HTMLSelectOneElement>("select:not([multiple])#id_realm_video_chat_provider").val()!,10,);const jitsi_meet_id = realm.realm_available_video_chat_providers.jitsi_meet.id;@@ -414,7 +413,7 @@ function read_select_field_data_from_form(function read_external_account_field_data($profile_field_form: JQuery): FieldData {const field_data: FieldData = {};field_data.subtype = $profile_field_form- .find<HTMLSelectElement & {type: "select-one"}>("select[name=external_acc_field_type]")+ .find<HTMLSelectOneElement>("select[name=external_acc_field_type]").val()!;if (field_data.subtype === "custom") {field_data.url_pattern = $profile_field_form@@ -969,7 +968,7 @@ function should_disable_save_button_for_jitsi_server_url_setting(): boolean {return false;}- const $dropdown_elem = $<HTMLSelectElement & {type: "select-one"}>(+ const $dropdown_elem = $<HTMLSelectOneElement>("select:not([multiple])#id_realm_jitsi_server_url",);const $custom_input_elem = $<HTMLInputElement>("input#id_realm_jitsi_server_url_custom_input");@@ -985,9 +984,7 @@ function should_disable_save_button_for_time_limit_settings(): boolean {let disable_save_btn = false;for (const setting_elem of time_limit_settings) {- const $dropdown_elem = $(setting_elem).find<HTMLSelectElement & {type: "select-one"}>(- "select:not([multiple])",- );+ const $dropdown_elem = $(setting_elem).find<HTMLSelectOneElement>("select:not([multiple])");const $custom_input_elem = $(setting_elem).find<HTMLInputElement>("input.time-limit-custom-input",);diff --git a/web/src/types.ts b/web/src/types.tsindex a5a3cf974a1..2bdaffe8f91 100644--- a/web/src/types.ts+++ b/web/src/types.ts@@ -52,3 +52,5 @@ export type UpdateMessageEvent = {// This will not be set until it gets fixed.topic?: string;};++export type HTMLSelectOneElement = HTMLSelectElement & {type: "select-one"};