question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS: New typings inferior to former @types ones

See original GitHub issue

Steps 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.
  • Various types have come Object
    • Often incorrect such as jsonValue or json (should be ‘unknown’ instead)
    • Used instead of more precise dictonary object when used for headers and waitFor options.
  • Various specific overloads are missing that make requires less type assertions.

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:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
SimonSchickcommented, Feb 3, 2019

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.

1reaction
SimonSchickcommented, Feb 1, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found