UNPKG

@trpc/next

Version:

The tRPC Next.js library

58 lines • 2.63 kB
import { a as WithTRPCSSROptions, i as WithTRPCNoSSROptions, n as TRPCPrepassProps, o as withTRPC, r as WithTRPCConfig, t as TRPCPrepassHelper } from "./withTRPC-BzqvaIkK.mjs"; import { CreateReactUtils, DecorateRouterRecord, TRPCUseQueries, TRPCUseSuspenseQueries } from "@trpc/react-query/shared"; import { AnyRouter, ProtectedIntersection } from "@trpc/server/unstable-core-do-not-import"; import { NextPageContext } from "next/types.js"; //#region src/createTRPCNext.d.ts /** * @internal */ export interface CreateTRPCNextBase<TRouter extends AnyRouter, TSSRContext extends NextPageContext> { /** * @deprecated renamed to `useUtils` and will be removed in a future tRPC version * * @see https://trpc.io/docs/client/react/useUtils */ useContext(): CreateReactUtils<TRouter, TSSRContext>; /** * @see https://trpc.io/docs/client/react/useUtils */ useUtils(): CreateReactUtils<TRouter, TSSRContext>; /** * Wraps your `_app` with the tRPC providers. * @see https://trpc.io/docs/client/nextjs/pages-router/setup#moving-from-createtrpcnext */ withTRPC: ReturnType<typeof withTRPC<TRouter, TSSRContext>>; /** * @see https://trpc.io/docs/client/react/useQueries */ useQueries: TRPCUseQueries<TRouter>; /** * @see https://trpc.io/docs/client/react/suspense#usesuspensequeries */ useSuspenseQueries: TRPCUseSuspenseQueries<TRouter>; } /** * @internal * @deprecated part of `createTRPCNext`, which is built on `@trpc/react-query`. */ export type CreateTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext> = ProtectedIntersection<CreateTRPCNextBase<TRouter, TSSRContext>, DecorateRouterRecord<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>>; /** * Creates typed React hooks and a `withTRPC` wrapper for a Next.js Pages Router app. * * @example * ```ts * export const trpc = createTRPCNext<AppRouter>({ * config() { * return { links: [httpBatchLink({ url: '/api/trpc' })] }; * }, * }); * ``` * * @deprecated built on `@trpc/react-query`, which only gets bug fixes. Use * `createTRPCContext` from `@trpc/tanstack-react-query` instead. * @see https://trpc.io/docs/client/nextjs/pages-router/setup#moving-from-createtrpcnext */ export declare function createTRPCNext<TRouter extends AnyRouter, TSSRContext extends NextPageContext = NextPageContext>(opts: WithTRPCNoSSROptions<TRouter> | WithTRPCSSROptions<TRouter>): CreateTRPCNext<TRouter, TSSRContext>; //#endregion export { TRPCPrepassHelper, TRPCPrepassProps, WithTRPCConfig, WithTRPCNoSSROptions, WithTRPCSSROptions, withTRPC }; //# sourceMappingURL=index.d.mts.map