import type { Env, ValidationTargets, Context, TypedResponse, Input, MiddlewareHandler } from 'hono'; import { ZodError, ZodSchema, z } from 'zod'; type Hook< T, E extends Env, P extends string, Target extends keyof ValidationTargets = keyof ValidationTargets, O = {} > = ( result: ( | { success: true; data: T; } | { success: false; error: ZodError; data: T; } ) & { target: Target; }, c: Context ) => Response | void | TypedResponse | Promise>; type HasUndefined = undefined extends T ? true : false; declare const zValidator: < T extends ZodSchema, Target extends keyof ValidationTargets, E extends Env, P extends string, In = z.input, Out = z.output, I extends Input = { in: HasUndefined extends true ? { [K in Target]?: | (In extends ValidationTargets[K] ? In : { [K2 in keyof In]?: ValidationTargets[K][K2] | undefined }) | undefined; } : { [K_1 in Target]: In extends ValidationTargets[K_1] ? In : { [K2_1 in keyof In]: ValidationTargets[K_1][K2_1] }; }; out: { [K_2 in Target]: Out }; }, V extends I = I >( target: Target, schema: T, hook?: Hook, E, P, Target, {}> | undefined ) => MiddlewareHandler; export { type Hook, zValidator };