Kit
Functions

safeRace

safeRace<T>(contenders): Promise<Awaited<T[number]>>

An implementation of Promise.race that causes all of the losing promises to settle. This allows them to be released and garbage collected, preventing memory leaks.

Read more here: https://github.com/nodejs/node/issues/17469

Type Parameters

Type Parameter
T extends [] | readonly unknown[]

Parameters

ParameterType
contendersT

Returns

Promise<Awaited<T[number]>>

On this page