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: TypeScript error in PDFDownloadLink component with react-pdf v4 #2887

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions packages/renderer/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
/* eslint-disable max-classes-per-file */
import * as React from 'react';
import {
Style,
PageSize,
Bookmark,
FontStore,
PDFVersion,
Orientation,
SourceObject,
HyphenationCallback,
SVGPresentationAttributes,
Bookmark,
Orientation,
PageLayout,
PageMode,
PageSize,
PDFVersion,
SourceObject,
Style,
SVGPresentationAttributes,
} from '@react-pdf/types';

declare class ReactPDF {
Expand All @@ -28,6 +28,7 @@ declare namespace ReactPDF {
interface Styles {
[key: string]: Style;
}

interface OnRenderProps {
blob?: Blob;
}
Expand Down Expand Up @@ -466,6 +467,7 @@ declare namespace ReactPDF {
loading: boolean;
error: Error | null;
}

interface BlobProviderProps {
document: React.ReactElement<DocumentProps>;
children: (params: BlobProviderParams) => React.ReactNode;
Expand Down Expand Up @@ -495,12 +497,15 @@ declare namespace ReactPDF {
*/
export class PDFViewer extends React.Component<PDFViewerProps> {}

// @ts-ignore
interface PDFDownloadLinkProps
extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
/** PDF filename. Alias for anchor tag `download` attribute. */
fileName?: string;
document: React.ReactElement<DocumentProps>;
children?: React.ReactNode | React.ReactElement<BlobProviderParams>;
children?:
| React.ReactNode
| ((props: BlobProviderParams) => React.ReactNode);
onClick?: React.AnchorHTMLAttributes<HTMLAnchorElement>['onClick'] &
((
event: React.MouseEvent<HTMLAnchorElement, MouseEvent>,
Expand Down