• Creates a new Promise and returns it in an object, along with its resolve and reject functions.

    Type Parameters

    • T

    Returns PromiseWithResolvers<T>

    An object with the properties promise, resolve, and reject.

    const { promise, resolve, reject } = Promise.withResolvers<T>();