API · Lifecycle

abort()

Cancel a branch and connected work with an explicit reason.

Signature

abort(reason?: unknown): void

Parameters

reason

Type unknownDefault generated AbortError

Stored as abortReason, exposed through the branch signal, and propagated to connected consumers.

Behavior

Abort cancels signal, notifies downstream branches and observers, discards buffers, emits abort(reason) and end, and transitions to aborted. If this was the only reliable branch, the same reason propagates upstream; sibling forks isolate the shared source.

Cancellation is idempotent and the first reason wins. Errors with provenance support are annotated as lifecycle/abort. Terminal consumers reject when the abort reaches them. User asynchronous work must observe the supplied signal to stop promptly.

destroy(), fail(), toAsyncIterator(), fork()