Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

4.37.0

24 Feb 2023Where it was published

4.38.3 is the newest release of 4.x.

In short

1 new1 fixed

Release note

Minor Changes

  • The new TagsFrom helper type extracts the type of tags from a state machine when typegen is enabled:

    const machine = createMachine({
      // `tags` attached to machine via typegen
      tsTypes: {} as import('./machine.typegen').Typegen0,
      tags: ['a', 'b'],
      states: {
        idle: { tags: 'c' }
      }
    });
    
    type Tags = TagsFrom<typeof machine>; // 'a' | 'b' | 'c'

    If typegen is not enabled, TagsFrom returns string:

    const machine = createMachine({
      tags: ['a', 'b'],
      states: {
        idle: { tags: 'c' }
      }
    });
    
    type Tags = TagsFrom<typeof machine>; // string

Patch Changes

  • Fixed event type narrowing in some of the builtin actions.

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.