Function resolveObject

  • Resolve all of the fields of an object in parallel

    Returns

    The same object with every field resolved

    Example

    await resolveObject({
    a: Promise.resolve('a'),
    b: Promise.resolve('b'),
    }) === { a: 'a', b: 'b' }

    Example

    await resolveObject({
    a: Promise.resolve('a'),
    b: Promise.reject('b'),
    }) // throws error

    See

    settleObject if you don't want to fail if some promises reject

    Type Parameters

    • T extends Record<PropertyKey, Promise<any>>

    Parameters

    • object: T

      An object where every field is a promise

    Returns Promise<Resolved<T>>

Generated using TypeDoc