Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

4.30.1

15 Feb 2022Where it was published

4.38.3 is the newest release of 4.x.

In short

1 new1 fixed

Release note

Patch Changes

  • The AnyState and AnyStateMachine types are now available, which can be used to express any state and state machine, respectively:

    import type { AnyState, AnyStateMachine } from 'xstate';
    
    // A function that takes in any state machine
    function visualizeMachine(machine: AnyStateMachine) {
      // (exercise left to reader)
    }
    
    function logState(state: AnyState) {
      // ...
    }
  • Added the AnyStateConfig type, which represents any StateConfig<...>:

    import type { AnyStateConfig } from 'xstate';
    import { State } from 'xstate';
    
    // Retrieving the state config from localStorage
    const stateConfig: AnyStateConfig = JSON.parse(
      localStorage.getItem('app-state')
    );
    
    // Use State.create() to restore state from config object with correct type
    const previousState = State.create(stateConfig);

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.