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
TS: New typings inferior to former @types ones #3878
Comments
@SimonSchick thank you for letting us know and sorry for breaking you. We'll push a 1.12.1 without d.ts file shortly |
You might want to include https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/puppeteer/puppeteer-tests.ts as some sort of test baseline. |
They are included and all passed at at https://github.com/GoogleChrome/puppeteer/blob/master/utils/doclint/generate_types/test/test.ts Seems like there is some untested functionality though. If you could sending a PR adding failing code to that file (just leave it commented out) it would be super helpful! |
Ah yea, I didn't see it there, and yea the tests are far from complete, I will see if I get around to it. |
1.12.1 is out now with removed |
See DefinitelyTyped/DefinitelyTyped#32723, I added a few extra tests, should help you a bit. Also, it seems your generated generated some interfaces multiple times, see |
Puppeteer v1.12.0 had added the official type definition, but updated v1.12.1 has removed it because of low quality. See: puppeteer/puppeteer#3878
* Upgrade dependent packages to latest * Revert deletion of @types/puppeteer in 302d5f6 Puppeteer v1.12.0 had added the official type definition, but updated v1.12.1 has removed it because of low quality. See: puppeteer/puppeteer#3878 * Upgrade Node to v10.15.1 * Fix TS compile error caused by returning unused value * Fix TypedEventEmitterr to use compatible lister function type * Test with Node 8.9, the least required version * Use independent Chrome instance per example while testing Converter * Revert test with Node 8.9 * Update CHANGELOG.md
Going to be devils advocate: at this point I think it would be easiest to just port puppeteer to TS than invest further work into the types generator for adding overloads and such. In the end every contributor needs to know TS to write the doctags anyways. |
I don't see how switching to TypeScript helps to solve any of these problems. TypeScript's generated d.ts file is not going to be higher quality than the one I'm generating. |
@JoelEinbinder the main pain point I see here will be specifying overloads for I've tried to find out how to specify those via JSDoc but haven't found a way to make this work. |
weak typings generates errors in builds, that's the whole point of the compiler barking at your loose code. if puppeteer code doesn't account for strict parameters, it will indeed generate just-as-weak typings, even if the codebase is converted to TS. |
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
Please include code that reproduces the issue.
Update
puppeteer
2.
Check typings.
3.
They are worse.
What is the expected result?
Typings should be at least at DT quality.
What happens instead?
Function
waitFor/evaluate
-ish functions.Object
jsonValue
orjson
(should be 'unknown' instead)headers
andwaitFor
options.waitForSelector
should only resolvenull
when called with `hidden: true #3877Both types should not be used as they are extremely broad.
FYI I consider this a breaking change as I cannot easily revert to DT typings without explicitly downgrading puppeteer, it also broke our builds.
The text was updated successfully, but these errors were encountered: