# WorkflowStep

Source: /tuil/docs/reference/packages/workflow/api/workflow-step
Locale: en

interface exported by @mwillbanks/tuil-workflow.



{/* Generated by tooling/docs/generate-reference.ts. */}

## interface [#interface]

Public interface exported by `@mwillbanks/tuil-workflow`.

```ts
export interface WorkflowStep<TState> {
  readonly id?: string;
  readonly title?: string;
  readonly component?: unknown;
  readonly help?: string;
  readonly when?: (
    context: WorkflowContext<TState>,
  ) => boolean | Promise<boolean>;
  readonly validate?: (
    context: WorkflowContext<TState>,
  ) =>
    | string
    | readonly string[]
    | undefined
    | Promise<string | readonly string[] | undefined>;
  readonly enter?: (context: WorkflowContext<TState>) => void | Promise<void>;
  readonly leave?: (context: WorkflowContext<TState>) => void | Promise<void>;
  readonly compensate?: (
    context: WorkflowContext<TState>,
  ) => void | Promise<void>;
  readonly timeout?: number;
  readonly commands?: readonly string[];
  readonly operations?: readonly OperationDefinition[];
  readonly nested?: WorkflowDefinition<unknown>;
  readonly parallel?: readonly (
    | ((context: WorkflowContext<TState>) => unknown | Promise<unknown>)
    | WorkflowParallelBranch<TState>
  )[];
}
```

## Members [#members]

| Member       | Type                                                                                                                                                 | Required | Description                                                                                                                                                                                   | Related types                                                                                                                                                           |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`         | `string \| undefined`                                                                                                                                | No       | The `id` member uses the `string \| undefined` contract.                                                                                                                                      | —                                                                                                                                                                       |
| `title`      | `string \| undefined`                                                                                                                                | No       | The `title` member uses the `string \| undefined` contract.                                                                                                                                   | —                                                                                                                                                                       |
| `component`  | `unknown`                                                                                                                                            | No       | The `component` member uses the `unknown` contract.                                                                                                                                           | —                                                                                                                                                                       |
| `help`       | `string \| undefined`                                                                                                                                | No       | The `help` member uses the `string \| undefined` contract.                                                                                                                                    | —                                                                                                                                                                       |
| `when`       | `((context: WorkflowContext<TState>) => boolean \| Promise<boolean>) \| undefined`                                                                   | No       | The `when` member uses the `((context: WorkflowContext<TState>) => boolean \| Promise<boolean>) \| undefined` contract.                                                                       | [`WorkflowContext`](/tuil/docs/reference/packages/workflow/api/workflow-context)                                                                                             |
| `validate`   | `((context: WorkflowContext<TState>) => string \| readonly string[] \| undefined \| Promise<string \| readonly string[] \| undefined>) \| undefined` | No       | The `validate` member uses the `((context: WorkflowContext<TState>) => string \| readonly string[] \| undefined \| Promise<string \| readonly string[] \| undefined>) \| undefined` contract. | [`WorkflowContext`](/tuil/docs/reference/packages/workflow/api/workflow-context)                                                                                             |
| `enter`      | `((context: WorkflowContext<TState>) => void \| Promise<void>) \| undefined`                                                                         | No       | The `enter` member uses the `((context: WorkflowContext<TState>) => void \| Promise<void>) \| undefined` contract.                                                                            | [`WorkflowContext`](/tuil/docs/reference/packages/workflow/api/workflow-context)                                                                                             |
| `leave`      | `((context: WorkflowContext<TState>) => void \| Promise<void>) \| undefined`                                                                         | No       | The `leave` member uses the `((context: WorkflowContext<TState>) => void \| Promise<void>) \| undefined` contract.                                                                            | [`WorkflowContext`](/tuil/docs/reference/packages/workflow/api/workflow-context)                                                                                             |
| `compensate` | `((context: WorkflowContext<TState>) => void \| Promise<void>) \| undefined`                                                                         | No       | The `compensate` member uses the `((context: WorkflowContext<TState>) => void \| Promise<void>) \| undefined` contract.                                                                       | [`WorkflowContext`](/tuil/docs/reference/packages/workflow/api/workflow-context)                                                                                             |
| `timeout`    | `number \| undefined`                                                                                                                                | No       | The `timeout` member uses the `number \| undefined` contract.                                                                                                                                 | —                                                                                                                                                                       |
| `commands`   | `readonly string[] \| undefined`                                                                                                                     | No       | The `commands` member uses the `readonly string[] \| undefined` contract.                                                                                                                     | —                                                                                                                                                                       |
| `operations` | `readonly OperationDefinition<unknown>[] \| undefined`                                                                                               | No       | The `operations` member uses the `readonly OperationDefinition<unknown>[] \| undefined` contract.                                                                                             | [`OperationDefinition`](/tuil/docs/reference/packages/operations/api/operation-definition)                                                                                   |
| `nested`     | `WorkflowDefinition<unknown> \| undefined`                                                                                                           | No       | The `nested` member uses the `WorkflowDefinition<unknown> \| undefined` contract.                                                                                                             | [`WorkflowDefinition`](/tuil/docs/reference/packages/workflow/api/workflow-definition)                                                                                       |
| `parallel`   | `readonly (((context: WorkflowContext<TState>) => unknown \| Promise<unknown>) \| WorkflowParallelBranch<TState>)[] \| undefined`                    | No       | The `parallel` member uses the `readonly (((context: WorkflowContext<TState>) => unknown \| Promise<unknown>) \| WorkflowParallelBranch<TState>)[] \| undefined` contract.                    | [`WorkflowContext`](/tuil/docs/reference/packages/workflow/api/workflow-context), [`WorkflowParallelBranch`](/tuil/docs/reference/packages/workflow/api/workflow-parallel-branch) |

## Parameters [#parameters]

This declaration has no public members.

## Returns [#returns]

This declaration does not return a value.

## Throws [#throws]

No thrown errors are documented for this declaration.

## Related types [#related-types]

* [`WorkflowContext`](/tuil/docs/reference/packages/workflow/api/workflow-context)
* [`WorkflowDefinition`](/tuil/docs/reference/packages/workflow/api/workflow-definition)
* [`WorkflowParallelBranch`](/tuil/docs/reference/packages/workflow/api/workflow-parallel-branch)

## Source [#source]

[View the secondary source reference](https://github.com/mwillbanks/tuil/blob/main/packages/workflow/src/index.ts)

## Package [#package]

[@mwillbanks/tuil-workflow](/tuil/docs/reference/packages/workflow)
