diff --git a/package-lock.json b/package-lock.json index 8b01be8..f956725 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "typedoc-plugin-mdn-links": "3.3.2", "typescript": "5.6.2", "typescript-eslint": "8.8.0", - "xstate": "5.18.1", + "xstate": "5.18.2", "zx": "8.1.8" }, "engines": { @@ -8890,9 +8890,9 @@ } }, "node_modules/xstate": { - "version": "5.18.1", - "resolved": "https://registry.npmjs.org/xstate/-/xstate-5.18.1.tgz", - "integrity": "sha512-m02IqcCQbaE/kBQLunwub/5i8epvkD2mFutnL17Oeg1eXTShe1sRF4D5mhv1dlaFO4vbW5gRGRhraeAD5c938g==", + "version": "5.18.2", + "resolved": "https://registry.npmjs.org/xstate/-/xstate-5.18.2.tgz", + "integrity": "sha512-hab5VOe29D0agy8/7dH1lGw+7kilRQyXwpaChoMu4fe6rDP+nsHYhDYKfS2O4iXE7myA98TW6qMEudj/8NXEkA==", "dev": true, "license": "MIT", "funding": { diff --git a/package.json b/package.json index 9bce608..027179a 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "typedoc-plugin-mdn-links": "3.3.2", "typescript": "5.6.2", "typescript-eslint": "8.8.0", - "xstate": "5.18.1", + "xstate": "5.18.2", "zx": "8.1.8" }, "commitlint": { diff --git a/src/until-event-received.ts b/src/until-event-received.ts index 6c68f17..c52da51 100644 --- a/src/until-event-received.ts +++ b/src/until-event-received.ts @@ -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; /** diff --git a/src/until-event-sent.ts b/src/until-event-sent.ts index 50c25a7..9949270 100644 --- a/src/until-event-sent.ts +++ b/src/until-event-sent.ts @@ -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 = { complete: () => {