diff --git a/packages/xstate-inspect/src/server.ts b/packages/xstate-inspect/src/server.ts
index 0df26addcb..2762f0eb74 100644
--- a/packages/xstate-inspect/src/server.ts
+++ b/packages/xstate-inspect/src/server.ts
@@ -73,7 +73,7 @@ export function inspect(options: ServerInspectorOptions): Inspector {
return;
}
- const jsonMessage = JSON.parse(String(data as unknown));
+ const jsonMessage = JSON.parse(String(data));
inspectService.send({
...jsonMessage,
client
diff --git a/packages/xstate-react/test/useActor.test.tsx b/packages/xstate-react/test/useActor.test.tsx
index 5726d5d0c6..d6a447d84a 100644
--- a/packages/xstate-react/test/useActor.test.tsx
+++ b/packages/xstate-react/test/useActor.test.tsx
@@ -13,7 +13,8 @@ import {
assign,
createActor,
createMachine,
- raise
+ raise,
+ setup
} from 'xstate';
import { fromCallback, fromObservable, fromPromise } from 'xstate/actors';
import { useActor, useSelector } from '../src/index.ts';
@@ -664,37 +665,34 @@ describeEachReactMode('useActor (%s)', ({ suiteKey, render }) => {
it('should be able to use a delay provided outside of React', () => {
jest.useFakeTimers();
- const machine = createMachine(
- {
- initial: 'a',
- states: {
- a: {
- on: {
- EV: 'b'
- }
- },
- b: {
- after: {
- myDelay: 'c'
- }
- },
- c: {}
+ const machine = setup({
+ delays: {
+ myDelay: () => {
+ return 300;
}
- },
- {
- delays: {
- myDelay: () => {
- return 300;
+ }
+ }).createMachine({
+ initial: 'a',
+ states: {
+ a: {
+ on: {
+ EV: 'b'
}
- }
+ },
+ b: {
+ after: {
+ myDelay: 'c'
+ }
+ },
+ c: {}
}
- );
+ });
const App = () => {
const [state, send] = useActor(machine);
return (
<>
-
{state.value as string}
+ {state.value}