Deferred
Deferred<
A> =object
Defined in: Core/Deferred.ts:22
A nominally typed, one-shot async value that supports await but enforces infallibility.
Two design choices work together to make the guarantee structural rather than documentary:
- The phantom
[_deferred]symbol makes the type nominal: only values produced byDeferred.fromPromisesatisfy it. A plain object{ then: ... }does not. - The single-parameter
.then()excludes rejection handlers by construction. There is no second argument to pass, so chaining and.catch()are impossible.
This makes Deferred<A> the natural return type for Task<A>, which is guaranteed to
never reject.
Example
Section titled “Example”Type Parameters
Section titled “Type Parameters”A
Properties
Section titled “Properties”[_deferred]
Section titled “[_deferred]”
readonly[_deferred]:A
Defined in: Core/Deferred.ts:23
then()
Section titled “then()”
readonlythen: (onfulfilled) =>void
Defined in: Core/Deferred.ts:24
Parameters
Section titled “Parameters”onfulfilled
Section titled “onfulfilled”(value) => void
Returns
Section titled “Returns”void