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.

sponsorship: Fix implicit use of any.

Anders Kaseorg8ec694a85476
diff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.ts
index cdb916d50f7..6b99aefd188 100644
--- a/web/src/billing/sponsorship.ts
+++ b/web/src/billing/sponsorship.ts
@@ -1,4 +1,5 @@
import $ from "jquery";
+import {z} from "zod";
import * as helpers from "./helpers";
@@ -65,12 +66,13 @@ function create_ajax_request(): void {
},
error(xhr) {
hide_submit_loading_indicator();
- if (xhr.responseJSON?.msg) {
- if (xhr.responseJSON.msg === "Enter a valid URL.") {
- $("#sponsorship-org-website-error").text(xhr.responseJSON.msg);
+ const parsed = z.object({msg: z.string()}).safeParse(xhr.responseJSON);
+ if (parsed.success) {
+ if (parsed.data.msg === "Enter a valid URL.") {
+ $("#sponsorship-org-website-error").text(parsed.data.msg);
return;
}
- $("#sponsorship-error").show().text(xhr.responseJSON.msg);
+ $("#sponsorship-error").show().text(parsed.data.msg);
}
},
});