6.0.0-alpha.69Pre-release
Changed 2
- A run that does not match schemas.output now reports the output mismatch
- A parameterless run now keeps literal return types whenever schemas is provided, including input-only and error-only schemas
Fixed 1
- createAsyncLogic no longer rejects a run that returns a literal matching schemas.output, which previously failed with "not assignable to type 'never'" including inside machine.provide({ actors })
From XState
Patch Changes
-
aaa891a:
createAsyncLogicno longer rejects arunthat returns a literal matchingschemas.output. Previously a parameterlessrunwidened{ kind: 'a' }to{ kind: string }, so the call failed with "not assignable to type 'never'", including insidemachine.provide({ actors }). Arunthat does not matchschemas.outputnow reports the output mismatch.type Outcome = { kind: 'a' } | { kind: 'b'; n: number }; const load = createAsyncLogic({ schemas: { input: types<{ id: string }>(), output: types<Outcome>() }, run: async () => ({ kind: 'a' }) // OK, output is `Outcome` });A parameterless
runnow keeps literal return types wheneverschemasis provided, including input-only and error-only schemas. Withoutschemas, outputs still widen ({ ok: true }is{ ok: boolean }).