import superjson from "superjson"; import { createReactQueryHooks } from "@trpc/react"; // ℹ️ Type-only import: // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export import type { inferProcedureInput, inferProcedureOutput } from "../server"; import type { AppRouter } from "../server/routers/_app"; /** * A set of strongly-typed React hooks from your `AppRouter` type signature with `createReactQueryHooks`. * @link https://trpc.io/docs/react#3-create-trpc-hooks */ export const trpc = createReactQueryHooks(); export const proxy = trpc.proxy; export const transformer = superjson; /** * This is a helper method to infer the output of a query resolver * @example type HelloOutput = inferQueryOutput<'hello'> */ export type inferQueryOutput = inferProcedureOutput< AppRouter["_def"]["queries"][TRouteKey] >; export type inferQueryInput = inferProcedureInput< AppRouter["_def"]["queries"][TRouteKey] >; export type inferMutationInput = inferProcedureInput< AppRouter["_def"]["mutations"][TRouteKey] >; export type inferMutationOutput = inferProcedureOutput;