From b472d1bd09f774aef7eb9fdc828b57a4c0517ad8 Mon Sep 17 00:00:00 2001 From: David Khourshid Date: Thu, 22 Feb 2024 18:24:54 +0100 Subject: [PATCH] Fix conversion TS issue --- src/createInspector.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/createInspector.ts b/src/createInspector.ts index d0f48dd..c1be1ed 100644 --- a/src/createInspector.ts +++ b/src/createInspector.ts @@ -132,7 +132,9 @@ export function createInspector( next: (event) => { idleCallback(function inspectNext() { const convertedEvent = convertXStateEvent(event); - sendAdapter(convertedEvent); + if (convertedEvent) { + sendAdapter(convertedEvent); + } }); }, }, @@ -149,7 +151,7 @@ export function createInspector( export function convertXStateEvent( inspectionEvent: InspectionEvent -): StatelyInspectionEvent { +): StatelyInspectionEvent | undefined { switch (inspectionEvent.type) { case '@xstate.actor': { const actorRef = inspectionEvent.actorRef; @@ -216,6 +218,7 @@ export function convertXStateEvent( console.warn( `Unhandled inspection event type: ${(inspectionEvent as any).type}` ); + return undefined; } } }