XState 6.0.0-alpha.9

6.0.0-alpha.9Pre-release
Added 1
  • Export setup helper types AnySetupConfig and SetupReturnFromConfig for libraries that return or decorate setup-bound objects while preserving native setup(...).createMachine(...) typing
Changed 1
  • Registered invoke onDone callbacks now receive the invoked actor's output type, and machine.provide({ actorSources }) accepts compatible actor implementations with sound input/output variance
Fixed 1
  • Empty Standard Schema event objects now infer as type-only events, so { type: 'SEND' } is accepted for an empty SEND payload schema while non-empty schemas still require their payload fields
Minor Changes
  • 54205cc: Export setup helper types for libraries that return or decorate setup-bound objects while preserving native setup(...).createMachine(...) typing.

    import {
      setup,
      type AnySetupConfig,
      type SetupReturnFromConfig
    } from 'xstate';
    
    function decorateSetup<const TConfig extends AnySetupConfig>(
      config: TConfig
    ): SetupReturnFromConfig<TConfig> & { extra: true } {
      const s = setup(config) as SetupReturnFromConfig<TConfig>;
    
      return Object.assign(s, { extra: true as const });
    }
    
Patch Changes
  • 54205cc: Empty Standard Schema event objects now infer as type-only events, so { type: 'SEND' } is accepted for an empty SEND payload schema while non-empty schemas still require their payload fields.
  • 54205cc: Registered invoke onDone callbacks now receive the invoked actor's output type, and machine.provide({ actorSources }) accepts compatible actor implementations with sound input/output variance.
View original

Upgraded? How did it go?

Discussion