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.
resolvedSyncPromise
1 parent 3a512bc commit 7856952Copy full SHA for 7856952
packages/utils/src/syncpromise.ts
@@ -14,13 +14,17 @@ const enum States {
14
REJECTED = 2,
15
}
16
17
+// Overloads so we can call resolvedSyncPromise without arguments and generic argument
18
+export function resolvedSyncPromise(): PromiseLike<void>;
19
+export function resolvedSyncPromise<T>(value: T | PromiseLike<T>): PromiseLike<T>;
20
+
21
/**
22
* Creates a resolved sync promise.
23
*
24
* @param value the value to resolve the promise with
25
* @returns the resolved sync promise
26
*/
-export function resolvedSyncPromise<T>(value: T | PromiseLike<T>): PromiseLike<T> {
27
+export function resolvedSyncPromise<T>(value?: T | PromiseLike<T>): PromiseLike<T> {
28
return new SyncPromise(resolve => {
29
resolve(value);
30
});
0 commit comments