Zod Utility
Installation
shell
$ npm install @biruni/zod zod
shell
$ yarn add @biruni/zod zod
shell
$ pnpm add @biruni/zod zod
Import
typescript
import { zod } from '@biruni/zod';
Import Aliases
typescript
import zod from '@biruni/zod';
typescript
import { zod } from '@biruni/zod/mod';
typescript
import zod from '@biruni/zod/mod';
TIP
The zod
also aliased to ZodPlugin
named export
Define
typescript
import { z } from 'zod';
const CounterSchema = z.object({
count: z.number().min(1).max(10),
});
type CounterStore = z.infer<typeof CounterSchema>;
export default biruni<CounterStore>(); // optional pass to Generic Param
Usage
typescript
.plug(zod(MyStoreSchema))