We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63187c4 commit 8666b51Copy full SHA for 8666b51
src/flushMicroTasks.ts
@@ -1,13 +1,5 @@
1
import { setImmediate } from './helpers/timers';
2
3
-type Thenable<T> = { then: (callback: () => T) => unknown };
4
-
5
-export function flushMicroTasks(): Thenable<void> {
6
- return {
7
- // using "thenable" instead of a Promise, because otherwise it breaks when
8
- // using "modern" fake timers
9
- then(resolve) {
10
- setImmediate(resolve);
11
- },
12
- };
+export function flushMicroTasks() {
+ return new Promise((resolve) => setImmediate(resolve));
13
}
0 commit comments