We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88135cb commit 8a2d465Copy full SHA for 8a2d465
packages/zod-validator/README.md
@@ -47,12 +47,18 @@ import { ZodSchema } from "zod";
47
import type { ValidationTargets } from "hono";
48
import { zValidator as zv } from "@hono/zod-validator";
49
50
-export const zValidator = (target: keyof ValidationTargets, schema: ZodSchema) =>
51
-zv(target, schema, (result, c) => {
52
- if (!result.success) {
53
- throw new HTTPException(400, { cause: result.error });
54
- }
55
-})
+export const zValidator = <
+ T extends ZodSchema,
+ Target extends keyof ValidationTargets
+>(
+ target: Target,
+ schema: T
56
+) =>
57
+ zv(target, schema, (result, c) => {
58
+ if (!result.success) {
59
+ throw new HTTPException(400, { cause: result.error });
60
+ }
61
+ });
62
63
// usage
64
import { zValidator } from './validator-wrapper'
0 commit comments