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.

Type declarations help

See original GitHub issue

Before you start - checklist

  • I have read documentation in README
  • I have checked sample and test suites to see real life basic implementation
  • I have checked if this question is not already asked

What are you trying to achieve? Please describe.

I’m trying to improve the definitions within @types/react-pdf, but want to make sure I’ve got everything handled before opening a pull request.

Additional information

For the Page prop onLoadSuccess (and for most props that are called “page callbacks”), console logging the argument of the methods yields the following shape:

Screen Shot 2021-01-04 at 4 25 43 PM

This doesn’t match up with the types outlined here which leverages an interface from @types/pdfjs-dist called PDFPageProxy.

For example, _pageIndex is exposed even though the types indicate that pageIndex is exposed.

Is there some parsing on page callbacks occurring beyond this method? If not, which of the two packages (pdfjs-dist / react-pdf) have the incorrect typing?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kylemhcommented, Jan 5, 2021

Sad to hear regarding non-Semver…

Okay, indeed they’ve since changed it. This is very helpful thank you.

Mind if I leave this open as a means for myself and others to gain context when adjusting types?

0reactions
github-actions[bot]commented, Sep 13, 2021

This issue was closed because it has been stalled for 14 days with no activity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Type Declarations - TypeScript
The answer is that there are declaration files describing these built-in objects. A declaration file provides a way to declare the existence of...
Read more >
A quick introduction to “Type Declaration” files and adding ...
In this lesson, we are going to take a closer look at type declaration files which are one of the key ingredients of...
Read more >
Type declarations - Manual - PHP
Type declarations can be added to function arguments, return values, and, as of PHP 7.4.0, class properties. They ensure that the value is...
Read more >
TypeScript — Type Declaration Files | by Makesh Kumar
TypeScript itself comes with a bunch of type declaration files to support all JavaScript features. After installing TypeScript, navigate to the node_modules/ ...
Read more >
typing — Support for type hints — Python 3.11.1 documentation
This module provides runtime support for type hints. The most fundamental support consists of the types Any , Union , Callable , TypeVar...
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