Skip to content

Type Alias: TimeoutOptions<T, BatchFuncName> ​

TimeoutOptions<T, BatchFuncName> = object

Defined in: packages/promise/dist/index.d.ts:355

Options for PromisE.timeout()

Param ​

func

(optional) name of the supported PromiEBase static method to be used to resolve when more than one promise/function is provided. Default: "all"

Param ​

timeout

(optional) timeout duration in milliseconds. Default: 10_000 (10 seconds)

Type Parameters ​

T ​

T extends unknown[] = []

BatchFuncName ​

BatchFuncName extends string = "all"

Properties ​

abortCtrl? ​

optional abortCtrl?: AbortController

Defined in: packages/promise/dist/index.d.ts:363

An AbortController instance.

If provided:

  • It will be aborted automatically when the timeout occurs.
  • If it is aborted externally, the promise will be rejected and the timeout will be cleared.

abortOnEarlyFinalize? ​

optional abortOnEarlyFinalize?: boolean

Defined in: packages/promise/dist/index.d.ts:370

Whether to call abortCtrl.abort() if the promise is finalized externally (resolved or rejected before timeout or abort).

Default: true


batchFunc? ​

optional batchFunc?: T["length"] extends 0 ? never : T["length"] extends 1 ? never : BatchFuncName

Defined in: packages/promise/dist/index.d.ts:376

The name of the PromisEBase static method to use for resolving multiple promises/functions.

Only applicable when more than one promise/function is provided.


onAbort? ​

optional onAbort?: () => ValueOrPromise<void | Error>

Defined in: packages/promise/dist/index.d.ts:382

Callback invoked when the promise is rejected due to an abort signal.

Can be used to transform the abort error by returning a custom Error object.

Returns ​

ValueOrPromise<void | Error>


onTimeout? ​

optional onTimeout?: () => ValueOrPromise<void | Error>

Defined in: packages/promise/dist/index.d.ts:388

Callback invoked when the promise times out.

Can be used to transform the timeout error by returning a custom Error object.

Returns ​

ValueOrPromise<void | Error>


signal? ​

optional signal?: AbortSignal

Defined in: packages/promise/dist/index.d.ts:397

An AbortSignal to listen to.

If aborted:

  • The promise will be rejected.
  • The abortCtrl (if provided and distinct) will be aborted.
  • The timeout will be cleared.

timeout? ​

optional timeout?: number

Defined in: packages/promise/dist/index.d.ts:399

Timeout duration in milliseconds.