Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

5.2.0

7 Dec 2023Where it was published

5.33.4 is the newest release of 5.x.

In short

1 new2 fixed

Release note

Minor Changes

  • Introduce toPromise(actor), which creates a promise from an actor that resolves with the actor snapshot's output when done, or rejects with the actor snapshot's error when it fails.

    import { createMachine, createActor, toPromise } from 'xstate';
    
    const machine = createMachine({
      // ...
      states: {
        // ...
        done: { type: 'final', output: 42 }
      }
    });
    
    const actor = createActor(machine);
    
    actor.start();
    
    const output = await toPromise(actor);
    
    console.log(output);
    // => 42

Patch Changes

  • Fixed an issue with spawn within assign not returning a narrowed down ActorRef type on TypeScrip 5.0

  • Fixed an issue that caused a complete listener to be called instead of the error one when the actor was subscribed after being stopped.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.