types.ts
1 import { z } from 'zod/v4' 2 import { lazySchema } from '../lazySchema.js' 3 4 const TodoStatusSchema = lazySchema(() => 5 z.enum(['pending', 'in_progress', 'completed']), 6 ) 7 8 export const TodoItemSchema = lazySchema(() => 9 z.object({ 10 content: z.string().min(1, 'Content cannot be empty'), 11 status: TodoStatusSchema(), 12 activeForm: z.string().min(1, 'Active form cannot be empty'), 13 }), 14 ) 15 export type TodoItem = z.infer<ReturnType<typeof TodoItemSchema>> 16 17 export const TodoListSchema = lazySchema(() => z.array(TodoItemSchema())) 18 export type TodoList = z.infer<ReturnType<typeof TodoListSchema>>