method TaskClass.results
Private
TaskClass.results<T, E = AnyFailure>(tasks: Iterable<TaskClass<T, E> | PromiseLike<T>>): TaskClass<Result<T, E>[], never>

Awaits every task and returns their outcomes positionally — index-preserving, so a batch knows which input failed, and no success is discarded (unlike Promise.all's fail-fast). The errors are the declared E; a bug in any task rejects the whole call, matching TaskClass#result's two-tier rule. (Named results, not allSettled, which is the inherited static with the spec's { status, … } shape.)

import { partition } from '../result/result.ts';
import type { Any as LoadFailure } from '../result/failure.ts';
const paths = ['a.json', 'b.json'];
const load = (path: string) => Task<object, LoadFailure>(() => ({ path }));

const outcomes = await Task.results(paths.map(load)); // (object | LoadFailure)[] — bare unions
const { values, errors } = partition(outcomes); // nothing lost, everything typed

Type Parameters

E = AnyFailure

Parameters

tasks: Iterable<TaskClass<T, E> | PromiseLike<T>>

Return Type

TaskClass<Result<T, E>[], never>

Usage

import { TaskClass } from "lib/task/task.ts";