feat(types): improve type of predicate function (#6997)

From the DefinitelyTyped @types/puppeteer package:

c43191a8f7/types/puppeteer/index.d.ts (L1883-L1885)
This commit is contained in:
Karl Horky 2021-04-06 21:39:12 +02:00 committed by Mathias Bynens
parent c39c81d016
commit 943477cc1e

View File

@ -1408,7 +1408,7 @@ export class Page extends EventEmitter {
}
async waitForRequest(
urlOrPredicate: string | Function,
urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>),
options: { timeout?: number } = {}
): Promise<HTTPRequest> {
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<boolean>),
options: { timeout?: number } = {}
): Promise<HTTPResponse> {
const { timeout = this._timeoutSettings.timeout() } = options;