Skip to content

fix: PDFDownloadLinkProps Type Error#3014

Merged
diegomura merged 2 commits intodiegomura:masterfrom
islam-kamel:master
Feb 5, 2025
Merged

fix: PDFDownloadLinkProps Type Error#3014
diegomura merged 2 commits intodiegomura:masterfrom
islam-kamel:master

Conversation

@islam-kamel
Copy link
Contributor

Fix #3012
Description:
This pull request addresses the TypeScript error TS2769: No overload matches this call that occurs when using PDFDownloadLink as described in issue #3012.

Changes:

  • Updated the type definitions for PDFDownloadLink to correctly accept the child render function.
  • Adjusted the implementation to align with the expected types.

Steps to Reproduce:

  1. Use PDFDownloadLink with the following setup:
    import { PDFDownloadLink } from '@react-pdf/renderer';
    
    const MyDocument = () => (
      <Document>
        <Page>
          <Text>Hello, world!</Text>
        </Page>
      </Document>
    );
    
    const DownloadLink = () => (
      <PDFDownloadLink document={<MyDocument />} fileName="example.pdf">
        {({ loading }) => (loading ? 'Loading...' : 'Download PDF')}
      </PDFDownloadLink>
    );
  2. Run tsc or start the application.
  3. Observe the TypeScript error.

@changeset-bot
Copy link

changeset-bot bot commented Dec 29, 2024

⚠️ No Changeset found

Latest commit: aec3b46

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@diegomura diegomura changed the title fix #3012: PDFDownloadLinkProps Type Error fix: PDFDownloadLinkProps Type Error Feb 5, 2025
@diegomura diegomura merged commit 685890b into diegomura:master Feb 5, 2025
@github-actions github-actions bot mentioned this pull request Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS2769: No overload matches this call in PDFDownloadLink

2 participants