Skip to content

Function: step()

ts
function step<Args, ReturnType>(fn: (...args: Args) => ReturnType, args: Args): Promise<ReturnType>;

Defined in: src/hot-reload/core/step.ts:80

Run a function as a replayable step with hot-reload support. Skip execution and return the saved result when the function has not changed.

Type Parameters

Type Parameter
Args extends unknown[]
ReturnType

Parameters

ParameterTypeDescription
fn(...args: Args) => ReturnTypeThe function to run.
argsArgsThe arguments to pass to the function.

Returns

Promise<ReturnType>

The result of the function execution.

Example

ts
const greeting = await step(welcomeMessage, [ctx, 'Hello']);
await step(processOrder, [ctx, greeting]);

Matterway Assistant SDK Documentation