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
[6.0.0+] New Typings break existing Typescript Code #6979
Comments
For the sake of completeness as of Release 8.0.0: The following types have been renamed, merged or in other ways changed and are no longer available:As in all of these types throw the error
The following Types have changes that may break existing TypeScript implementations:I use "may" because many of them are useful changes and some may just reflect added features, some deeper analysis may be required.
With
and some changes to ElementHandle that I'm not able to pin down that may break many of the above types. Method of evaluationI evaluated these changes by importing the latest versions both I the used a very basic Utility Type to check alignments between the types existing in both packages:
I checked both the unchanged properties as well as a Required version of the interfaces to catch missing optional properties and let TypeScript figure out the rest:
This gave me somewhat useful Errors, e.g. the above snippet told me, that
Some other types, like SourcecodeSee the gist for the "implementaion" of the checks I did https://gist.github.com/1nVitr0/366a5829ac432597631ecb6de9f5df89. |
Importing |
I'm a package author and interested in this issue, o rather in the general stability of the public (non-internal) type definitions that are exposed now. In my package.json I've been having However I started exposing Small update: I just tried |
I'm having the same issue, at the moment the workaround I found is to use:
Instead of importing it (basically I'm losing the typing in order to make TypeScript happy). If I import puppeteer (or { PuppeteerExtra }) from "puppeteer-extra", this is the message I get:
I'd like to use two instances of puppeteer extra (one with filters, one without), any idea? |
Hi all, Sorry for the slow action here and silence. All this feedback is really useful; we were aware that in shipping our own types we would definitely find places where we miss things that the @types/puppeteer package exposed and it's our goal to fix them. Some renames happened because old Puppeteer names clashed with TypeScript built ins ( Going forwards from our current version (v8), I would expect us to treat TS breaking changes just as we would treat API changes as breaking, so I hope that we can be more stable moving forwards, and I totally understand the way we rolled out the TS changes was, in hindsight, not ideal for helping people upgrade and adopt Puppeteer and also not ideal for those who maintain libraries built to work with Puppeteer. I'm sorry that this wasn't the smooth rollout we would have ideally had. This week I'll go through the types documented in this issue and look into them to clarify if we can land PRs for the next release that fix some of them, or if I can help with renames. In the long term us shipping our own types should mean increased TS coverage going forward but it will take some time and effort to get there. |
The typings are failing for me too however I've utilised this workaround (from @ptommasi) to keep moving for now, and it is building without issue while we wait on the update as mentioned above. |
I'd like to add another use case. Our mock classes could I know this is a VERY specific use case but it would be nice if we could keep it working somehow. If you think this might be a good addition I'm also willing to put in some work to extract the interfaces and export them alongside as |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
Please include code that reproduces the issue.
LaunchOptions
typeWhat is the expected result?
Instead of just redefining, merging, or renaming types, original types should be kept and possibly extended or split. At the very least I would expect some clear documentation what types changed.
What happens instead?
Types have been renamed, moved, merged or broken without any clear indication in the changelogs. As an example:
LaunchOptions
has been reduced to a subset of it's original interface and is now extended withThere is also a
PuppeteerNodeLaunchOptions
which is used for theProductLauncher
interface and is pretty close to the originalLaunchOptions
(LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions
).What I don't understand is why
LaunchOptions
hasn't been kept and instead been split into the before mentioned parts. This is quite a breaking change nor does it make the typings any cleaner or easier to use.This is justn an example, see below comment for complet(ish)l list
I'm sure there might be a duplicate of this issue, but with a quick search I could only find some issues on broken typings. These renamed types are critical for projects like puppeteer-extra berstend/puppeteer-extra#428. If there is a duplicate, I'm sorry, but I don't have the time to screen 1500 open issues atm.
Anyway, I'd love to keep using the new versions of puppeteer, but right now the typings are a pretty big obstacle.
The text was updated successfully, but these errors were encountered: