xstate
5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed
Your version
4.38.3 is the newest release of 4.x.
In short
3 new
Release note
Minor Changes
The model created from
createModel(...)now provides a.createMachine(...)method that does not require passing any generic type parameters:const model = createModel(/* ... */); -const machine = createMachine<typeof model>(/* ... */); +const machine = model.createMachine(/* ... */);
Actors can now be invoked/spawned from reducers using the
fromReducer(...)behavior creator:import { fromReducer } from 'xstate/lib/behaviors'; type CountEvent = { type: 'INC' } | { type: 'DEC' }; const countReducer = (count: number, event: CountEvent): number => { if (event.type === 'INC') { return count + 1; } else if (event.type === 'DEC') { return count - 1; } return count; }; const countMachine = createMachine({ invoke: { id: 'count', src: () => fromReducer(countReducer, 0) }, on: { INC: { actions: forwardTo('count') }, DEC: { actions: forwardTo('count') } } });Actors can now be spawned directly in the initial
machine.contextusing lazy initialization, avoiding the need for intermediate states and unsafe typings for immediately spawned actors:const machine = createMachine<{ ref: ActorRef<SomeEvent> }>({ context: () => ({ ref: spawn(anotherMachine, 'some-id') // spawn immediately! }) // ... });
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.