fix(zod-openapi): relax input types (#211)

* fix(zod-openapi): relax input types

* changeset
pull/212/head
Yusuke Wada 2023-10-26 17:49:10 +09:00 committed by GitHub
parent cb5bba456b
commit 6ca8e8d8de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/zod-openapi': patch
---
fix: relax input types

View File

@ -63,7 +63,7 @@ type InputTypeBase<
> = R['request'] extends RequestTypes
? RequestPart<R, Part> extends AnyZodObject
? {
in: { [K in Type]: z.input<RequestPart<R, Part>> }
in: { [K in Type]: z.infer<RequestPart<R, Part>> }
out: { [K in Type]: z.output<RequestPart<R, Part>> }
}
: {}
@ -77,7 +77,7 @@ type InputTypeJson<R extends RouteConfig> = R['request'] extends RequestTypes
: R['request']['body']['content'][keyof R['request']['body']['content']]['schema'] extends ZodSchema<any>
? {
in: {
json: z.input<
json: z.infer<
R['request']['body']['content'][keyof R['request']['body']['content']]['schema']
>
}
@ -100,7 +100,7 @@ type InputTypeForm<R extends RouteConfig> = R['request'] extends RequestTypes
: R['request']['body']['content'][keyof R['request']['body']['content']]['schema'] extends ZodSchema<any>
? {
in: {
form: z.input<
form: z.infer<
R['request']['body']['content'][keyof R['request']['body']['content']]['schema']
>
}