Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

4.26.0

1 Nov 2021Where it was published

4.38.3 is the newest release of 4.x.

In short

2 new3 fixed

Release note

Minor Changes

  • The description property is a new top-level property for state nodes and transitions, that lets you provide text descriptions:

    const machine = createMachine({
      // ...
      states: {
        active: {
          // ...
          description: 'The task is in progress',
          on: {
            DEACTIVATE: {
              // ...
              description: 'Deactivates the task'
            }
          }
        }
      }
    });

    Future Stately tooling will use the description to render automatically generated documentation, type hints, and enhancements to visual tools.

  • Add optional type parameter to narrow type returned by EventFrom. You can use it like this:

    type UpdateNameEvent = EventFrom<typeof userModel>;

Patch Changes

  • The tags property was missing from state's definitions. This is used when converting a state to a JSON string. Since this is how we serialize states within @xstate/inspect this has caused inspected machines to miss the tags information.

  • Fixed an issue with tags being missed on a service state after starting that service using a state value, like this:

    const service = interpret(machine).start('active');
    service.state.hasTag('foo'); // this should now return a correct result
  • Meta data can now be specified for invoke configs in the invoke.meta property:

    const machine = createMachine({
      // ...
      invoke: {
        src: (ctx, e) => findUser(ctx.userId),
        meta: {
          summary: 'Finds user',
          updatedAt: '2021-09-...',
          version: '4.12.2'
          // other descriptive meta properties
        }
      }
    });

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.