Skip to content

step ​

The step() function records a named step in a flow. When includeDetails is enabled in F.run(), the collected step names are returned alongside the final result.

Interactive example ​

Syntax ​

typescript
function step<
	GenericName extends string,
	GenericOutput extends unknown = void
>(
	name: GenericName,
	theFunction?: () => GenericOutput
): Generator | AsyncGenerator

Parameters ​

  • name: Step label stored in the execution details.
  • theFunction: Optional callback executed after the step is emitted. Its result becomes the return value of step().

Return value ​

A generator yielding a step effect. It returns undefined when no callback is provided, otherwise returns the callback result.

See also ​

  • run - Collects step names when includeDetails is enabled
  • exec - Forwards step effects from nested flows

Released under the MIT license.