How to get types for pdfjs-express to integrate it with typescript

PDF.js Express Version


Detailed description of issue
We need to integrate pdfjs-express into our typescript reactjs project. Looking through the docs it should work. But actually it seems that types are missing. Btw, we have found that pdftron get them (here pdfjs-express is enough for us). Probably, there are some instructions we should follow?

Expected behaviour
pdfjs-express integration with typescript react js

Link to document

Code snippet
Could not find a declaration file for module ‘@pdftron/pdfjs-express’. ‘…/node_modules/@pdftron/pdfjs-express/webviewer.min.js’ implicitly has an ‘any’ type.
Try npm install @types/pdftron__pdfjs-express if it exists or add a new declaration (.d.ts) file containing declare module '@pdftron/pdfjs-express';ts(7016)


PDF.js Express does not currently ship with Typescript definitions.

However, it has the exact same API as PDFTron WebViewer so you could snag those type defs from the that download package and use them with express (i’m not entirely sure how this would work but i’m sure its possible). If you do do this just be aware there might be some APIs documented that don’t exist in Express.

We plan to ship its own typescript definitions in the future.


1 Like

+1 For getting Typescript definitions integrated.