
Tsc version 2.4.2, node 8.5, and npm 5.3. NET CLI PackageReference Paket CLI Script & Interactive Cake Install-Package -Version 0.0.5 README Frameworks Dependencies Used By Versions TypeScript Definitions (d.ts) for pdfkit.
I've tried adding /// above the import line. dotnet add package -version 0.0.2They change the generated code sometimes, but none of them change it to contain the needed import. I've tried various values for module in my tsconfig. I've verified that the pdjs-dist dependency, and the dependencies are present, updated, and usable directly from NodeJS (non-TypeScript programs). Switching to require also doesn't seem to help. I've tried different variations on import, to no avail. How can I import PDF.JS into a TypeScript project and compile it into working Node.JS code via the declaration files in I've Tried It's not compiling the import statement into anything.

Just require the pdfkit module in your JavaScript source file and create an instance of the PDFDocument class. It doesn't think PDFJS is ever initialized, but if I turn off strict in tsconfig, the code compiles, but it compiles to: "use strict" Creating a PDFKit document is quite simple. TypeScript finds the type declarations module, and considers the import of PDFJSStatic to be valid.

PDFJS.getDocument('helloworld.pdf').then(console.log) This is the simplified (deletions only) code I'm trying to compile (an exact copy of the test code from DefinitelyTyped also fails in the same way): import from 'pdfjs-dist' I'm using source code copied straight from the tests on DefinitelyTyped. I can't seem to get TypeScript to compile my project.
#Pdfkit typescript install
I'm using the DefinitelyTyped bindings for pdfjs-dist, installed via npm install and npm install pdfjs-dist. I'm trying to import PDF.JS into a TypeScript project.
