🚨 Announcement: A New Chapter for Vendure read more



Package: @vendure/core File: types.ts

A type which is used to define valid states and transitions for a state machine based on FSM.


type LightColor = 'Green' | 'Amber' | 'Red';

const trafficLightTransitions: Transitions<LightColor> = {
  Green: {
    to: ['Amber'],
  Amber: {
    to: ['Red'],
  Red: {
    to: ['Green'],

The mergeStrategy property defines how to handle the merging of states when one set of transitions is being merged with another (as in the case of defining a {@link CustomerOrderProcess})


type Transitions<State extends string, Target extends string = State> = {
    [S in State]: {
        to: Readonly<Target[]>;
        mergeStrategy?: 'merge' | 'replace';