I am new to TypeScript and I am simply trying to create a type definition for a pdf file and cannot locate any resources on how to do so. I am getting this warning where I import the file "Cannot find module <file_name.pdf> or its corresponding type declarations."
I would like to avoid changing my tsconfig.json file.
Thanks.
Rather than modifying the NPM package you can simply modify the tsconfig.js to add a custom typing, which is considerably more future-proof than the accepted solution.
Create the typings file in your src directory named: types.d.ts (or whatever). Insert:
declare module "*.pdf";
add this to your tsconfig:
"compilerOptions": {
"typeRoots": ["./src/types"]
....
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With