mirror of https://github.com/zulip/zulip.git
billing/sponsorship: Fix TypeScript noUncheckedIndexedAccess errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
c2c2e0b9ea
commit
284beed889
|
@ -1,4 +1,5 @@
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
import assert from "minimalistic-assert";
|
||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
|
|
||||||
import * as helpers from "./helpers";
|
import * as helpers from "./helpers";
|
||||||
|
@ -19,18 +20,21 @@ function hide_submit_loading_indicator(): void {
|
||||||
|
|
||||||
function validate_data(data: helpers.FormDataObject): boolean {
|
function validate_data(data: helpers.FormDataObject): boolean {
|
||||||
let found_error = false;
|
let found_error = false;
|
||||||
|
assert(data.description !== undefined);
|
||||||
if (data.description.trim() === "") {
|
if (data.description.trim() === "") {
|
||||||
$("#sponsorship-description-error").text("Organization description cannot be blank.");
|
$("#sponsorship-description-error").text("Organization description cannot be blank.");
|
||||||
hide_submit_loading_indicator();
|
hide_submit_loading_indicator();
|
||||||
found_error = true;
|
found_error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(data.paid_users_count !== undefined);
|
||||||
if (data.paid_users_count.trim() === "") {
|
if (data.paid_users_count.trim() === "") {
|
||||||
$("#sponsorship-paid-users-count-error").text("Number of paid staff cannot be blank.");
|
$("#sponsorship-paid-users-count-error").text("Number of paid staff cannot be blank.");
|
||||||
hide_submit_loading_indicator();
|
hide_submit_loading_indicator();
|
||||||
found_error = true;
|
found_error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(data.expected_total_users !== undefined);
|
||||||
if (data.expected_total_users.trim() === "") {
|
if (data.expected_total_users.trim() === "") {
|
||||||
$("#sponsorship-expected-total-users-error").text(
|
$("#sponsorship-expected-total-users-error").text(
|
||||||
"Expected number of users cannot be blank.",
|
"Expected number of users cannot be blank.",
|
||||||
|
|
Loading…
Reference in New Issue