puppeteer-core types differ from puppeteer
See original GitHub issueI’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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:7
Top Results From Across the Web
@types/puppeteer-core - npm
Stub TypeScript definitions entry for puppeteer-core, which provides its own types definitions. Latest version: 7.0.4, last published: a ...
Read more >Overview of Puppeteer and puppeteer-core in Node.js
"Puppeteer is a Node library that provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless ...
Read more >Practical Puppeteer: Playing with Puppeteer Core package
The difference between puppeteer and puppeteer-core in the term of launch settings is we have to define the Chrome or Chromium browser ......
Read more >Playwright vs Puppeteer: Core Differences - BrowserStack
Its API is also available in multiple programming languages like Java, Python, Typescript, JavaScript, and C#. On the other hand, Puppeteer is a ......
Read more >Puppeteer | Puppeteer
puppeteer-core is a library to help drive anything that supports DevTools protocol. Being a library, puppeteer-core is fully driven through its programmatic ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This is because
import('puppeteer').Pageandimport('puppeteer-core').Pageare 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 whypuppeteerdoesn’t importpuppeteer-coreas a dependency and re-use the classes frompuppeteer-core.This is still an issue.