I'm programming in nodejs using typescript.
I'm using pdfmake and I installed typescript definition files for this library (@types/pdfmake)
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pdfmake/index.d.ts
I'm importing one of the enums from this file
import { PageSize } from "pdfmake/build/pdfmake";
and using it like this PageSize.A4
This compiles, but when I try to access value A4 of this enum, runtime error occurs
TypeError: Cannot read property 'A4' of undefined
Any help would be greatly appreciated
package.json:
{
"name": "nodejs-pdf-make",
"version": "1.0.0",
"description": "",
"main": "dist/app.js",
"scripts": {
"start": "tsc && node --inspect dist/app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/express": "^4.17.1",
"tslint": "^5.19.0",
"typescript": "^3.6.2"
},
"dependencies": {
"@types/pdfmake": "^0.1.8",
"express": "^4.17.1",
"pdfmake": "^0.1.58"
}
}
tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist"
},
"lib": ["es2015"]
}```