Psi
Psi
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
https://canitrundoom.org/ πŸ˜„πŸ₯ΈπŸ€“
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
I dont understand this. This means 'foo/:id' generic makes things faster?
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Afair had @Aditya Mathur a good article about that but did not bookmark it and could not find it anymore 😭
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Can you throw a link around or a little example?
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Afaik can I not set the type on route handler to circumvent the hono magic
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
tbh, first I liked the way hono handles the types but meantime I changed my mind. defining them explicitly whould make thing much more easy and clear
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
I let AI generate 1000 endpoints each with get/post/put/delete. No problems so far cause it results in (a very large) client.d.ts BUT thy only magic here is the ClientRequest type which is not so hard complicated.
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Thy can be completly solved be pre-compiling the type and consume ".d.ts" file afaik
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Than test your autocomplete here!!
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
You do usually not need your own client in the backend dont u? πŸ˜„
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
autocomplete in "backend/client.ts" is ALWAYS slow. so it is for the backend in general BUT not in frontend
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
And I dont see type path definitions in your package.json
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
There is trpc stuff in your repo?
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Yes it's because you don't compile your types. I will get to it later
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Sry for missing backticks, I'm on the phone right now
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
So in ui package.json we reference the NAME of backend module (name prop of /backend/package.json) which helps ide and bundler to pick up the generated type The typescript project references is only for (re)build if you change backend stuff without explicitly build it In vite config We must use checker({ typescript: { buildMode: true, },
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
/package.json "workspaces": [ "backend", "web-ui" ], /backend/package.json "type": "module", "main": "dist/src/client.js", "typings": "dist/src/client.d.ts", /backend/tsconfig.json composite true /ui/package.json "backend": "workspace:*", /ui/tsconfig.json "references": [ { "path": "../backend" }
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Nutshell, monorepo with workspaces, hono app package json has types property which points to client.d.ts
114 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Pls ping me tomorrow, I share what I've came up with
114 replies