xstate
5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed
Summary· from the note as AI read it
Migration neededRead before upgrading: 1 change to make.
Before you upgrade
- Partial wildcard narrowing now includes prefix event; add further narrowing before payload access.
In short
1 fixed
Release note
Patch Changes
core: Fix
assertEventnarrowing when the event type is behind a generic type parameterPreviously, calling
assertEventinside a function whose event parameter was typed with a generic (e.g.function f<TEvent extends SomeEventUnion>(event: TEvent)) would compile, but every property access oneventafterward would fail to type-check with a "Property does not exist" error. This is now fixed -assertEventnarrows generic event parameters the same way it narrows concrete ones, while still rejecting invalid event descriptors at compile time.assertEventalso keeps narrowing events whosetypefield is a union of literals (e.g.{ type: 'a' | 'b'; value: string }) when asserting one of those literals, for both concrete and generic event parameters.Partial wildcard descriptors now preserve the bare prefix event in the narrowed type, matching runtime behavior. For example,
assertEvent(event, 'FEEDBACK.*')keeps bothFEEDBACKandFEEDBACK.GOOD, so accessing a payload specific toFEEDBACK.GOODrequires further narrowing. This also applies toExtractEventand event types inferred for partial wildcard transitions.
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.