ExtendedClient

type ExtendedClient<TClient, TAdditions> = { [K in keyof (Omit<TClient, keyof TAdditions> & TAdditions)]: (Omit<TClient, keyof TAdditions> & TAdditions)[K] } & object;

The result of extending a client of type TClient with additional properties of type TAdditions.

Structurally equivalent to Omit<TClient, keyof TAdditions> & TAdditions — keys present on both TClient and TAdditions are replaced by the TAdditions version — but expressed as a single homomorphic mapped type so the inferred type displays as a flat object literal rather than a deeply nested chain of Omit<...> intersections. Optional (?) and readonly modifiers from both sides are preserved.

Plugin authors who write their own merging helpers can reuse this type to keep the inferred shape of their plugin's output legible in editor tooltips and error messages.

Type Parameters

Type ParameterDescription
TClient extends objectThe type of the client being extended.
TAdditions extends objectThe type of the properties being merged in.

Example

function withRpc<TClient extends object>(client: TClient, endpoint: string): ExtendedClient<TClient, { rpc: Rpc }> {
    return extendClient(client, { rpc: createSolanaRpc(endpoint) });
}

See

extendClient

On this page