mini-effect
    Preparing search index...

    Function all

    • Runs all effects in parallel and resolves with a tuple of their results (fail-fast).

      Type Parameters

      • const E extends Effect<any, any, any, any>[]

        A tuple of Effect types

      Parameters

      • values: E

        An array of effects to run in parallel

      Returns Effect<
          { [K in string
          | number
          | symbol]: inferReturn<E[K<K>]> },
          inferError<E[number]>,
          inferDependency<E[number]>,
          inferProvides<E[number]>,
      >

      An Effect that resolves with a tuple of all success values

      Behaves like Promise.all — all effects start concurrently and the returned effect resolves with a tuple preserving the order of the input array. If any effect fails, the remaining effects are aborted via a local AbortController and the first error propagates immediately.

      Cancelling the parent signal aborts all running effects.

      import { succeed, run } from "mini-effect";
      import { all } from "mini-effect/concurrency";

      const [a, b, c] = await run(all([succeed(1), succeed(2), succeed(3)]));
      // a = 1, b = 2, c = 3