@hono/zod-validator
Advanced tools
Comparing version 0.1.1 to 0.1.2
import type { Context, MiddlewareHandler, Env, ValidationTargets } from 'hono'; | ||
import type { z } from 'zod'; | ||
import type { ZodError } from 'zod'; | ||
type Hook<T, E extends Env> = (result: { | ||
type Hook<T, E extends Env, P extends string> = (result: { | ||
success: true; | ||
@@ -10,3 +10,3 @@ data: T; | ||
error: ZodError; | ||
}, c: Context<E>) => Response | Promise<Response> | void; | ||
}, c: Context<E, P>) => Response | Promise<Response> | void; | ||
export declare const zValidator: <T extends z.ZodType<any, z.ZodTypeDef, any>, Target extends keyof ValidationTargets, E extends Env, P extends string, V extends { | ||
@@ -18,3 +18,3 @@ in: { [K in Target]: z.input<T>; }; | ||
out: { [K_3 in Target]: z.output<T>; }; | ||
}>(target: Target, schema: T, hook?: Hook<z.TypeOf<T>, E> | undefined) => MiddlewareHandler<E, P, V>; | ||
}>(target: Target, schema: T, hook?: Hook<z.TypeOf<T>, E, P> | undefined) => MiddlewareHandler<E, P, V>; | ||
export {}; |
{ | ||
"name": "@hono/zod-validator", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Validator middleware using Zod", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
3631