Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript): ship .d.ts file in npm package (#6811)
In all my excitement about shipping types, we forgot to export the actual `d.ts` file that makes it all happen... :( I didn't pick this up locally because I was testing with `npm link`, which does a symbolic link and therefore doesn't mirror the list of files that make it into the published package. To test this change, I made the change and ran `npm pack` to generate a tar. I then created a new empty directory and did `npm init -y` followed by `npm install path/to/puppeteer-7.tgz`. I then initialised TypeScript, and wrote this: ```js import puppeteer from 'puppeteer'; async function run() { const browser = await puppeteer.launch() const page = await browser.newPage() await page.goto('https://foo.com') } run(); ``` As I typed I got autocompletions and if I were to make an error, I'd get a TypeScript error. There is follow up work to be done because this unfortunately does not work if you use `require` rather than ES Modules. @AviVahl suggested a change in #6807 but I cannot get it to work, so I'd like to do more investigation here. In the mean time, whatever the contents of `cjs-entry.d.ts`, we should definitely be exporting it as part of the module, so this PR is still good to land.
- Loading branch information