Psi
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
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
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