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: Avoid Zod z.number().int().

Anders Kaseorg1d419f864d5a
diff --git a/web/src/todo_widget.ts b/web/src/todo_widget.ts
index c2aad6215b4..66824a4684f 100644
--- a/web/src/todo_widget.ts
+++ b/web/src/todo_widget.ts
@@ -37,7 +37,7 @@ const todo_widget_inbound_data = z.intersection(
// clearer and less confusing.
const new_task_inbound_data_schema = z.object({
type: z.optional(z.literal("new_task")),
- key: z.number().int().nonnegative().max(MAX_IDX),
+ key: z.int().check(z.nonnegative(), z.lte(MAX_IDX)),
task: z.string(),
desc: z.string(),
completed: z.boolean(),