Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

5.33.4

Latest7 Nov 2026Where it was published

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 assertEvent narrowing when the event type is behind a generic type parameter

    Previously, calling assertEvent inside 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 on event afterward would fail to type-check with a "Property does not exist" error. This is now fixed - assertEvent narrows generic event parameters the same way it narrows concrete ones, while still rejecting invalid event descriptors at compile time.

    assertEvent also keeps narrowing events whose type field 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 both FEEDBACK and FEEDBACK.GOOD, so accessing a payload specific to FEEDBACK.GOOD requires further narrowing. This also applies to ExtractEvent and 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.