From a9136f13ca41689dae1ae05f00820d78e42dafc4 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 23 Oct 2023 10:17:07 -0700 Subject: [PATCH] poll_widgets: Fix types used for jQuery .val(). Signed-off-by: Anders Kaseorg --- web/src/poll_widget.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/src/poll_widget.ts b/web/src/poll_widget.ts index 5a8f8007ec..ab2c118350 100644 --- a/web/src/poll_widget.ts +++ b/web/src/poll_widget.ts @@ -57,7 +57,8 @@ export function activate({ }); function update_edit_controls(): void { - const has_question = $elem.find("input.poll-question").val()!.toString().trim() !== ""; + const has_question = + $elem.find("input.poll-question").val()!.trim() !== ""; $elem.find("button.poll-question-check").toggle(has_question); } @@ -98,8 +99,8 @@ export function activate({ } function submit_question(): void { - const $poll_question_input = $elem.find("input.poll-question"); - let new_question = $poll_question_input.val()!.toString().trim(); + const $poll_question_input = $elem.find("input.poll-question"); + let new_question = $poll_question_input.val()!.trim(); const old_question = poll_data.get_question(); // We should disable the button for blank questions, @@ -123,8 +124,8 @@ export function activate({ } function submit_option(): void { - const $poll_option_input = $elem.find("input.poll-option"); - const option = $poll_option_input.val()!.toString().trim(); + const $poll_option_input = $elem.find("input.poll-option"); + const option = $poll_option_input.val()!.trim(); const options = poll_data.get_widget_data().options; if (poll_data.is_option_present(options, option)) { @@ -207,8 +208,8 @@ export function activate({ } function check_option_button(): void { - const $poll_option_input = $elem.find("input.poll-option"); - const option = ($poll_option_input.val() as string)?.trim(); + const $poll_option_input = $elem.find("input.poll-option"); + const option = $poll_option_input.val()!.trim(); const options = poll_data.get_widget_data().options; if (poll_data.is_option_present(options, option)) {