Running TSC on tRPC client runs type checking on tRPC server

I have a pnpm monorepo with a Vite client and a tRPC backend (sst lambda although the specifics shouldn’t matter). Whenever I run tsc to type check the client, it follows the import to the router and proceeds to apply all of the client package’s rules to the server package. Is this a known/common issue? I realise it’s not directly a tRPC problem but it seems like something other people should have run into.
2 Replies
Chen
ChenOP12mo ago
See this repo for an example of the issue I'm having: https://github.com/bchilcott/trpc-ts-problem
GitHub
GitHub - bchilcott/trpc-ts-problem
Contribute to bchilcott/trpc-ts-problem development by creating an account on GitHub.
MadMax
MadMax12mo ago
@Scythern you should create separate files for handler and router and router file should only export types nothing else like
const appRouter = router()
export type AppRouter = typeof appRouter;
const appRouter = router()
export type AppRouter = typeof appRouter;
Want results from more Discord servers?
Add your server