tRPC-SvelteKit v4.0.2

End-to-end typesafe APIs for your SvelteKit applications

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/server and @trpc/client to v11 and follow the tRPC v11 migration guide.
  • createTRPCClient still accepts a transformer, and forwards it to its default link. If you pass your own links, set the transformer on them instead.
  • createTRPCClient now forwards every httpBatchLink option, such as maxURLLength or methodOverride.
  • createTRPCHandle accepts every option of tRPC's HTTP handlers. responseMeta and onError use the tRPC v11 signatures, and createContext receives the fetch adapter options as a second argument.
  • Responses are streamed, so httpBatchStreamLink and subscriptions over server-sent events work with every adapter.
  • The handle can be used in apps with prerendered pages.
  • @sveltejs/adapter-node is no longer a peer dependency, ws is only needed for WebSocket support, and trpc-sveltekit no longer depends on the cookie package.