From 3ad929eb4a26eed0723aa80a7e4da68331ef9b23 Mon Sep 17 00:00:00 2001 From: Tim Morris Date: Sun, 17 Dec 2023 19:32:05 -0500 Subject: [PATCH] Fix useActor send types for ActorLogic (#4604) --- .changeset/silent-dragons-jog.md | 5 +++++ packages/xstate-vue/src/useActor.ts | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changeset/silent-dragons-jog.md diff --git a/.changeset/silent-dragons-jog.md b/.changeset/silent-dragons-jog.md new file mode 100644 index 0000000000..2167d57c0f --- /dev/null +++ b/.changeset/silent-dragons-jog.md @@ -0,0 +1,5 @@ +--- +'@xstate/vue': patch +--- + +The `useActor` hook now correctly types it's `send` function when passed an `ActorLogic`. diff --git a/packages/xstate-vue/src/useActor.ts b/packages/xstate-vue/src/useActor.ts index 127292c87f..acdd3c4194 100644 --- a/packages/xstate-vue/src/useActor.ts +++ b/packages/xstate-vue/src/useActor.ts @@ -4,7 +4,6 @@ import { ActorOptions, ActorRefFrom, AnyActorLogic, - EventFrom, Snapshot, SnapshotFrom } from 'xstate'; @@ -16,7 +15,7 @@ export function useActor( options?: ActorOptions ): { snapshot: Ref>; - send: (event: EventFrom) => void; + send: (event: ActorRefFrom['send']) => void; actorRef: ActorRefFrom; }; export function useActor(