Skip to content

Commit

Permalink
fix: page.goto options type should be optional (#6038)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jackfranklin committed Jun 18, 2020
1 parent 44402b7 commit ce34c0a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion new-docs/puppeteer.frame.goto.md
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
goto(url: string, options: {
goto(url: string, options?: {
referer?: string;
timeout?: number;
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
Expand Down
2 changes: 1 addition & 1 deletion new-docs/puppeteer.page.goto.md
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
goto(url: string, options: WaitForOptions & {
goto(url: string, options?: WaitForOptions & {
referer?: string;
}): Promise<HTTPResponse>;
```
Expand Down
2 changes: 1 addition & 1 deletion src/FrameManager.ts
Expand Up @@ -412,7 +412,7 @@ export class Frame {
referer?: string;
timeout?: number;
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
}
} = {}
): Promise<HTTPResponse | null> {
return await this._frameManager.navigateFrame(this, url, options);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Page.ts
Expand Up @@ -838,7 +838,7 @@ export class Page extends EventEmitter {

async goto(
url: string,
options: WaitForOptions & { referer?: string }
options: WaitForOptions & { referer?: string } = {}
): Promise<HTTPResponse> {
return await this._frameManager.mainFrame().goto(url, options);
}
Expand Down

0 comments on commit ce34c0a

Please sign in to comment.