import type { DistributiveOmit } from '@orpc/shared' /** * The base shape of a context. * * @see {@link https://orpc.dev/docs/context | Context} */ export interface Context { [key: PropertyKey]: any } export type MergedInitialContext< TInitial extends Context, TOutContext extends Context, TInContext extends Context, > = 0 extends 1 & TInContext ? TInitial : TInContext extends any ? Exclude extends never ? TInitial : { [key: PropertyKey]: unknown } extends Required< DistributiveOmit > ? TInitial : TInitial & DistributiveOmit : never export type MergedContext = 0 extends 1 & TOutContext ? TCurrent : TOutContext extends any ? keyof TOutContext extends never ? TCurrent : DistributiveOmit & TOutContext : never