Skip to content

xstate@4.25.0

Choose a tag to compare

@github-actions github-actions released this 16 Sep 12:53
· 3574 commits to next since this release
e32d240

Minor Changes

  • #2657 72155c1b7 Thanks @mattpocock! - Removed the ability to pass a model as a generic to createMachine, in favour of model.createMachine. This lets us cut an overload from the definition of createMachine, meaning errors become more targeted and less cryptic.

    This means that this approach is no longer supported:

    const model = createModel({});
    
    const machine = createMachine<typeof model>();

    If you're using this approach, you should use model.createMachine instead:

    const model = createModel({});
    
    const machine = model.createMachine();

Patch Changes

  • #2659 7bfeb930d Thanks @Andarist! - Fixed a regression in the inline actions type inference in models without explicit action creators.

    const model = createModel(
      { foo: 100 },
      {
        events: {
          BAR: () => ({})
        }
      }
    );
    
    model.createMachine({
      // `ctx` was of type `any`
      entry: ctx => {},
      exit: assign({
        // `ctx` was of type `unknown`
        foo: ctx => 42
      })
    });