From 284beed88921f27b3fa720d25231af84df19ebe2 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 30 May 2024 10:07:58 -0700 Subject: [PATCH] billing/sponsorship: Fix TypeScript noUncheckedIndexedAccess errors. Signed-off-by: Anders Kaseorg --- web/src/billing/sponsorship.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.ts index 6b99aefd18..ad2537a875 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.",