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

fix type definitions not working when using require() #6827

Closed
wants to merge 1 commit into from
Closed

fix type definitions not working when using require() #6827

wants to merge 1 commit into from

Conversation

k-yle
Copy link

@k-yle k-yle commented Feb 7, 2021

The type definitions are wrong and don't work at all.

If you try to use puppeteer v7 in a javascript file using const puppeteer = require('puppeteer'), typescript will tell you that it's wrong and you should be doing const puppeteer = require('puppeteer').default which is rubbish.

To confirm, enter this into your terminal:

node -p "require('puppeteer').default"

and note how it prints undefined.

Therefore the type definitions are wrong and should be using the export = syntax.

@google-cla
Copy link

google-cla bot commented Feb 7, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Feb 7, 2021
@k-yle
Copy link
Author

k-yle commented Feb 7, 2021

@googlebot I signed it!

@thomassuckow
Copy link

thomassuckow commented Feb 8, 2021

@k-yle Do you have the ability to test this also with import? I'm wondering if this combined with an addition to puppeteer/node.ts to export * from "./api-docs-entry" would expose all the types as well.

Would prefer #6837 over this PR.

@k-yle
Copy link
Author

k-yle commented Feb 10, 2021

closing, #6837 fixed this

@k-yle k-yle closed this Feb 10, 2021
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.

None yet

2 participants