diegomura / diegomura/react-pdf

Bug Report: Type Error When Using PDFDownloadLink in Next.js 15.1.3 with TypeScript 5.7.2 and React 19

Open
#3,116 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**
When using `PDFDownloadLink` in React 19 with TypeScript (Next.js 15.1.3, TS 5.7.2), an error occurs stating:
> "Type '({ loading }: { loading: boolean; }) => React.JSX.Element' is not assignable to type 'ReactNode | ReactElement>'."

This issue happens when using the render prop inside `PDFDownloadLink`.

---

**To Reproduce**
Steps to reproduce the behavior:
1. Create a Next.js (15.1.3) project with TypeScript (5.7.2).
2. Install `@react-pdf/renderer` and use `PDFDownloadLink`.
3. Use a render prop inside `PDFDownloadLink`.
4. Run the project and observe the TypeScript error.

Here is a **Replit example** reproducing the issue:
🔗 [Reproduction Link](https://replit.com/@AtharvaGajakos/PDFDownloadLink-Issue)

---

**Expected behavior**
The `PDFDownloadLink` should work correctly without TypeScript errors. The loading state should also work as expected.

---

**Screenshots**
If applicable, attach screenshots showing the error message.

---

**Desktop (please complete the following information):**
- **OS:** Windows 10
- **Browser:** Chrome
- **React Version:** 19
- **Next.js Version:** 15.1.3
- **Node.js Version:** 22.6.0
- **TypeScript Version:** 5.7.2
- **React-PDF Version:** 4.1.6

---

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.