Skip to content

Commit

Permalink
fix: Ensure act is not any when React.act is not declared (#1323)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored May 7, 2024
1 parent b6e59f7 commit c1f2957
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof reactAct, reactDeprecatedAct, reactAct> from https://stackoverflow.com/a/61626123/3406963
export const act: 0 extends 1 & typeof reactAct
? typeof reactDeprecatedAct
: typeof reactAct

0 comments on commit c1f2957

Please sign in to comment.