AsyncClient

type AsyncClient<TSelf> = Promise<Client<TSelf>> & object;

An asynchronous wrapper that represents a promise of a client.

The AsyncClient type is returned when an async plugin is applied to a client. It behaves like a Promise<Client<TSelf>> but with an additional use method that allows chaining more plugins before the promise resolves.

This enables fluent chaining of both synchronous and asynchronous plugins without having to await intermediate promises.

Type Declaration

NameTypeDescription
use()<TOutput>(plugin) => AsyncClient<TOutput extends Promise<infer U> ? U extends object ? U : never : TOutput>Applies a plugin to the client once it resolves.

Type Parameters

Type ParameterDescription
TSelf extends objectThe shape of the client object that this async client will resolve to.

On this page