Skip to content

Commit

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

* changeset
  • Loading branch information
yusukebe authored Sep 5, 2023
1 parent 7fdc882 commit 1bfd648
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-planets-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/zod-openapi': major
---

fix(zod-openapi): fix a type error
4 changes: 2 additions & 2 deletions packages/zod-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"zod": "3.*"
},
"devDependencies": {
"hono": "^3.5.4",
"hono": "^3.5.8",
"zod": "^3.22.1"
},
"dependencies": {
Expand All @@ -41,4 +41,4 @@
"engines": {
"node": ">=16.0.0"
}
}
}
4 changes: 3 additions & 1 deletion packages/zod-openapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ type ConvertPathType<T extends string> = T extends `${infer _}/{${infer Param}}$
? `/:${Param}`
: T

type HandlerResponse<O> = TypedResponse<O> | Promise<TypedResponse<O>>

export class OpenAPIHono<
E extends Env = Env,
S extends Schema = {},
Expand All @@ -166,7 +168,7 @@ export class OpenAPIHono<
P extends string = ConvertPathType<R['path']>
>(
route: R,
handler: Handler<E, P, I, OutputType<R>>,
handler: Handler<E, P, I, HandlerResponse<OutputType<R>>>,
hook?: Hook<I, E, P, OutputType<R>>
): Hono<E, ToSchema<R['method'], P, I['in'], OutputType<R>>, BasePath> => {
this.#registry.registerPath(route)
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5838,10 +5838,10 @@ hono@^3.5.2:
resolved "https://registry.yarnpkg.com/hono/-/hono-3.5.2.tgz#83776c4f076c40f59850105af835a6a5609b7d07"
integrity sha512-HezADUIepgTpn+LSHNU2vZd4V2wcFDkObycShxhR37eXwQXgjev9FHsxBpDkvPqGQLn3YAPiC3GNVZVUsbcwFg==

hono@^3.5.4:
version "3.5.4"
resolved "https://registry.yarnpkg.com/hono/-/hono-3.5.4.tgz#66057d4c1ee127faafa087168af6d569ab25f5e7"
integrity sha512-GrRBIJhZ+tG+8RtoyPQjvqPGwppERmayyTiPKano4egmpkJf1XiptESUYK5vKHICNaJksAKB9jzy1CmOdQENPA==
hono@^3.5.8:
version "3.5.8"
resolved "https://registry.yarnpkg.com/hono/-/hono-3.5.8.tgz#9bbc412f5a54183cf2a81a36a9b9ea56da10f785"
integrity sha512-ZipTmGfHm43q5QOEBGog2wyejyNUcicjPt0BLDQ8yz9xij/y9RYXRpR1YPxMpQqeyNM7isvpsIAe9Ems51Wq0Q==

hosted-git-info@^2.1.4:
version "2.8.9"
Expand Down

0 comments on commit 1bfd648

Please sign in to comment.