diff --git a/.changeset/ninety-shoes-lay.md b/.changeset/ninety-shoes-lay.md new file mode 100644 index 000000000..cae056cb1 --- /dev/null +++ b/.changeset/ninety-shoes-lay.md @@ -0,0 +1,6 @@ +--- +'@hono/typebox-validator': patch +'@hono/valibot-validator': patch +--- + +exported the Hook type diff --git a/packages/typebox-validator/src/index.ts b/packages/typebox-validator/src/index.ts index 2f52ee834..3b38f5d8d 100644 --- a/packages/typebox-validator/src/index.ts +++ b/packages/typebox-validator/src/index.ts @@ -3,7 +3,7 @@ import { Value, type ValueError } from '@sinclair/typebox/value' import type { Context, Env, MiddlewareHandler, ValidationTargets } from 'hono' import { validator } from 'hono/validator' -type Hook = ( +export type Hook = ( result: { success: true; data: T } | { success: false; errors: ValueError[] }, c: Context ) => Response | Promise | void diff --git a/packages/valibot-validator/src/index.ts b/packages/valibot-validator/src/index.ts index 36834916c..e430583f6 100644 --- a/packages/valibot-validator/src/index.ts +++ b/packages/valibot-validator/src/index.ts @@ -3,7 +3,7 @@ import { validator } from 'hono/validator' import type { GenericSchema, GenericSchemaAsync, InferInput, InferOutput, SafeParseResult } from 'valibot' import { safeParseAsync } from 'valibot' -type Hook = ( +export type Hook = ( result: SafeParseResult, c: Context ) => Response | Promise | void | Promise