Pelle Jacobs Pelle Jacobs - 3 months ago 14
TypeScript Question

How to add declaration file to package that depends on external declaration file

I am writing a library that depends on another package that does not have a declaration file in it's npm package. Therefore, I install the proper declaration file with typings, and all is well.

However, how do publish my library so that anyone installing it, does not have to worry about the type dependencies?

If you publish a declaration with on the typings registry, this is not a problem, as typings generates a new declaration file that handles the dependencies for you.

Take eg. I would want to move the typescript typings of react-notification-system to the react-notification-system repo. However, the typings depend on the installed typings of react. How would I exactly go about to add these typings to the repo?

Answer

After some science, I think I figured it out using typings bundle. The full explanation can be found in this answer.