xstate
5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed
Your version
5.33.4 is the newest release of 5.x.
In short
2 new
Release note
Minor Changes
Introduce
getNextSnapshot(...), which determines the next snapshot for the givenactorLogicbased on the givensnapshotandevent.If the
snapshotisundefined, the initial snapshot of theactorLogicis used.import { getNextSnapshot } from 'xstate'; import { trafficLightMachine } from './trafficLightMachine.ts'; const nextSnapshot = getNextSnapshot( trafficLightMachine, // actor logic undefined, // snapshot (or initial state if undefined) { type: 'TIMER' } ); // event object console.log(nextSnapshot.value); // => 'yellow' const nextSnapshot2 = getNextSnapshot( trafficLightMachine, // actor logic nextSnapshot, // snapshot { type: 'TIMER' } ); // event object console.log(nextSnapshot2.value); // =>'red'
Patch Changes
Allow
eventin transitions to be narrowed down even when its.typeis defined using a union.
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.