Help setting up Hono RPC types between backend and Expo client
Hey, I’m using Hono for my backend and React Native (Expo) for my client, and I’m trying to set up Hono RPC with type safety shared between the two.
Here’s my project structure:
Server (index.ts):
Client (honoClient.ts):
But when I import AppType, I get:
How should I define AppType so the client can use Hono RPC types correctly?
2 Replies
I fixed the infinite issue, but still don’t get types from the server.
The problem:
Property 'stories' does not exist on type 'unknown'.ts(2339)
honoClient setup:
AppType resolves to:
Server setup:
In short: honoClient.stories is typed as unknown, even though AppType is exported from the server.
also client tsconfig:
`
And server tsconfig:
`https://discord.com/channels/1011308539819597844/1433317799039598704
hono types get big quick. you need to import generated types instead of directly importing the result of
typeof app