Skip to content

Commit

Permalink
fix(zod-openapi): remove the type error for the hook (#607)
Browse files Browse the repository at this point in the history
* fix(zod-openapi): remove the type error for the hook

* add changeset
  • Loading branch information
yusukebe authored Jul 1, 2024
1 parent f058604 commit 375c98b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-shrimps-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---

fix: remove the type error for the hook
12 changes: 11 additions & 1 deletion packages/zod-openapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
3 changes: 1 addition & 2 deletions packages/zod-openapi/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
)
Expand Down

0 comments on commit 375c98b

Please sign in to comment.