Generates minimum default data from Zod schemas, designed for forms and react-hook-form integration. Current stable version is 2.1.0, which requires Zod 4.x and TypeScript 5.x. It provides two functions: `init()` creates empty values (empty string, 0, empty array) and `empty()` creates null defaults. Unlike random data generators, it produces deterministic, minimal data suitable for form initialization. Zod 3 users should use version 1.x. Actively maintained with regular releases.
npm install zod-emptyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates using init and empty to generate default values from a Zod schema, and integrating with react-hook-form.
Run `npm install zod-empty@1` for Zod 3.x projects, or upgrade to Zod 4.x.
Upgrade Node.js to >=20.10.0.
Replace `import ZodEmpty from 'zod-empty'` with `import { init, empty } from 'zod-empty'`.Set your own default values if the generated ones don't meet validation requirements.
Check the supported types in the source or tests before using complex schemas.
Ensure you have installed zod-empty@2 and zod@4: `npm install zod@4 zod-empty`
Change `import init from 'zod-empty'` to `import { init } from 'zod-empty'`Ensure you pass a Zod object schema: `init(z.object({...}))`