From 9d44c903ff5618a4f3cea511040063c64d59b22b Mon Sep 17 00:00:00 2001 From: David Khourshid Date: Thu, 28 Nov 2024 19:07:33 -0500 Subject: [PATCH] Update TypeScript to 5.7.2 (#5128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update TypeScript version and add type assertions in tests * Revert pnpm-lock.yaml * Lockfile * Lockfile? * Update typescript-eslint * Make eslint happy * fixed it without casts * ugh, use `unknown` annotation to satisfy eslin --------- Co-authored-by: Mateusz BurzyƄski --- package.json | 4 +- packages/xstate-inspect/src/server.ts | 2 +- packages/xstate-react/test/useActor.test.tsx | 58 +- .../xstate-react/test/useSelector.test.tsx | 14 +- pnpm-lock.yaml | 1600 ++++------------- 5 files changed, 391 insertions(+), 1287 deletions(-) diff --git a/package.json b/package.json index 17adc4d2b3..f0fa04d494 100644 --- a/package.json +++ b/package.json @@ -79,8 +79,8 @@ "prettier-plugin-jsdoc": "^1.3.0", "svelte-jester": "^2.3.2", "synckit": "^0.8.5", - "typescript": "^5.6.2", - "typescript-eslint": "^8.0.1", + "typescript": "^5.7.2", + "typescript-eslint": "^8.16.0", "vue": "^3.0.11" }, "husky": { diff --git a/packages/xstate-inspect/src/server.ts b/packages/xstate-inspect/src/server.ts index 2762f0eb74..8926294c76 100644 --- a/packages/xstate-inspect/src/server.ts +++ b/packages/xstate-inspect/src/server.ts @@ -68,7 +68,7 @@ export function inspect(options: ServerInspectorOptions): Inspector { }; server.on('connection', function connection(wsClient) { - wsClient.on('message', function incoming(data, isBinary) { + wsClient.on('message', function incoming(data: unknown, isBinary) { if (isBinary) { return; } diff --git a/packages/xstate-react/test/useActor.test.tsx b/packages/xstate-react/test/useActor.test.tsx index ea8b20c30b..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}