xstate-codegen icon indicating copy to clipboard operation
xstate-codegen copied to clipboard

`actions:` must be an array

Open johnnydecimal opened this issue 4 years ago • 0 comments

When defining actions on a transition, if a single inline action is defined – as per the example in the XState documentation – the type definitions cause an error. Wrapping the action in an array works as expected.

// Fails
on: {
  actions: (context, event) => console.log('Fails!');
}

// Works
on: {
  actions: [
    (context, event) => console.log('Works!');
  ]
}

johnnydecimal avatar Jun 19 '21 04:06 johnnydecimal