Skip to content

Commit

Permalink
better .chain types
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jun 23, 2023
1 parent 2c7bc58 commit d029b78
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/lib/browsers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ export abstract class BrowserInterface implements PromiseLike<any> {
private promise?: Promise<any>
then: Promise<any>['then']
catch: Promise<any>['catch']
finally: Promise<any>['finally']
finally: Promise<any>['finally'];

protected chain(nextCall: any): BrowserInterface {
// necessary for the type of the function below
readonly [Symbol.toStringTag]: string = 'BrowserInterface'

protected chain<T>(
nextCall: (current: any) => T | PromiseLike<T>
): BrowserInterface & Promise<T> {
if (!this.promise) {
this.promise = Promise.resolve(this)
}
Expand Down

0 comments on commit d029b78

Please sign in to comment.