Skip to content

Commit 9213df8

Browse files
fix: [useStateMachine]: types
1 parent c435d6a commit 9213df8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/vue-primitives/src/hooks/useStateMachine.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { ref } from 'vue'
2-
import { shallowRef } from 'vue'
1+
import { type Ref, shallowRef } from 'vue'
32

43
interface Machine<S> { [k: string]: { [k: string]: S } }
54
type MachineState<T> = keyof T
@@ -14,7 +13,7 @@ export function useStateMachine<M extends object>(
1413
initialState: MachineState<M>,
1514
machine: M & Machine<MachineState<M>>,
1615
) {
17-
const state = (shallowRef as typeof ref)(initialState)
16+
const state = (shallowRef as any)(initialState) as Ref<MachineState<M>>
1817

1918
function reducer(event: MachineEvent<M>) {
2019
const nextState = (machine[state.value] as any)[event]

0 commit comments

Comments
 (0)