Skip to content

Commit

Permalink
Fix types to support returning boolean and resolveWith() in the sam…
Browse files Browse the repository at this point in the history
…e callback (#29)
  • Loading branch information
ronami committed Mar 16, 2023
1 parent 567d5da commit fee93a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ declare const pWaitFor: {
console.log('Yay! The file now exists.');
```
*/
<ResolveValueType>(condition: () => PromiseLike<boolean> | boolean | ResolveValue<ResolveValueType> | PromiseLike<ResolveValue<ResolveValueType>>, options?: Options<ResolveValueType>): Promise<ResolveValueType>;
<ResolveValueType>(condition: () => PromiseLike<boolean | ResolveValue<ResolveValueType>> | PromiseLike<boolean> | boolean | ResolveValue<ResolveValueType> | PromiseLike<ResolveValue<ResolveValueType>>, options?: Options<ResolveValueType>): Promise<ResolveValueType>;

/**
Resolve the main promise with a custom value.
Expand Down
1 change: 1 addition & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ expectType<Promise<void>>(pWaitFor(() => true, {timeout: 1}));
expectType<Promise<void>>(pWaitFor(() => true, {before: false}));
expectType<Promise<number>>(pWaitFor(() => pWaitFor.resolveWith(1)));
expectType<Promise<number>>(pWaitFor(() => pWaitFor.resolveWith(1)));
expectType<Promise<number>>(pWaitFor(async () => true as boolean && pWaitFor.resolveWith(1)));

0 comments on commit fee93a5

Please sign in to comment.