import type { AnyRouter, inferProcedureInput, inferProcedureOutput, inferSubscriptionOutput, } from '@trpc/server'; import { Unsubscribable } from '@trpc/server/observable'; import { inferTransformedProcedureOutput } from '@trpc/server/shared'; import { TRPCClientError } from './TRPCClientError'; import { CreateTRPCClientOptions, TRPCRequestOptions, TRPCSubscriptionObserver, TRPCUntypedClient, } from './internals/TRPCUntypedClient'; import { TRPCClientRuntime } from './links'; /** * @deprecated */ export interface TRPCClient { readonly runtime: TRPCClientRuntime; query< TQueries extends TRouter['_def']['queries'], TPath extends string & keyof TQueries, TInput extends inferProcedureInput, >( path: TPath, input?: TInput, opts?: TRPCRequestOptions, ): Promise>; mutation< TMutations extends TRouter['_def']['mutations'], TPath extends string & keyof TMutations, TInput extends inferProcedureInput, >( path: TPath, input?: TInput, opts?: TRPCRequestOptions, ): Promise>; subscription< TSubscriptions extends TRouter['_def']['subscriptions'], TPath extends string & keyof TSubscriptions, // TODO - this should probably be updated to use inferTransformedProcedureOutput but this is only hit for legacy clients TOutput extends inferSubscriptionOutput, TInput extends inferProcedureInput, >( path: TPath, input: TInput, opts: TRPCRequestOptions & Partial>>, ): Unsubscribable; } /** * @deprecated use `createTRPCProxyClient` instead */ export function createTRPCClient( opts: CreateTRPCClientOptions, ) { const client = new TRPCUntypedClient(opts); return client as TRPCClient; }