# WorkflowTransition

Source: /tuil/docs/reference/packages/workflow/api/workflow-transition
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 WorkflowTransition<TState> {
  readonly from: string;
  readonly to: string;
  readonly when?: (
    context: WorkflowContext<TState>,
  ) => boolean | Promise<boolean>;
}
```

## Members [#members]

| Member | Type                                                                               | Required | Description                                                                                                             | Related types                                                               |
| ------ | ---------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| `from` | `string`                                                                           | Yes      | The `from` member uses the `string` contract.                                                                           | —                                                                           |
| `to`   | `string`                                                                           | Yes      | The `to` member uses the `string` 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) |

## 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)

## 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)
