theLMGN
theLMGNā€¢3w ago

Prevent client tsc from typechecking the server

Hello, I'm trying to use trpc as documented here, but as soon as I put import type { AppRouter } from "../../src/index.ts"; the tsc for the browser client tries to check the node server and throws errors like
Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
Cannot find module '@trpc/server/dist/adapters/standalone.js' or its corresponding type declarations.
Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
Cannot find module '@trpc/server/dist/adapters/standalone.js' or its corresponding type declarations.
2 Replies
NeoBean
NeoBeanā€¢3w ago
imagine tsc bundled all server code with polyfills and shims included šŸ¦„
theLMGN
theLMGNOPā€¢3w ago
ive actually had the bundler do that by accident once šŸ˜…

Did you find this page helpful?