From ff69ebfe49c7fef926dd36c758715c636715ff23 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Tue, 7 May 2024 12:58:34 +0200 Subject: [PATCH] fix: Ensure `act` is not `any` when `React.act` is not declared --- types/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index c1cb345f..37c8392a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -251,6 +251,7 @@ export function cleanup(): void * If that's not available (older version of react) then it * simply calls the deprecated version which is ReactTestUtils.act(cb) */ -export const act: typeof reactAct extends never +// IfAny from https://stackoverflow.com/a/61626123/3406963 +export const act: 0 extends 1 & typeof reactAct ? typeof reactDeprecatedAct : typeof reactAct