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.

billing/sponsorship: Fix TypeScript noUncheckedIndexedAccess errors.

Anders Kaseorg284beed88921
diff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.ts
index 6b99aefd188..ad2537a8757 100644
--- a/web/src/billing/sponsorship.ts
+++ b/web/src/billing/sponsorship.ts
@@ -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.",