From 943477cc1eb4b129870142873b3554737d5ef252 Mon Sep 17 00:00:00 2001 From: Karl Horky Date: Tue, 6 Apr 2021 21:39:12 +0200 Subject: [PATCH] feat(types): improve type of predicate function (#6997) From the DefinitelyTyped @types/puppeteer package: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c43191a8f7a7d2a47bbff0bc3a7d95ecc64d2269/types/puppeteer/index.d.ts#L1883-L1885 --- src/common/Page.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/Page.ts b/src/common/Page.ts index fd27620beb0..17f3b6342ee 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -1408,7 +1408,7 @@ export class Page extends EventEmitter { } async waitForRequest( - urlOrPredicate: string | Function, + urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise), options: { timeout?: number } = {} ): Promise { const { timeout = this._timeoutSettings.timeout() } = options; @@ -1428,7 +1428,9 @@ export class Page extends EventEmitter { } async waitForResponse( - urlOrPredicate: string | Function, + urlOrPredicate: + | string + | ((res: HTTPResponse) => boolean | Promise), options: { timeout?: number } = {} ): Promise { const { timeout = this._timeoutSettings.timeout() } = options;