TS: New typings inferior to former @types ones
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.12
- Platform / OS version: Irrelevant
- URLs (if applicable):
- Node.js version: Irrelevant
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?
- Various types have become
Function
- Callbacks in
waitFor/evaluate
-ish functions.
- Callbacks in
- Various types have come
Object
- Often incorrect such as
jsonValue
orjson
(should be ‘unknown’ instead) - Used instead of more precise dictonary object when used for
headers
andwaitFor
options.
- Often incorrect such as
- Various specific overloads are missing that make requires less type assertions.
- See #3877
Both 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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:11 (2 by maintainers)
Top Results From Across the Web
typescript - Is it possible to restrict number to a certain range
Is it possible to restrict a type to a number range, e.g. 0-255, without writing out 256 numbers in the type? In my...
Read more >Documentation - Advanced Types - TypeScript
This page lists some of the more advanced ways in which you can model types, it works in tandem with the Utility Types...
Read more >TypeScript introduction part III - generics & stuff - Arek Nawo
In this case, any type is used, which results in inferior type-safety. To deal with this problem TS provides an option to create...
Read more >TypeScript Features to Avoid - Hacker News
One minor advantage is that you can import the type on its own. If an external app just needs the types, it can...
Read more >Minimal TypeScript Crash Course For React
It's seen vast adoption in the React world in the past years. ... The TypeScript type describing this object looks like this: type...
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
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.
See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/32723, I added a few extra tests, should help you a bit.
Also, it seems your generated generated some interfaces multiple times, see
PageMetricsPayload