@@ -281,23 +281,16 @@ export function createRenderer(): ShallowRenderer;
281
281
* Wrap any code rendering and triggering updates to your components into `act()` calls.
282
282
*
283
283
* Ensures that the behavior in your tests matches what happens in the browser
284
- * more closely by executing pending `useEffect`s before returning. This also
285
- * reduces the amount of re-renders done.
284
+ * more closely by executing pending `useEffect`s before returning.
285
+ *
286
+ * All `useEffect`s scheduled by the actions within the callback will be condensed into
287
+ * a single action, with only the latest values returned, to improve the efficiency of the test.
286
288
*
287
- * @param callback A synchronous, void callback that will execute as a single, complete React commit.
289
+ * @param callback A synchronous or asyncronous callback that will execute as a single, complete React commit.
288
290
*
289
291
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
290
292
*/
291
- // NOTES
292
- // - the order of these signatures matters - typescript will check the signatures in source order.
293
- // If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with
294
- // `strictNullChecks: false`.
295
- // - VoidOrUndefinedOnly is there to forbid any non-void return values for users with `strictNullChecks: true`
296
- declare const UNDEFINED_VOID_ONLY : unique symbol ;
297
- // tslint:disable-next-line: void-return
298
- type VoidOrUndefinedOnly = void | { [ UNDEFINED_VOID_ONLY ] : never } ;
299
- export function act ( callback : ( ) => Promise < void > ) : Promise < undefined > ;
300
- export function act ( callback : ( ) => VoidOrUndefinedOnly ) : void ;
293
+ export function act < T > ( callback : ( ) => Promise < T > | T ) : Promise < T > ;
301
294
302
295
// Intentionally doesn't extend PromiseLike<never>.
303
296
// Ideally this should be as hard to accidentally use as possible.
0 commit comments