fix: exported Hook type in valibot and typebox validators (#821)
* fix: exported Hook type * chore: add changeset packagespull/824/head
parent
f997ee0d9a
commit
553112c2c6
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@hono/typebox-validator': patch
|
||||
'@hono/valibot-validator': patch
|
||||
---
|
||||
|
||||
exported the Hook type
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue