Outline onItemClick function Getting Type Error - Type error: Binding element 'itemPageNumber' implicitly has an 'any' type.
donhook opened this issue · comments
Before you start - checklist
- I followed instructions in documentation written for my React-PDF version
- I have checked if this bug is not already reported
- I have checked if an issue is not listed in Known issues
- If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo
Description
I am getting the Error: Invalid pageIndex request when I click on an item in the outline. Not sure what the issue is....
Followed the Outline Recipe.
function onItemClick({ pageNumber: itemPageNumber}) {
setPageNumber(itemPageNumber);
}
...
<Outline className="width:100" onItemClick={onItemClick} />
I have "noImplicitAny": true, in my ts.config
Steps to reproduce
Define the onItem Click Function in the page
function onItemClick({ pageNumber: itemPageNumber}) {
setPageNumber(itemPageNumber);
}
Define the outline tag
Expected behavior
Click on an outline item and the appropriate PDF page is displayed
Actual behavior
Receiving a type error in VS code: Type error: Binding element 'itemPageNumber' implicitly has an 'any' type.
Receiving an unhandled runtime error: Error: Invalid pageIndex request.
When clicking on an outline item.
Additional information
Not sure what misconfiguration i have
Environment
- Browser (if applicable):
- React-PDF version:
- React version:
- Webpack version (if applicable):
Chrome: v120.0
React: 18
React PDF: 7.6
Well add the type then!
function onItemClick({ pageNumber: itemPageNumber }: { pageNumber: number }) {
setPageNumber(itemPageNumber);
}
Thanks for your time... i tried that, still didnt resolve issue. Will continue to see what I have wrong in the environment or setup.