hono/client is not inferring input types when using zValidator on route
Which middleware has the bug?
@hono/zod-validator
What version of the middleware?
0.4.3
What version of Hono are you using?
4.6.16
What runtime/platform is your app running on? (with version if possible)
What steps can reproduce the bug?
Set up a nested router.
const testRouter = new Hono().get(
"/test",
zValidator(
"json",
z.object({
test: z.string(),
}),
),
async (c) => {
return c.json({ success: true });
},
);
export { testRouter };
Include it in the root Router. (No other middlewares are used so far)
const app = new Hono()
.route("/test", testRouter);
export const routes = route;
Then use the hono/client within the server project and on the client side to test the outcome.
What is the expected behavior?
When I use the hono/client in my server project it infers the inputs just fine:
What do you see instead?
But when I use the exact same types etc. it does not infer the args correctly.
Additional information
When I use the default validator function provided by Hono it works just fine. But even when I wrap that function to create my own kind of zValidator it breaks and has the same behavior as mentioned before.
My .tsconfigs are setup properly and all the routes and stuff gets inferred as expected.
I appreciate any help.
@puerschel93
I can't reproduce it. Can you share a minimal project to reproduce it?
I too am seeing something like this:
Oddly downstream the types aren't complaining, but there's no defined types coming off of the scoreData
I'm on Deno 2.4.4 currently.
-
jsr:@hono/hono@^4.6.14 -
jsr:@zod/zod@^4.1.4 -
jsr:@hono/zod-validator@^0.7.2
@ctsstc
I can't reproduce it with only your information. Please provide a minimal project to reproduce it.
Here's a reproduction:
VSCode Version Info
Version: 1.104.0 (Universal)
Commit: f220831ea2d946c0dcb0f3eaa480eb435a2c1260
Date: 2025-09-10T06:46:18.035Z (1 day ago)
Electron: 37.3.1
ElectronBuildId: 12342881
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Darwin arm64 24.6.0
Deno Version 2.4.4
I just updated to Deno 2.5.0 and it seems to have solve the problem. Now rolling back to 2.4.4 it seems like it's still solved 🤯 I'm losing my mind... I just matched dependencies of my other project and it's still fine...
I'm now wondering if it's related to updating VSCode... My other project is working just fine now too 😱
Or it has me wondering if VSCode just needed a hard restart? 🤷