Upgrading to v4
trpc-sveltekit v4 targets tRPC v11 and works with SvelteKit 2 and 3. The API is mostly
unchanged, so upgrading is usually a matter of updating your dependencies:
- Upgrade
@trpc/serverand@trpc/clientto v11 and follow the tRPC v11 migration guide. createTRPCClientstill accepts atransformer, and forwards it to its default link. If you pass your ownlinks, set the transformer on them instead.createTRPCClientnow forwards everyhttpBatchLinkoption, such asmaxURLLengthormethodOverride.createTRPCHandleaccepts every option of tRPC's HTTP handlers.responseMetaandonErroruse the tRPC v11 signatures, andcreateContextreceives the fetch adapter options as a second argument.- Responses are streamed, so
httpBatchStreamLinkand subscriptions over server-sent events work with every adapter. - The handle can be used in apps with prerendered pages.
@sveltejs/adapter-nodeis no longer a peer dependency,wsis only needed for WebSocket support, andtrpc-sveltekitno longer depends on thecookiepackage.