fix(zod-openapi): properly convert openapi path type to hono (#182)

* fix: properly convert openapi path type to hono

* chore: add changeset
pull/183/head
Nico Franke 2023-09-28 23:08:26 +02:00 committed by GitHub
parent d4ae60d489
commit 9aefddc45d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---
properly convert openapi path type to hono

View File

@ -145,8 +145,8 @@ type Hook<T, E extends Env, P extends string, O> = (
c: Context<E, P> c: Context<E, P>
) => TypedResponse<O> | Promise<TypedResponse<T>> | void ) => TypedResponse<O> | Promise<TypedResponse<T>> | void
type ConvertPathType<T extends string> = T extends `${infer _}/{${infer Param}}${infer _}` type ConvertPathType<T extends string> = T extends `${infer Start}/{${infer Param}}${infer Rest}`
? `/:${Param}` ? `${Start}/:${Param}${ConvertPathType<Rest>}`
: T : T
type HandlerResponse<O> = TypedResponse<O> | Promise<TypedResponse<O>> type HandlerResponse<O> = TypedResponse<O> | Promise<TypedResponse<O>>