fix(zod-openapi): properly convert openapi path type to hono (#182)
* fix: properly convert openapi path type to hono * chore: add changesetpull/183/head
parent
d4ae60d489
commit
9aefddc45d
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@hono/zod-openapi': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
properly convert openapi path type to hono
|
|
@ -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>>
|
||||||
|
|
Loading…
Reference in New Issue