Doing a simple import like this in Visual Studio 2022:
The full message displayed on the IDE is:
TS7016: (TS) Could not find a declaration file for module
‘../../lib/pdf/pdf.mjs’ the file ‘../../lib/pdf/pdf.mjs’ implicilty
has an ‘any’ type
When hovering over the getDocument
function we see only the “any” type and no function definition.
There’s no type definition out of the box. I also tried the NPM types package but it’s been deprecated:
https://www.npmjs.com/package/@types/pdfjs-dist
From this other issue, the last 3 comments also have a similar problem.
Should the types be available out of the box when doing the import call pointing to the latest version [v4.9.155 as of now] of pdf.mjs
file? If not, what steps are missing to get the types available in TypeScript?