Minor Changes
-
#4180
6b1646ba8
Thanks @davidkpiano! - You can now specify action types for machines:createMachine({ types: {} as { actions: { type: 'greet'; params: { name: string } }; }, entry: [ { type: 'greet', params: { name: 'David' } }, // @ts-expect-error { type: 'greet' }, // @ts-expect-error { type: 'unknownAction' } ] // ... });
-
#4179
2b7548579
Thanks @davidkpiano! - Output types can now be specified in the machine:const machine = createMachine({ types: {} as { output: { result: 'pass' | 'fail'; score: number; }; } // ... }); const actor = createActor(machine); // ... const snapshot = actor.getSnapshot(); if (snapshot.output) { snapshot.output.result; // strongly typed as 'pass' | 'fail' snapshot.output.score; // strongly typed as number }