fix: page.goto
options type should be optional (#6038)
The TypeScript definition erroneously made `options` required. We can fix it by providing a default value, which means users calling the function will be able to leave it blank without TS complaining. Issues like this are a +1 to porting our tests to TypeScript in order to catch these on our own test suite, so that's something we should look into.
This commit is contained in:
parent
44402b75a0
commit
ce34c0a4ff
@ -7,7 +7,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
goto(url: string, options: {
|
goto(url: string, options?: {
|
||||||
referer?: string;
|
referer?: string;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
goto(url: string, options: WaitForOptions & {
|
goto(url: string, options?: WaitForOptions & {
|
||||||
referer?: string;
|
referer?: string;
|
||||||
}): Promise<HTTPResponse>;
|
}): Promise<HTTPResponse>;
|
||||||
```
|
```
|
||||||
|
@ -412,7 +412,7 @@ export class Frame {
|
|||||||
referer?: string;
|
referer?: string;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
||||||
}
|
} = {}
|
||||||
): Promise<HTTPResponse | null> {
|
): Promise<HTTPResponse | null> {
|
||||||
return await this._frameManager.navigateFrame(this, url, options);
|
return await this._frameManager.navigateFrame(this, url, options);
|
||||||
}
|
}
|
||||||
|
@ -838,7 +838,7 @@ export class Page extends EventEmitter {
|
|||||||
|
|
||||||
async goto(
|
async goto(
|
||||||
url: string,
|
url: string,
|
||||||
options: WaitForOptions & { referer?: string }
|
options: WaitForOptions & { referer?: string } = {}
|
||||||
): Promise<HTTPResponse> {
|
): Promise<HTTPResponse> {
|
||||||
return await this._frameManager.mainFrame().goto(url, options);
|
return await this._frameManager.mainFrame().goto(url, options);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user