Task
Task<
A> = (signal?) =>Deferred<A>
Defined in: Core/Task.ts:46
A lazy async computation that always resolves.
Two guarantees:
- Lazy — nothing starts until you call it.
- Infallible — it never rejects. If failure is possible, encode it in the
return type using
TaskResult<E, A>instead.
An optional AbortSignal can be passed at the call site. Combinators like
retry, pollUntil, and timeout thread it automatically to every inner
operation. Existing tasks that ignore the signal continue to work unchanged.
Calling a Task returns a Deferred<A> — a one-shot async value that supports
await but has no .catch(), .finally(), or chainable .then().
Consuming a Task:
Use await task() to run it and get the value directly:
When you need an explicit Promise<A> (e.g. for a third-party API), convert
the Deferred with Deferred.toPromise:
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”signal?
Section titled “signal?”AbortSignal
Returns
Section titled “Returns”Deferred<A>