method Task.of
Task.of<
R,
E,
>
(task: (signal?: AbortSignal) => Promisable<R>): Task<R, E>

Creates a Task from a sync or async function. The function receives an optional AbortSignal that is active when the task is run with a signal via withSignal or run.

Note: the error type E is unchecked and represents the expected error shape rather than a runtime guarantee.

Type Parameters

Parameters

task: (signal?: AbortSignal) => Promisable<R>

Return Type

Task<R, E>

Usage

import { Task } from ".";