billing/sponsorship: Fix TypeScript noUncheckedIndexedAccess errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-30 10:07:58 -07:00
parent c2c2e0b9ea
commit 284beed889
1 changed files with 4 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import $ from "jquery";
import assert from "minimalistic-assert";
import {z} from "zod";
import * as helpers from "./helpers";
@ -19,18 +20,21 @@ function hide_submit_loading_indicator(): void {
function validate_data(data: helpers.FormDataObject): boolean {
let found_error = false;
assert(data.description !== undefined);
if (data.description.trim() === "") {
$("#sponsorship-description-error").text("Organization description cannot be blank.");
hide_submit_loading_indicator();
found_error = true;
}
assert(data.paid_users_count !== undefined);
if (data.paid_users_count.trim() === "") {
$("#sponsorship-paid-users-count-error").text("Number of paid staff cannot be blank.");
hide_submit_loading_indicator();
found_error = true;
}
assert(data.expected_total_users !== undefined);
if (data.expected_total_users.trim() === "") {
$("#sponsorship-expected-total-users-error").text(
"Expected number of users cannot be blank.",