From 1901dd44b83eac3b3a91248f0b7d73f01e20fd3e Mon Sep 17 00:00:00 2001 From: denshooter Date: Wed, 15 Oct 2025 16:09:48 +0200 Subject: [PATCH] Fix TypeScript error in jest.setup.ts - Update React.act mock to handle both sync and async callbacks - Fix type compatibility with React's act function signature - Ensures proper TypeScript compilation during build --- jest.setup.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jest.setup.ts b/jest.setup.ts index 19f6a05..4b4efde 100644 --- a/jest.setup.ts +++ b/jest.setup.ts @@ -9,9 +9,12 @@ if (process.env.NODE_ENV === 'production') { // Override React.act for production builds const originalAct = React.act; if (!originalAct) { - React.act = (callback: () => void) => { - callback(); - }; + React.act = (callback: () => void | Promise) => { + const result = callback(); + if (result instanceof Promise) { + return result; + } + } as typeof React.act; } // Also mock the act function from react-dom/test-utils