import { createTRPCClient, httpLink, httpSubscriptionLink, loggerLink, splitLink } from "@trpc/client" import superjson from "superjson" import type { AppRouter } from "../backend" export const trpcClient = createTRPCClient({ links: [ loggerLink(), splitLink({ condition: op => op.type === "subscription", true: httpSubscriptionLink({ url: "/trpc", transformer: superjson }), false: httpLink({ url: "/trpc", transformer: superjson }), }) ] })