Loading homepage
Validate primitive values and flat object shapes with typed results and structured error paths.
Input: const user = schema.object({ name: schema.string(), age: schema.number().optional() }); user.safeParse({ name: "Ada", extra: true }); Output: { success: true, data: { name: "Ada" } }
Input: user.safeParse({ name: 3, age: "20" }); Output: Two errors: ["name"] / "Expected string", then ["age"] / "Expected finite number".
Implement the exported schema builder in index.js or index.ts. Tests cover the documented scope and edge cases.