Skip to content

Commit 7856952

Browse files
authored
ref: Add argument-less overload to resolvedSyncPromise (#5000)
1 parent 3a512bc commit 7856952

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/utils/src/syncpromise.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ const enum States {
1414
REJECTED = 2,
1515
}
1616

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+
1721
/**
1822
* Creates a resolved sync promise.
1923
*
2024
* @param value the value to resolve the promise with
2125
* @returns the resolved sync promise
2226
*/
23-
export function resolvedSyncPromise<T>(value: T | PromiseLike<T>): PromiseLike<T> {
27+
export function resolvedSyncPromise<T>(value?: T | PromiseLike<T>): PromiseLike<T> {
2428
return new SyncPromise(resolve => {
2529
resolve(value);
2630
});

0 commit comments

Comments
 (0)