Patch Changes
-
a50ea84: Machine output is now inferred as the union of the top-level final states' output types when no
schemas.outputor rootoutputis declared. Previously, declaringschemas.outputwas required to get a typed result fromtoPromise(actor)orsnapshot.output.const machine = setup({}).createMachine({ initial: 'working', states: { working: { on: { resolve: { target: 'succeeded' }, reject: { target: 'failed' } } }, succeeded: { type: 'final', output: () => ({ status: 'ok' as const }) }, failed: { type: 'final', output: { status: 'error' as const } } } }); // OutputFrom<typeof machine> is // { status: 'ok' } | { status: 'error' }
-
98160ed: Importing only
xstate/fsmnow typechecks on its own. Previously, an fsm-only program failed withProperty 'observable' does not exist on type 'SymbolConstructor'errors because theSymbol.observabletype augmentation lived in the main entry. Thexstate/fsmentry also no longer pulls the main entry's full type surface into the program, so editors andtsccheck far less code for fsm-only consumers.