fix(zod-openapi): remove the type error for the hook (#607)

* fix(zod-openapi): remove the type error for the hook

* add changeset
pull/608/head
Yusuke Wada 2024-07-01 22:58:40 +09:00 committed by GitHub
parent f05860486c
commit 375c98b145
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---
fix: remove the type error for the hook

View File

@ -322,7 +322,17 @@ export class OpenAPIHono<
I,
E,
P,
RouteConfigToTypedResponse<R> | Response | Promise<Response> | void | Promise<void>
R extends {
responses: {
[statusCode: number]: {
content: {
[mediaType: string]: ZodMediaTypeObject
}
}
}
}
? MaybePromise<RouteConfigToTypedResponse<R>> | undefined
: MaybePromise<RouteConfigToTypedResponse<R>> | MaybePromise<Response> | undefined
>
| undefined = this.defaultHook
): OpenAPIHono<

View File

@ -1019,14 +1019,13 @@ describe('With hc', () => {
},
(result, c) => {
if (!result.success) {
const res = c.json(
return c.json(
{
ok: false,
source: 'routeHook' as const,
},
400
)
return res
}
}
)