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

puppeteer-core types differ from puppeteer #6904

Closed
Niek opened this issue Feb 18, 2021 · 9 comments
Closed

puppeteer-core types differ from puppeteer #6904

Niek opened this issue Feb 18, 2021 · 9 comments

Comments

@Niek
Copy link

Niek commented Feb 18, 2021

I'm maintaining the puppeteer add-on ghost-cursor and while upgrading the dependency to puppeteer@7 I noticed some strange differences between puppeteer and puppeteer-core types. For example the Page class is not interchangeable:

 error TS2345: Argument of type 'import("node_modules/puppeteer/lib/types").Page' is not assignable to parameter of type 'import("node_modules/puppeteer-core/lib/types").Page'.
  Types have separate declarations of a private property '_closed'.

Strange enough I can't find the differences in the generated types.d.ts files:

$ diff node_modules/puppeteer/lib/types.d.ts  node_modules/puppeteer-core/lib/types.d.ts | wc -l
       0

Any idea how this can be fixed? I would prefer to keep using puppeteer-core in the library while users most of the time use the regular puppeteer library.

@web-padawan
Copy link

I noticed this too, while trying to upgrade puppeteer version for @web/test-runner-puppeteer package.

See modernweb-dev/web#1295 (review) for one example where it caused TS compilation errors.

@web-padawan
Copy link

@jackfranklin as you mentioned that you are going through the types #6979 (comment), could you please check this one too?

@JakeTompkins
Copy link

Is there any progress on this? I'd like to use chrome-aws-lambda which uses puppeteer-core with a custom fork of html-pdf-node-ts which uses puppeteer, but I can't reconcile the types of Browser between the two

@stale
Copy link

stale bot commented Jun 23, 2022

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.

@stale stale bot added the unconfirmed label Jun 23, 2022
@kldzj
Copy link

kldzj commented Jul 17, 2022

This is still an issue.

@stale stale bot removed the unconfirmed label Jul 17, 2022
@luna-fire-dev
Copy link

This is because import('puppeteer').Page and import('puppeteer-core').Page are two different classes defined in two different js files from two different modules (so are the two types in two d.ts files). I am wondering why puppeteer doesn't import puppeteer-core as a dependency and re-use the classes from puppeteer-core.

@OrKoN
Copy link
Collaborator

OrKoN commented Sep 5, 2022

@luna-fire-dev that'd be our plan but it's not how it was originally set up (when it was JS with no typescript in sight) so it will take some time to untangle it.

@rpodwika
Copy link

rpodwika commented Mar 9, 2023

any updates on that?

@OrKoN
Copy link
Collaborator

OrKoN commented Mar 9, 2023

That should work in the latest versions as puppeteer-core is a dependency for puppeteer now.

@OrKoN OrKoN closed this as completed Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants