Since 16.9.0 was released with a fix for react/react#14769, act returns a Promise (and optionally takes in a Promise).
This line should be updated to allow this, or better yet, it should forward the type typeof act from @types/react-dom (see here, though I'm not sure if that's 100% correct since I think it is now allowed to pass in a promise).
Right now the workaround is to import act directly from react-dom (since act here is just a pass-through), or to define:
function asyncAct(fn: () => Promise<any> | void): Promise<void> {
return act(fn) as any as Promise<void>;
}
Since 16.9.0 was released with a fix for react/react#14769,
actreturns aPromise(and optionally takes in aPromise).This line should be updated to allow this, or better yet, it should forward the type
typeof actfrom@types/react-dom(see here, though I'm not sure if that's 100% correct since I think it is now allowed to pass in a promise).Right now the workaround is to import
actdirectly fromreact-dom(sinceacthere is just a pass-through), or to define: