Skip to content

Commit

Permalink
fix: compatibility with XState v5.18.2
Browse files Browse the repository at this point in the history
The change from `AnyActorRef` to `ActorRefLike` in `InspectionEvent` broke the build; this fixes it.

I hope the type predicate is not too strong!
  • Loading branch information
boneskull committed Oct 7, 2024
1 parent ec791a2 commit 7945ebb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/until-event-received.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ const untilEventReceived = async <
* matches the target.
*/
const matchesTarget = otherActorId
? (actorRef?: xs.AnyActorRef) => actorRef?.id === otherActorId
? (actorRef?: xs.ActorRefLike) =>
isActorRef(actorRef) && actorRef.id === otherActorId
: () => true;

/**
Expand Down
9 changes: 6 additions & 3 deletions src/until-event-sent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,12 @@ const untilEventSent = async <
evt: xs.InspectionEvent,
type: TEventTypes[number],
): evt is xs.InspectedEventEvent =>
evt.type === XSTATE_EVENT &&
evt.sourceRef?.id === id &&
type === evt.event.type;
!!(
evt.type === XSTATE_EVENT &&
isActorRef(evt.sourceRef) &&
evt.sourceRef.id === id &&
type === evt.event.type
);

const eventSentInspector: xs.Observer<xs.InspectionEvent> = {
complete: () => {
Expand Down

0 comments on commit 7945ebb

Please sign in to comment.