Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve TS types for launching browsers #6888

Merged
merged 1 commit into from Feb 16, 2021
Merged

Commits on Feb 16, 2021

  1. fix: improve TS types for launching browsers

    This commit tidies up the quite confusing state of all the various types
    required to launch a browser. As we saw when upgrading DevTools
    (https://source.chromium.org/chromium/chromium/src/+/master:third_party/devtools-frontend/src/test/conductor/hooks.ts;l=77),
    we had to define our launch options variable like so:
    
    ```ts
    const opts: puppeteer.LaunchOptions & puppeteer.ChromeArgOptions & puppeteer.BrowserOptions = {
      ...
    };
    ```
    
    This commit fixes that by introducing `AllNodeLaunchOptions`, which is
    defined as the intersection of all the above types.
    
    Additionally, the types defined as `ChromeArgOptions` are actually used
    for launching both Chrome and Firefox, so I have renamed them to
    `BrowserArgOptions`, and therefore this change is breaking because
    anyone using `ChromeArgOptions` in their types will need to switch.
    
    BREAKING CHANGE: renamed type `ChromeArgOptions` to `BrowserLaunchArgumentOptions`
    BREAKING CHANGE: renamed type `BrowserOptions` to `BrowserConnectOptions`
    jackfranklin committed Feb 16, 2021
    Copy the full SHA
    52af8c0 View commit details
    Browse the repository at this point in the history