"use client"; import { createTRPCContext } from "@trpc/tanstack-react-query"; import type { TRPCOptionsProxy } from "@trpc/tanstack-react-query"; import type { AnyTRPCRouter } from "@trpc/server"; // core-trpc must not depend on @repo/core-api (core → core-composition is an // illegal boundary edge and creates a package cycle through the features). // The runtime context is router-agnostic; consumers inject their router type // as a generic: features pass their app-slice type (e.g. `BlogAppSlice`), // apps may pass the full AppRouter. const context = createTRPCContext(); export const TRPCProvider = context.TRPCProvider; export function useTRPC< TRouter extends AnyTRPCRouter = AnyTRPCRouter, >(): TRPCOptionsProxy { return context.useTRPC() as unknown as TRPCOptionsProxy; }