When I installed a non popular module that doesn't have a published type declaration under @types
namespace, I'm stuck. I know how to write a declaration file, but I don't know how to make typescript compiler aware of it. The typescript documentation doesn't mention how to do it. The docs only mention to search for type declaration and if not found, publish a new one but doesn't mention how to do it without publishing.
So, say I installed a package named xyz
and I know the public api that it exposes. Then, I write a type declaration file that matches the exposed api. Then, How to make typescript compiler aware of it?
Just add a <module-name>.d.ts
file to your project, and TypeScript should become aware of it automatically. You don't need to import it or anything, just to be in the folders processed by TypeScript
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