fix: exported Hook type in valibot and typebox validators (#821)

* fix: exported Hook type

* chore: add changeset packages
pull/824/head
Aditya Mathur 2024-11-13 02:01:42 +05:30 committed by GitHub
parent f997ee0d9a
commit 553112c2c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
'@hono/typebox-validator': patch
'@hono/valibot-validator': patch
---
exported the Hook type

View File

@ -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<T, E extends Env, P extends string> = (
export type Hook<T, E extends Env, P extends string> = (
result: { success: true; data: T } | { success: false; errors: ValueError[] },
c: Context<E, P>
) => Response | Promise<Response> | void

View File

@ -3,7 +3,7 @@ import { validator } from 'hono/validator'
import type { GenericSchema, GenericSchemaAsync, InferInput, InferOutput, SafeParseResult } from 'valibot'
import { safeParseAsync } from 'valibot'
type Hook<T extends GenericSchema | GenericSchemaAsync, E extends Env, P extends string> = (
export type Hook<T extends GenericSchema | GenericSchemaAsync, E extends Env, P extends string> = (
result: SafeParseResult<T>,
c: Context<E, P>
) => Response | Promise<Response> | void | Promise<Response | void>