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.

web: Replace Zod z.union with z.discriminatedUnion or .nullable.

Anders Kaseorg497bd740e956
diff --git a/web/src/bot_data.ts b/web/src/bot_data.ts
index e88907b295c..ccc094c87bc 100644
--- a/web/src/bot_data.ts
+++ b/web/src/bot_data.ts
@@ -21,8 +21,8 @@ const basic_bot_schema = z.object({
avatar_url: z.string(),
bot_type: z.number(),
default_all_public_streams: z.boolean(),
- default_events_register_stream: z.union([z.string(), z.null()]),
- default_sending_stream: z.union([z.string(), z.null()]),
+ default_events_register_stream: z.string().nullable(),
+ default_sending_stream: z.string().nullable(),
email: z.string(),
full_name: z.string(),
is_active: z.boolean(),
diff --git a/web/src/settings_invites.ts b/web/src/settings_invites.ts
index 59ad3dfd3be..cff3971c80f 100644
--- a/web/src/settings_invites.ts
+++ b/web/src/settings_invites.ts
@@ -27,7 +27,7 @@ export const invite_schema = z.intersection(
id: z.number(),
invited_as: z.number(),
}),
- z.union([
+ z.discriminatedUnion("is_multiuse", [
z.object({
is_multiuse: z.literal(false),
email: z.string(),