xstate
5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed
4.38.3 is the newest release of 4.x.
In short
1 deprecated3 fixed
- Deprecated
The
SpawnedActorRefTypeScript interface has been deprecated in favor of a unifiedActorRefinterface, which contains the following:
Release note
Patch Changes
- Deprecated
The
SpawnedActorRefTypeScript interface has been deprecated in favor of a unifiedActorRefinterface, which contains the following:interface ActorRef<TEvent extends EventObject, TEmitted = any> extends Subscribable<TEmitted> { send: (event: TEvent) => void; id: string; subscribe(observer: Observer<T>): Subscription; subscribe( next: (value: T) => void, error?: (error: any) => void, complete?: () => void ): Subscription; getSnapshot: () => TEmitted | undefined; }For simpler actor-ref-like objects, the
BaseActorRef<TEvent>interface has been introduced.interface BaseActorRef<TEvent extends EventObject> { send: (event: TEvent) => void; } When using a model type in
createMachine<typeof someModel>(...), TypeScript will no longer compile machines that are missing thecontextproperty in the machine configuration:const machine = createMachine<typeof someModel>({ // missing context - will give a TS error! // context: someModel.initialContext, initial: 'somewhere', states: { somewhere: {} } });The typing for
InvokeCallbackhave been improved for better event constraints when using thesendBackparameter of invoked callbacks:invoke: () => (sendBack, receive) => { // Will now be constrained to events that the parent machine can receive sendBack({ type: 'SOME_EVENT' }); };The
state.metavalue is now calculated directly fromstate.configuration. This is most useful when starting a service from a persisted state:const machine = createMachine({ id: 'test', initial: 'first', states: { first: { meta: { name: 'first state' } }, second: { meta: { name: 'second state' } } } }); const service = interpret(machine); service.start('second'); // `meta` will be computed // the state will have // meta: { // 'test.second': { // name: 'second state' // } // } });
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.