Skip to content

Commit

Permalink
fix: exported Hook type in valibot and typebox validators (#821)
Browse files Browse the repository at this point in the history
* fix: exported Hook type

* chore: add changeset packages
  • Loading branch information
MathurAditya724 authored Nov 12, 2024
1 parent f997ee0 commit 553112c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/ninety-shoes-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hono/typebox-validator': patch
'@hono/valibot-validator': patch
---

exported the Hook type
2 changes: 1 addition & 1 deletion packages/typebox-validator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/valibot-validator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 553112c

Please sign in to comment.