-
-
Notifications
You must be signed in to change notification settings - Fork 888
Description
What version of Hono are you using?
4.7.8
What runtime/platform is your app running on? (with version if possible)
Deno
What steps can reproduce the bug?
I'm trying to use Hono's RPC feature in my monorepo but the client is not inferring some types correctly and I can't figure out why. It's a similar issue to #3485 but the solutions are not working for me. My project structure is:
- frontend/
- backend/
- apps/public-api
- packages/
- db/
- services/
In the backend I have a tsconfig.json with "composite": true. And a route like so;
const app = new Hono().basePath('/api')
const routes = app
.get('/dashboard', async (c) => {
const data = await dashboard.fetchDashboardData() // this lives in backend/services package
return c.json({ data: "test", dash: {xx:"xx"}, dashboard: data })
})
export type AppType = typeof routes
And intellisense gives me the correct types as expected:
But in the client project, the dashboard property is inferred as [x: string]: any;
The client project has the correct tsconfig.json and references the public-api;
"references": [
{
"path": "../backend/apps/public-api"
}
],
I suspect it's because dashboard types live in backend/services, not backend/apps/public-api. I've tried making services composite and adding to my client references, but that didn't help.
Any ideas?
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response

