Attach (recommended) or Link to PDF file here:
Configuration:
Steps to reproduce the problem:
npm install pdfjs-dist --save
npm install @types/pdfjs-dist --save-dev
*.ts
file: import { PDFJS } from 'pdfjs-dist';
getDocument
from PDFJS
: PDFJS.getDocument('my.pdf')
What is the expected behavior?
PDFJS works on typescript
What went wrong?
PDFJS can't export correctly the lib on typescript
Link to a viewer:
not disponible
Work around:
Import PDFJS in this way
import { PDFJSStatic } from 'pdfjs-dist';
const PDFJS: PDFJSStatic = require('pdfjs-dist');
2\. Install **@types/pdfjs-dist** with: `npm install @types/pdfjs-dist --save-dev`
Most likely, those types haven't been updated to handle PDF.js versions above 2.0
.
However please note that that's a different library, which is not maintained here, hence this issue is unfortunately out-of-scope/invalid here.
@Snuffleupagus @timvandermeij Could you please reopen? @types/pdfjs-dist
is totally off for version >= 2 and the Github repository does not have any issue tracker.
Install @types/pdfjs-dist with:
npm install @types/pdfjs-dist --save-dev
As mentioned in https://github.com/mozilla/pdf.js/issues/10547#issuecomment-462675381, those are not in any way affiliated with Mozilla or the PDF.js project.
@types/pdfjs-dist
Again this is not related to https://github.com/mozilla/pdfjs-dist, but most likely you're actually referring to these ones: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pdfjs-dist
@types/pdfjs-dist
should be maintained by mozilla/pdfjs-dist
and/or mozilla/pdf.js
contributors.
Only this contributors know the code and the functions and can write the required interfaces.
There are already open issues and even PRs for this, but so far the real demand for this is low and the PRs have not really been updated. If you think this is in fact important, please consider updating the existing PRs (such as #10575 which seems like a good approach since it attempts to generate it from the code itself) so they can be brought in a mergeable state.
Does pdfjs provide it's own Typescript types somewhere else?
why is this close? Where are the types provided and how can we include the library into a typescript project? Thank you
Duplicate of #7909 and that was fixed just yesterday.
Most helpful comment
Does pdfjs provide it's own Typescript types somewhere else?