import type { Result } from "./result.js"; import type { Operation, Yielded } from "./types.js"; /** * Block and wait for all of the given operations to settle. Returns * an array of results indicating whether each operation succeeded or * errored. This has the same purpose as * [Promise.allSettled](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled). * * Unlike {@link all}, `allSettled` never rejects — every operation * result is represented as either `{ ok: true, value }` or * `{ ok: false, error }`. * * ### Example * * ``` javascript * import { allSettled, main, until } from 'effection'; * * await main(function*() { * let [google, notASite] = yield* allSettled([ * until(fetch('http://google.com')), * until(fetch('http://nope.example')), * ]); * // google => { ok: true, value: Response } * // notASite => { ok: false, error: Error } * }); * ``` * * @param ops a list of operations to wait for * @returns the list of settled results, in the order they were given * @since 4.1 */ export declare function allSettled[] | []>(ops: T): Operation>; /** * This type allows you to infer heterogenous operation types. * e.g. `allSettled([sleep(0), until(fetch("https://google.com"))])` * will have a type of `Operation<[Result, Result]>` */ type AllSettled[] | []> = { -readonly [P in keyof T]: Result>; }; export {};