-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Description
π Bug Report
The class interface for PuppeteerEnvironment is a named default export:
export { JestPuppeteerConfig, JestPuppeteerGlobal, PuppeteerEnvironment as default };To Reproduce
But when importing into Node.js (without Babel or a bundler) the source now differs to the types:
class CustomEnvironment extends PuppeteerEnvironment {} // Actual default export, won't compile
class CustomEnvironment extends PuppeteerEnvironment.default {} // But types use named exportLibraries like glob support both by adding default as a property
isaacs/node-glob@c381907
Expected behavior
Compilation should complete without error but the following is shown:
src/custom-environment.js:3:33 - error TS2507: Type 'typeof import("/path/to/project/node_modules/jest-environment-puppeteer/dist/index")' is not a constructor function type.
3 class CustomEnvironment extends PuppeteerEnvironment {
~~~~~~~~~~~~~~~~~~~~
src/custom-environment.js:8:22 - error TS2339: Property 'global' does not exist on type 'CustomEnvironment'.
8 console.log(this.global)
~~~~~~
src/custom-environment.js:9:22 - error TS2339: Property 'context' does not exist on type 'CustomEnvironment'.
9 console.log(this.context)
~~~~~~~Link to repl or repo (highly encouraged)
Reproduced in example repo:
https://github.com/colinrotherham/jest-environment-puppeteeer-types
Metadata
Metadata
Assignees
Labels
No labels