Skip to content

Commit

Permalink
Removed conflicting or redundant children props (#2172)
Browse files Browse the repository at this point in the history
* Removed conflicting or redundant children props

* Removed PropsWithChildren from Canvas and Image

* changeset
  • Loading branch information
rdennis authored Jan 31, 2023
1 parent 7b0c740 commit d0cc0bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-students-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@react-pdf/renderer': patch
---

Improved `children` prop types for react@18.
17 changes: 6 additions & 11 deletions packages/renderer/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ declare namespace ReactPDF {
language?: string;
pdfVersion?: PDFVersion;
onRender?: (props: OnRenderProps) => any;
children?: React.ReactNode;
}

/**
Expand Down Expand Up @@ -76,7 +75,6 @@ declare namespace ReactPDF {
orientation?: Orientation;
dpi?: number;
bookmark?: Bookmark;
children?: React.ReactNode;
}

/**
Expand All @@ -103,7 +101,6 @@ declare namespace ReactPDF {
pageNumber: number;
subPageNumber: number;
}) => React.ReactNode;
children?: React.ReactNode;
}

/**
Expand Down Expand Up @@ -135,7 +132,7 @@ declare namespace ReactPDF {
* A React component for displaying network or local (Node only) JPG or
* PNG images, as well as base64 encoded image strings.
*/
class Image extends React.Component<React.PropsWithChildren<ImageProps>> {}
class Image extends React.Component<ImageProps> {}

interface TextProps extends NodeProps {
id?: string;
Expand All @@ -155,7 +152,6 @@ declare namespace ReactPDF {
subPageNumber: number;
subPageTotalPages: number;
}) => React.ReactNode;
children?: React.ReactNode;
/**
* Override the default hyphenation-callback
* @see https://react-pdf.org/fonts#registerhyphenationcallback
Expand Down Expand Up @@ -202,7 +198,6 @@ declare namespace ReactPDF {
*/
debug?: boolean;
src: string;
children?: React.ReactNode;
}

/**
Expand All @@ -215,7 +210,7 @@ declare namespace ReactPDF {
children: string;
}

class Note extends React.Component<React.PropsWithChildren<NoteProps>> {}
class Note extends React.Component<NoteProps> {}

interface CanvasProps extends NodeProps {
/**
Expand All @@ -230,7 +225,7 @@ declare namespace ReactPDF {
) => null;
}

class Canvas extends React.Component<React.PropsWithChildren<CanvasProps>> {}
class Canvas extends React.Component<CanvasProps> {}

interface SVGProps extends NodeProps {
/**
Expand Down Expand Up @@ -425,7 +420,7 @@ declare namespace ReactPDF {
* @see https://react-pdf.org/advanced#on-the-fly-rendering
* @platform web
*/
class BlobProvider extends React.Component<React.PropsWithChildren<BlobProviderProps>> {}
class BlobProvider extends React.Component<BlobProviderProps> {}

interface PDFViewerProps {
width?: number | string;
Expand All @@ -441,7 +436,7 @@ declare namespace ReactPDF {
* Iframe PDF viewer for client-side generated documents.
* @platform web
*/
class PDFViewer extends React.Component<React.PropsWithChildren<PDFViewerProps>> {}
class PDFViewer extends React.Component<PDFViewerProps> {}

interface PDFDownloadLinkProps {
document: React.ReactElement<DocumentProps>;
Expand All @@ -459,7 +454,7 @@ declare namespace ReactPDF {
* @see https://react-pdf.org/advanced#on-the-fly-rendering
* @platform web
*/
class PDFDownloadLink extends React.Component<React.PropsWithChildren<PDFDownloadLinkProps>> {}
class PDFDownloadLink extends React.Component<PDFDownloadLinkProps> {}

interface UsePDFInstance {
loading: boolean;
Expand Down

0 comments on commit d0cc0bd

Please sign in to comment.