puppeteer: unable to use default export
See original GitHub issueThe puppeteer type definitions don’t seem to allow me to use the default export:
import puppeteer from "puppeteer";
puppeteer.launch(...);
which is the recommended usage according to the Puppeteer documentation.
Instead, Flow requires
import { launch } from "puppeteer";
launch(...);
because of
https://github.com/flow-typed/flow-typed/blob/b426b5f657cc2b688f3aced6eea25fc052f8f797/definitions/npm/puppeteer_v1.12.x/flow_v0.104.x-/puppeteer_v1.12.x.js#L2670
which doesn’t actually work at runtime, because the default export is a class instance and so launch()
here is an unbound method.
I’ve detailed the issue here:
Are these type defs actually working for others?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:10 (4 by maintainers)
Top Results From Across the Web
'"puppeteer"' has no exported member 'puppeteer ... - GitHub
'"puppeteer"' has no exported member 'puppeteer' using Typescript #7028 ... node_modules/puppeteer/lib/types"' has no default export.
Read more >TypeScript definition does not match default export
I'm trying to use Puppeteer with TypeScript ...
Read more >puppeteer-extra-plugin-stealth - npm
This plugin uses puppeteer-extra 's dependency system to only require code mods for evasions that have been enabled, to keep things modular and ......
Read more >How To Scrape a Website Using Node.js and Puppeteer
In this tutorial, you will build a web scraping application using Node.js and Puppeteer. Your app will grow in complexity as you progress....
Read more >node_modules/puppeteer/lib/types.d.ts - devtools ... - Google Git
By default, Puppeteer tries to approximate this filtering, exposing only ... export declare class Browser extends EventEmitter {. /**. * @internal.
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 FreeTop 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
Top GitHub Comments
Yep, same issue in typescript
This is the flow-typed repo, which isn’t the right place to discuss TypeScript issues. You should probably file a ticket on DefinitelyTyped.