Skip to content

Commit c2adf9f

Browse files
Flammaematthewp
andauthored
fix: derive send function type from machine (#251)
* fix: derive send function type from machine * Add changeset for react-robot type fix --------- Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
1 parent 522adf9 commit c2adf9f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.changeset/fix-react-typed-send.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-robot": patch
3+
---
4+
5+
Fix send function type to properly derive transitions from machine type

packages/react-robot/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
declare module 'react-robot' {
2-
import type {Machine, SendFunction, Service} from 'robot3';
2+
import type {Machine, SendFunction, Service, GetMachineTransitions} from 'robot3';
33
export function useMachine<M extends Machine>(
44
machine: M,
55
initialContext?: M['context']
66
): [
77
M['state'] & {context: M['context']},
8-
SendFunction,
8+
SendFunction<GetMachineTransitions<M>>,
99
Service<typeof machine>
1010
];
1111
}

0 commit comments

Comments
 (0)