PejmanNik/puppeteer-report

Cannot use with Puppeteer 8.x

Closed this issue · 8 comments

This is similar to #16, except I can't move to puppeteer-core as I use puppeteer.

While there's no issues during runtime, TypeScript builds fail —

error TS2345: Argument of type 'import("/home/wizard/wiz-pdf/node_modules/puppeteer/lib/types").Page' is not assignable to parameter of type 'import("/home/wizard/wiz-pdf/node_modules/@types/puppeteer-core/node_modules/@types/puppeteer/index").Page'.
  Type 'Page' is missing the following properties from type 'Page': setMaxListeners, getMaxListeners, listeners, rawListeners, and 3 more.

I'm not entirely sure how to solve this in a backwards-compatible way; any ideas are welcome.

Can we solve it by upgrading the @types/puppeteer to the last version?

We could try, but AFAIK, Puppeteer ships with it's own types starting from the 6.x release.

the new version 2.0.5 will fix it.

@PejmanNik I can confirm that 2.0.5 does not fix this. Here's what I get when using puppeteer@9.1.0 and puppeteer-report@2.0.5

 error TS2345: Argument of type 'import("/Users/gp/Projects/wiz-pdf/node_modules/puppeteer/lib/types").Page' is not assignable to parameter of type 'import("/Users/gp/Projects/wiz-pdf/node_modules/@types/puppeteer-core/node_modules/@types/puppeteer/index").Page'.
  Type 'Page' is missing the following properties from type 'Page': setMaxListeners, getMaxListeners, listeners, rawListeners, and 3 more.

87     const pdf = await pdfPage(page, {
                                 ~~~~

Found 1 error.

I'll release v3.0.0 with some breaking changes. The package will support puppeteer/puppeteer-core from version 7.0.1 to <10.0.0

@paambaati please confirm the new version fixes this issue.
Thank you.

@PejmanNik Thanks, v3 works fine with Pupeteer v9.x.

@paambaati Thank you 🎉