Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

4.30.0

12 Feb 2022Where it was published

4.38.3 is the newest release of 4.x.

In short

1 deprecated2 new4 fixed

  • Deprecated

    Marked all phantom properties on the StateMachine type as deprecated. This deprioritized them in IDEs so they don't popup as first suggestions during property access.

Release note

Minor Changes

  • All actions are now available in the actions variable when importing: import { actions } from 'xstate'

  • Persisted state can now be easily restored to a state compatible with the machine without converting it to a State instance first:

    // Persisting a state
    someService.subscribe(state => {
      localStorage.setItem('some-state', JSON.stringify(state));
    });
    
    // Restoring a state
    const stateJson = localStorage.getItem('some-state');
    
    // No need to convert `stateJson` object to a state!
    const someService = interpret(someMachine).start(stateJson);

Patch Changes

  • Fixed an issue with a reference to @types/node being inserted into XState's compiled output. This could cause unexpected issues in projects expecting APIs like setTimeout to be typed with browser compatibility in mind.

  • Fixed an issue with states created using machine.getInitialState not being "resolved" in full. This could cause some things, such as after transitions, not being executed correctly after starting an interpreter using such state.

  • Deprecated

    Marked all phantom properties on the StateMachine type as deprecated. This deprioritized them in IDEs so they don't popup as first suggestions during property access.

  • Fixed an issue with state.context becoming any after state.matches when typegen is used.

  • Moved an internal @ts-ignore to a JSDoc-style comment to fix consuming projects that do not use skipLibCheck. Regular inline and block comments are not preserved in the TypeScript's emit.

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.