`args?` is blank despite using zValidator
Set up details
Using Deno (2.4.2, the latest version)
And all the other packages are also up-to-date (Hono 4.8.5, zod-validator 0.7.1, Zod 4.0.5)
I'm getting the packages from NPM, not JSR
Issue
Hono client infers the route as
$post: (args?: {}, options?: ClientRequestOptions)
. Notice the blank args?
. This is not expected behavior
Expected behavior is args: { json: { name: string } }
Server Code:
Client code
8 Replies
Please ping me when you respond
This works fine for me?
main.ts
:
client.ts
With args as {}
:
Above time (05:23 AWST) in your local time
deno check
passes for me
Intellisense isn't recognizing anything

Initially, I thought this was the LSP acting up, so I restarted VSCode and I even restarted by computer but it still thinks everything is fine and doesn't infer the type of
args
properlyThe intellisense screenshot you show has completely different types - is this intentional?
Check the intellisense definition for AppType in both main.ts and client.ts to check if they match, or else something buggy is going on (with ts)
The differing
ClientResponse<>
type is intentional
I moved parts of the full implementation and just gave you the basic code needed to reproduce the issue, but I used the full implementation in the screenshot
Here is the AppType in main.ts
of the basic implementation
Here is the client type of the basic implementation
The basic implementation has but TypeScript doesn't recognize that and makes args
a blank object
Weirdly, this issue doesn't happen in another Deno project. Only this Deno project
Did I mess something up in my deno.json
or tsconfig.json
?
I removed all the tsconfig.json
files in my project and restarted VSCode (closed all windows and reopened them) and the issue with args
is still happening
Fixed
It was Deno acting up
Solution
Delete all deno.lock
Run deno cache --reload
on all the important files. The full command I ran was deno cache --reload client.ts main.ts
Ta-da! Things are fixed
Thanks @blair