Skip to content

Commit

Permalink
fix(zod-openapi): add Promise<void> to Hook (#510)
Browse files Browse the repository at this point in the history
* fix(zod-openapi): add Promise<void> to Hook

* add changeset
  • Loading branch information
taku-hatano authored May 11, 2024
1 parent b0c94cd commit 88113fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/red-colts-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---

Add Promise<void> to Hook
8 changes: 7 additions & 1 deletion packages/zod-openapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ export type Hook<T, E extends Env, P extends string, O> = (
error: ZodError
},
c: Context<E, P>
) => TypedResponse<O> | Promise<TypedResponse<T>> | Response | Promise<Response> | void
) =>
| TypedResponse<O>
| Promise<TypedResponse<T>>
| Response
| Promise<Response>
| void
| Promise<void>

type ConvertPathType<T extends string> = T extends `${infer Start}/{${infer Param}}${infer Rest}`
? `${Start}/:${Param}${ConvertPathType<Rest>}`
Expand Down

0 comments on commit 88113fa

Please sign in to comment.