Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #3012: PDFDownloadLinkProps Type Error #3013

Closed
wants to merge 1 commit into from

Conversation

islam-kamel
Copy link

@islam-kamel islam-kamel commented Dec 29, 2024

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.

Expected Behavior:
The PDFDownloadLink should correctly accept the child render function and render "Loading..." while the document is being prepared or "Download PDF" when ready.

Copy link

changeset-bot bot commented Dec 29, 2024

⚠️ No Changeset found

Latest commit: b31ff56

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

@islam-kamel islam-kamel changed the title fix #3012: Resolve PDFDownloadLinkProps Type Error fix #3012: PDFDownloadLinkProps Type Error Dec 29, 2024
@islam-kamel islam-kamel closed this by deleting the head repository Dec 29, 2024
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
1 participant