mattpocock / xstate-codegen

A codegen tool for 100% TS type-safety in XState
MIT License
245 stars 12 forks source link

`actions:` must be an array #87

Open johnnydecimal opened 3 years ago

johnnydecimal commented 3 years ago

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!');
  ]
}