react-pdf
react-pdf copied to clipboard
v3.3.7 ts build errors TS2323 TS2484 TS2309
Describe Issue After clean install of v3.3.7 (removed lockfile and nodemodules) I started to get TS build errors. Possibly related to #2559, which was closed but there was no commits to address the issue. Versions 3.3.x and 3.2.x also fail with same issue. Last working version I can find is 3.1.15.
To Reproduce Do a clean install of versions 3.3.x or 3.2.x and compile typescript with tsc
Expected Behaviour Compilation should pass successfully
Desktop (please complete the following information): Macbook Pro M1 React-pdf version: 3.3.7
Error Logs
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:17:10 - error TS2323: Cannot redeclare exported variable 'default'.
17 static default: typeof ReactPDF;
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:20:1 - error TS2309: An export assignment cannot be used in a module with other exported elements.
20 export = ReactPDF;
~~~~~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:53:9 - error TS2323: Cannot redeclare exported variable 'Document'.
53 class Document extends React.Component<
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:101:9 - error TS2323: Cannot redeclare exported variable 'Page'.
101 class Page extends React.Component<React.PropsWithChildren<PageProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:125:9 - error TS2323: Cannot redeclare exported variable 'View'.
125 class View extends React.Component<React.PropsWithChildren<ViewProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:150:9 - error TS2323: Cannot redeclare exported variable 'Image'.
150 class Image extends React.Component<ImageProps> {}
~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:202:9 - error TS2323: Cannot redeclare exported variable 'Text'.
202 class Text extends React.Component<
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:225:9 - error TS2323: Cannot redeclare exported variable 'Link'.
225 class Link extends React.Component<React.PropsWithChildren<LinkProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:231:9 - error TS2323: Cannot redeclare exported variable 'Note'.
231 class Note extends React.Component<NoteProps> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:246:9 - error TS2323: Cannot redeclare exported variable 'Canvas'.
246 class Canvas extends React.Component<CanvasProps> {}
~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:263:9 - error TS2323: Cannot redeclare exported variable 'Svg'.
263 class Svg extends React.Component<React.PropsWithChildren<SVGProps>> {}
~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:276:9 - error TS2323: Cannot redeclare exported variable 'Line'.
276 class Line extends React.Component<React.PropsWithChildren<LineProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:286:9 - error TS2323: Cannot redeclare exported variable 'Polyline'.
286 class Polyline extends React.Component<
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:299:9 - error TS2323: Cannot redeclare exported variable 'Polygon'.
299 class Polygon extends React.Component<
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:311:9 - error TS2323: Cannot redeclare exported variable 'Path'.
311 class Path extends React.Component<React.PropsWithChildren<PathProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:326:9 - error TS2323: Cannot redeclare exported variable 'Rect'.
326 class Rect extends React.Component<React.PropsWithChildren<RectProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:338:9 - error TS2323: Cannot redeclare exported variable 'Circle'.
338 class Circle extends React.Component<React.PropsWithChildren<CircleProps>> {}
~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:352:9 - error TS2323: Cannot redeclare exported variable 'Ellipse'.
352 class Ellipse extends React.Component<
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:365:9 - error TS2323: Cannot redeclare exported variable 'Tspan'.
365 class Tspan extends React.Component<React.PropsWithChildren<TspanProps>> {}
~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:375:9 - error TS2323: Cannot redeclare exported variable 'G'.
375 class G extends React.Component<React.PropsWithChildren<GProps>> {}
~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:386:9 - error TS2323: Cannot redeclare exported variable 'Stop'.
386 class Stop extends React.Component<React.PropsWithChildren<StopProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:393:9 - error TS2323: Cannot redeclare exported variable 'Defs'.
393 class Defs extends React.Component<React.PropsWithChildren<DefsProps>> {}
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:403:9 - error TS2323: Cannot redeclare exported variable 'ClipPath'.
403 class ClipPath extends React.Component<
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:418:9 - error TS2323: Cannot redeclare exported variable 'LinearGradient'.
418 class LinearGradient extends React.Component<
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:434:9 - error TS2323: Cannot redeclare exported variable 'RadialGradient'.
434 class RadialGradient extends React.Component<
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:455:9 - error TS2323: Cannot redeclare exported variable 'BlobProvider'.
455 class BlobProvider extends React.Component<BlobProviderProps> {}
~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:471:9 - error TS2323: Cannot redeclare exported variable 'PDFViewer'.
471 class PDFViewer extends React.Component<PDFViewerProps> {}
~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:473:13 - error TS2430: Interface 'PDFDownloadLinkProps' incorrectly extends interface 'Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href">'.
Types of property 'children' are incompatible.
Type 'ReactNode | ((params: BlobProviderParams) => ReactNode)' is not assignable to type 'ReactNode'.
Type '(params: BlobProviderParams) => ReactNode' is not assignable to type 'ReactNode'.
473 interface PDFDownloadLinkProps
~~~~~~~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:492:9 - error TS2323: Cannot redeclare exported variable 'PDFDownloadLink'.
492 class PDFDownloadLink extends React.Component<PDFDownloadLinkProps> {}
~~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:512:9 - error TS2323: Cannot redeclare exported variable 'Font'.
512 const Font: FontStore;
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:514:9 - error TS2323: Cannot redeclare exported variable 'StyleSheet'.
514 const StyleSheet: {
~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:518:9 - error TS2323: Cannot redeclare exported variable 'version'.
518 const version: any;
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:520:9 - error TS2323: Cannot redeclare exported variable 'PDFRenderer'.
520 const PDFRenderer: any;
~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:522:9 - error TS2323: Cannot redeclare exported variable 'pdf'.
522 const pdf: (initialValue?: React.ReactElement<DocumentProps>) => {
~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:536:9 - error TS2323: Cannot redeclare exported variable 'renderToStream'.
536 const renderToStream: (
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:543:9 - error TS2451: Cannot redeclare block-scoped variable 'renderToString'.
543 const renderToString: (
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:606:14
606 export const renderToString: typeof ReactPDF.renderToString;
~~~~~~~~~~~~~~
'renderToString' was also declared here.
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:547:9 - error TS2323: Cannot redeclare exported variable 'renderToFile'.
547 const renderToFile: (
~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:591:1 - error TS2323: Cannot redeclare exported variable 'default'.
591 export default ReactPDF;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:606:14 - error TS2451: Cannot redeclare block-scoped variable 'renderToString'.
606 export const renderToString: typeof ReactPDF.renderToString;
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:543:9
543 const renderToString: (
~~~~~~~~~~~~~~
'renderToString' was also declared here.
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:609:3 - error TS2323: Cannot redeclare exported variable 'pdf'.
609 pdf,
~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:609:3 - error TS2484: Export declaration conflicts with exported declaration of 'pdf'.
609 pdf,
~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:610:3 - error TS2323: Cannot redeclare exported variable 'Document'.
610 Document,
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:610:3 - error TS2484: Export declaration conflicts with exported declaration of 'Document'.
610 Document,
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:611:3 - error TS2323: Cannot redeclare exported variable 'Page'.
611 Page,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:611:3 - error TS2484: Export declaration conflicts with exported declaration of 'Page'.
611 Page,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:612:3 - error TS2323: Cannot redeclare exported variable 'View'.
612 View,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:612:3 - error TS2484: Export declaration conflicts with exported declaration of 'View'.
612 View,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:613:3 - error TS2323: Cannot redeclare exported variable 'Image'.
613 Image,
~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:613:3 - error TS2484: Export declaration conflicts with exported declaration of 'Image'.
613 Image,
~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:614:3 - error TS2323: Cannot redeclare exported variable 'Text'.
614 Text,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:614:3 - error TS2484: Export declaration conflicts with exported declaration of 'Text'.
614 Text,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:615:3 - error TS2323: Cannot redeclare exported variable 'Canvas'.
615 Canvas,
~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:615:3 - error TS2484: Export declaration conflicts with exported declaration of 'Canvas'.
615 Canvas,
~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:616:3 - error TS2323: Cannot redeclare exported variable 'Link'.
616 Link,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:616:3 - error TS2484: Export declaration conflicts with exported declaration of 'Link'.
616 Link,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:617:3 - error TS2323: Cannot redeclare exported variable 'Note'.
617 Note,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:617:3 - error TS2484: Export declaration conflicts with exported declaration of 'Note'.
617 Note,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:618:3 - error TS2323: Cannot redeclare exported variable 'Svg'.
618 Svg,
~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:618:3 - error TS2484: Export declaration conflicts with exported declaration of 'Svg'.
618 Svg,
~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:619:3 - error TS2323: Cannot redeclare exported variable 'Line'.
619 Line,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:619:3 - error TS2484: Export declaration conflicts with exported declaration of 'Line'.
619 Line,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:620:3 - error TS2323: Cannot redeclare exported variable 'Polyline'.
620 Polyline,
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:620:3 - error TS2484: Export declaration conflicts with exported declaration of 'Polyline'.
620 Polyline,
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:621:3 - error TS2323: Cannot redeclare exported variable 'Polygon'.
621 Polygon,
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:621:3 - error TS2484: Export declaration conflicts with exported declaration of 'Polygon'.
621 Polygon,
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:622:3 - error TS2323: Cannot redeclare exported variable 'Path'.
622 Path,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:622:3 - error TS2484: Export declaration conflicts with exported declaration of 'Path'.
622 Path,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:623:3 - error TS2323: Cannot redeclare exported variable 'Rect'.
623 Rect,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:623:3 - error TS2484: Export declaration conflicts with exported declaration of 'Rect'.
623 Rect,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:624:3 - error TS2323: Cannot redeclare exported variable 'Circle'.
624 Circle,
~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:624:3 - error TS2484: Export declaration conflicts with exported declaration of 'Circle'.
624 Circle,
~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:625:3 - error TS2323: Cannot redeclare exported variable 'Ellipse'.
625 Ellipse,
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:625:3 - error TS2484: Export declaration conflicts with exported declaration of 'Ellipse'.
625 Ellipse,
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:626:3 - error TS2323: Cannot redeclare exported variable 'Tspan'.
626 Tspan,
~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:626:3 - error TS2484: Export declaration conflicts with exported declaration of 'Tspan'.
626 Tspan,
~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:627:3 - error TS2323: Cannot redeclare exported variable 'G'.
627 G,
~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:627:3 - error TS2484: Export declaration conflicts with exported declaration of 'G'.
627 G,
~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:628:3 - error TS2323: Cannot redeclare exported variable 'Stop'.
628 Stop,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:628:3 - error TS2484: Export declaration conflicts with exported declaration of 'Stop'.
628 Stop,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:629:3 - error TS2323: Cannot redeclare exported variable 'Defs'.
629 Defs,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:629:3 - error TS2484: Export declaration conflicts with exported declaration of 'Defs'.
629 Defs,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:630:3 - error TS2323: Cannot redeclare exported variable 'ClipPath'.
630 ClipPath,
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:630:3 - error TS2484: Export declaration conflicts with exported declaration of 'ClipPath'.
630 ClipPath,
~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:631:3 - error TS2323: Cannot redeclare exported variable 'LinearGradient'.
631 LinearGradient,
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:631:3 - error TS2484: Export declaration conflicts with exported declaration of 'LinearGradient'.
631 LinearGradient,
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:632:3 - error TS2323: Cannot redeclare exported variable 'RadialGradient'.
632 RadialGradient,
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:632:3 - error TS2484: Export declaration conflicts with exported declaration of 'RadialGradient'.
632 RadialGradient,
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:633:3 - error TS2323: Cannot redeclare exported variable 'Font'.
633 Font,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:633:3 - error TS2484: Export declaration conflicts with exported declaration of 'Font'.
633 Font,
~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:634:3 - error TS2323: Cannot redeclare exported variable 'StyleSheet'.
634 StyleSheet,
~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:634:3 - error TS2484: Export declaration conflicts with exported declaration of 'StyleSheet'.
634 StyleSheet,
~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:635:3 - error TS2323: Cannot redeclare exported variable 'PDFRenderer'.
635 PDFRenderer,
~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:635:3 - error TS2484: Export declaration conflicts with exported declaration of 'PDFRenderer'.
635 PDFRenderer,
~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:636:3 - error TS2323: Cannot redeclare exported variable 'version'.
636 version,
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:636:3 - error TS2484: Export declaration conflicts with exported declaration of 'version'.
636 version,
~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:637:3 - error TS2323: Cannot redeclare exported variable 'renderToFile'.
637 renderToFile,
~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:637:3 - error TS2484: Export declaration conflicts with exported declaration of 'renderToFile'.
637 renderToFile,
~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:638:3 - error TS2323: Cannot redeclare exported variable 'renderToStream'.
638 renderToStream,
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:638:3 - error TS2484: Export declaration conflicts with exported declaration of 'renderToStream'.
638 renderToStream,
~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:639:3 - error TS2484: Export declaration conflicts with exported declaration of 'usePDF'.
639 usePDF,
~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:640:3 - error TS2323: Cannot redeclare exported variable 'PDFViewer'.
640 PDFViewer,
~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:640:3 - error TS2484: Export declaration conflicts with exported declaration of 'PDFViewer'.
640 PDFViewer,
~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:641:3 - error TS2323: Cannot redeclare exported variable 'BlobProvider'.
641 BlobProvider,
~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:641:3 - error TS2484: Export declaration conflicts with exported declaration of 'BlobProvider'.
641 BlobProvider,
~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:642:3 - error TS2323: Cannot redeclare exported variable 'PDFDownloadLink'.
642 PDFDownloadLink,
~~~~~~~~~~~~~~~
node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:642:3 - error TS2484: Export declaration conflicts with exported declaration of 'PDFDownloadLink'.
642 PDFDownloadLink,
~~~~~~~~~~~~~~~
Found 106 errors in the same file, starting at: node_modules/@react-pdf/renderer/lib/react-pdf.d.cts:17
@taylorli2000 - Take a look at #2624, that is most likely your issue
No this is different. When you have export =, that can be the only top-level exported element. This should be resolved by taking the named exports and moving those to be export X inside the ReactPDF namespace. @andrewbranch interestingly, attw doesn't flag that the types here are wrong.