Difficulty with understanding Hono RPC. #3123
|
Hello @yusukebe , can you guide me on using the Hono RPC, For some reason, I am not able to get type inference on the client. For some reason when I export the types of the expenses app directly, the type inference is working when using hono rpc on the client Client Can you tell me why this is happening. |
Replies: 1 comment 6 replies
|
Short answer: Longer answer: Typescript sets the type when you create a variable. Therefore when you define expensesRoute, i.e. However at the moment you define The following part of the documentation also adreses this: https://hono.dev/docs/guides/rpc#using-rpc-with-larger-applications. |

It's actually way simpler, hc is super dumb and it's implementation doesn't know or code anything about the API (it's al just typings). So what it does when you do client.some.path.to.your.endpoint.$get() simplified: