Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typescript): allow using puppeteer without dom lib #6998

Merged
merged 4 commits into from Sep 11, 2021
Merged

feat(typescript): allow using puppeteer without dom lib #6998

merged 4 commits into from Sep 11, 2021

Conversation

remcohaszing
Copy link
Contributor

The dom lib inserts all dom related types into the project, which is often undesirable when working on a NodeJS project.

This change injects global stubs for the dom types required by puppeteer, so puppeteer can work without users having to add dom types to their project.

Closes #6989

@jschfflr
Copy link
Contributor

Hi @remcohaszing, thanks for your contribution!
I'm happy to get this landed if you can update the patch to resolve the merge conflicts :)

@jschfflr jschfflr self-requested a review September 11, 2021 08:53
The dom lib inserts all dom related types into the project, which is often
undesirable when working on a NodeJS project.

This change injects global stubs for the dom types required by puppeteer, so
puppeteer can work without users having to add dom types to their project.

Closes #6989
@remcohaszing
Copy link
Contributor Author

remcohaszing commented Sep 11, 2021

I’m not entirely sure what happened 3 months ago, but I had to reset to main, cherry-pick, and force push in order to fix this PR. Anyway, it’s fixed now. 😄

@jschfflr jschfflr enabled auto-merge (squash) September 11, 2021 20:45
@jschfflr jschfflr merged commit 723052d into puppeteer:main Sep 11, 2021
jschfflr pushed a commit to mushishi78/puppeteer that referenced this pull request Sep 16, 2021
The dom lib inserts all dom related types into the project, which is often
undesirable when working on a NodeJS project.

This change injects global stubs for the dom types required by puppeteer, so
puppeteer can work without users having to add dom types to their project.

Closes puppeteer#6989
johanbay added a commit that referenced this pull request Dec 9, 2021
OrKoN pushed a commit that referenced this pull request Dec 10, 2021
…om lib"

Reverts #6998

We unfortunately have to revert this commit for two reasons:

The approach for generating types.d.ts implemented in the commit invalidates triple-slash compiler directives since it prepends a declaration before the types.d.ts generated by api-extractor.
In particular, the directive /// <reference types="node" /> in the final types.d.ts is ignored by the typescript compiler making module resolution fail.
The commit makes Puppeteer types ship without DOM types per default. This is not ideal since Puppeteer (and usage of Puppeteer) relies heavily on interacting with DOM elements.
This was referenced May 30, 2022
This was referenced May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the use of types without using the DOM lib
2 participants