import { QueryClient } from "@tanstack/react-query"; import { TransformerOptions } from "@trpc/client/unstable-internals"; import { CreateTRPCReactOptions, CreateTRPCReactQueryClientConfig } from "@trpc/react-query/shared"; import { AnyRouter, ResponseMeta, inferClientTypes } from "@trpc/server/unstable-core-do-not-import"; import { CreateTRPCClientOptions, TRPCClient, TRPCClientError, TRPCUntypedClient } from "@trpc/client"; import { NextComponentType, NextPageContext } from "next/dist/shared/lib/utils"; //#region src/withTRPC.d.ts type WithTRPCConfig = CreateTRPCClientOptions & CreateTRPCReactQueryClientConfig & { abortOnUnmount?: boolean; }; type WithTRPCOptions = CreateTRPCReactOptions & { config: (info: { ctx?: NextPageContext; }) => WithTRPCConfig; } & TransformerOptions>; type TRPCPrepassHelper = (opts: { parent: WithTRPCSSROptions; WithTRPC: NextComponentType; AppOrPage: NextComponentType; }) => void; type WithTRPCSSROptions = WithTRPCOptions & { /** * If you enable this, you also need to add a `ssrPrepass`-prop * @see https://trpc.io/docs/client/nextjs/ssr */ ssr: true | ((opts: { ctx: NextPageContext; }) => boolean | Promise); responseMeta?: (opts: { ctx: NextPageContext; clientErrors: TRPCClientError[]; }) => ResponseMeta; /** * use `import { ssrPrepass } from '@trpc/next/ssrPrepass'` * @see https://trpc.io/docs/client/nextjs/ssr */ ssrPrepass: TRPCPrepassHelper; }; type WithTRPCNoSSROptions = WithTRPCOptions & { ssr?: false; }; type TRPCPrepassProps = { config: WithTRPCConfig; queryClient: QueryClient; trpcClient: TRPCUntypedClient | TRPCClient; ssrState: 'prepass'; ssrContext: TSSRContext; }; declare function withTRPC(opts: WithTRPCNoSSROptions | WithTRPCSSROptions): (AppOrPage: NextComponentType) => NextComponentType; //#endregion export { WithTRPCSSROptions as a, WithTRPCNoSSROptions as i, TRPCPrepassProps as n, withTRPC as o, WithTRPCConfig as r, TRPCPrepassHelper as t }; //# sourceMappingURL=withTRPC-BchtyodQ.d.mts.map