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
Import pdf.js with typescript #10547
Comments
Most likely, those types haven't been updated to handle PDF.js versions above |
@Snuffleupagus @timvandermeij Could you please reopen? |
As mentioned in #10547 (comment), those are not in any way affiliated with Mozilla or the PDF.js project.
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 |
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. |
@timvandermeij not duplicated. #7909 about other troubles. But here asked about instructions to include library into a typescript project. |
The following works.
Also it doesn't hurt to have a file, "pdfjs-dist.d.ts":
|
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
fromPDFJS
: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
The text was updated successfully, but these errors were encountered: