Skip to content

Commit

Permalink
Fix conversion TS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano committed Feb 22, 2024
1 parent 05ca9ab commit b472d1b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/createInspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ export function createInspector<TAdapter extends Adapter>(
next: (event) => {
idleCallback(function inspectNext() {
const convertedEvent = convertXStateEvent(event);
sendAdapter(convertedEvent);
if (convertedEvent) {
sendAdapter(convertedEvent);
}
});
},
},
Expand All @@ -149,7 +151,7 @@ export function createInspector<TAdapter extends Adapter>(

export function convertXStateEvent(
inspectionEvent: InspectionEvent
): StatelyInspectionEvent {
): StatelyInspectionEvent | undefined {
switch (inspectionEvent.type) {
case '@xstate.actor': {
const actorRef = inspectionEvent.actorRef;
Expand Down Expand Up @@ -216,6 +218,7 @@ export function convertXStateEvent(
console.warn(
`Unhandled inspection event type: ${(inspectionEvent as any).type}`
);
return undefined;
}
}
}

0 comments on commit b472d1b

Please sign in to comment.