diff --git a/packages/zod-validator/src/index.ts b/packages/zod-validator/src/index.ts index 710d713b..40777017 100644 --- a/packages/zod-validator/src/index.ts +++ b/packages/zod-validator/src/index.ts @@ -5,7 +5,7 @@ import type { z, ZodSchema, ZodError } from 'zod' export type Hook = ( result: { success: true; data: T } | { success: false; error: ZodError; data: T }, c: Context -) => Response | Promise | void | Promise | TypedResponse | Promise> +) => Response | void | TypedResponse | Promise> type HasUndefined = undefined extends T ? true : false @@ -50,6 +50,7 @@ export const zValidator = < if (hookResult instanceof Response) { return hookResult } + if ('response' in hookResult) { return hookResult.response }