tbeseda
tbeseda
HHono
Created by tbeseda on 4/9/2025 in #help
Types issue in zod-openapi in recent release 0.19.4 (repro attached)
got this down to a minimal reproduction sandbox on Stackblitz Run npm run typecheck to see the error (the editor doesn't immediately show the issue until the file is edited)
10 replies
HHono
Created by tbeseda on 4/9/2025 in #help
Types issue in zod-openapi in recent release 0.19.4 (repro attached)
(bump) I still see this issue in 0.19.5 Only way I see to fix it is using
as unknown as Promise<never>
as unknown as Promise<never>
😬
10 replies
HHono
Created by tbeseda on 4/9/2025 in #help
Types issue in zod-openapi in recent release 0.19.4 (repro attached)
and with 0.19.2 it builds. (0.19.3 has the yarn workspace bug mentioned here - fixed in 0.19.4)
10 replies
HHono
Created by tbeseda on 4/9/2025 in #help
Types issue in zod-openapi in recent release 0.19.4 (repro attached)
$ npm ls @hono/zod-openapi

[email protected] /Users/my-project
ā”œā”€ā”€ @hono/[email protected]
$ npm ls @hono/zod-openapi

[email protected] /Users/my-project
ā”œā”€ā”€ @hono/[email protected]
$ tsc repro.ts

repro.ts:42:20 - error TS2345: Argument of type '(c: Context<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }>) => Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<...>>' is not assignable to parameter of type 'Handler<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }, Promise<never>>'.
Type 'Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>>' is not assignable to type 'Promise<never>'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>' is not assignable to type 'never'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404>' is not assignable to type 'never'.

42 app.openapi(route, async (c) => {
~~~~~~~~~~~~~~
$ tsc repro.ts

repro.ts:42:20 - error TS2345: Argument of type '(c: Context<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }>) => Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<...>>' is not assignable to parameter of type 'Handler<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }, Promise<never>>'.
Type 'Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>>' is not assignable to type 'Promise<never>'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>' is not assignable to type 'never'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404>' is not assignable to type 'never'.

42 app.openapi(route, async (c) => {
~~~~~~~~~~~~~~
10 replies
HHono
Created by tbeseda on 4/9/2025 in #help
Types issue in zod-openapi in recent release 0.19.4 (repro attached)
perhaps there's a bug in the fix for this issue šŸ¤” https://github.com/honojs/middleware/issues/1102
10 replies
HHono
Created by tbeseda on 4/9/2025 in #help
Types issue in zod-openapi in recent release 0.19.4 (repro attached)
Here's the text of the type error
Argument of type '(c: Context<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }>) => Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<...>>' is not assignable to parameter of type 'Handler<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }, Promise<never>>'.
Type 'Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>>' is not assignable to type 'Promise<never>'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>' is not assignable to type 'never'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404>' is not assignable to type 'never'.ts(2345)
Argument of type '(c: Context<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }>) => Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<...>>' is not assignable to parameter of type 'Handler<AppBindings, "/widget/:widgetId", { in: { param: { widgetId?: string; }; }; out: { param: { widgetId?: string; }; }; }, Promise<never>>'.
Type 'Promise<JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>>' is not assignable to type 'Promise<never>'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404> | JSONRespondReturn<{ widgetId: string; }, 200>' is not assignable to type 'never'.
Type 'JSONRespondReturn<{ error: { code: string; message: string; }; }, 404>' is not assignable to type 'never'.ts(2345)
10 replies