Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

4.9.0

15 Apr 2020Where it was published

4.38.3 is the newest release of 4.x.

In short

2 new3 fixed3 changed

Release note

Minor Changes

  • Simplify the TransitionConfigArray and TransitionConfigMap types in order to fix excessively deep type instantiation TypeScript reports. This addresses #1015.

  • Added support for conditional actions. It's possible now to have actions executed based on conditions using following:

    entry: [
      choose([
        { cond: ctx => ctx > 100, actions: raise('TOGGLE') },
        {
          cond: 'hasMagicBottle',
          actions: [assign(ctx => ({ counter: ctx.counter + 1 }))]
        },
        { actions: ['fallbackAction'] }
      ])
    ];

    It works very similar to the if-else syntax where only the first matched condition is causing associated actions to be executed and the last ones can be unconditional (serving as a general fallback, just like else branch).

Patch Changes

  • Cleanup internal structures upon receiving termination events from spawned actors.

  • Fixed an issue with data expressions of root's final nodes being called twice.

  • This change carries forward the typestate type information encoded in the arguments of the following functions and assures that the return type also has the same typestate type information:

    • Cloned state machine returned by .withConfig.

    • .state getter defined for services.

    • start method of services.

  • Loosened event type for SendAction<TContext, AnyEventObject>

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.