DEV Community

Discussion on: Converting a JavaScript project to Typescript, one file at a time

Collapse
 
kmcginn profile image
Kevin McGinn

Thanks for an interesting article! :)

I am a little uneasy about your (admittedly untested) suggestion for creating type declaration files for external packages. In my limited npm experience, I assumed it was a best practice for only the npm utility itself to make changes to the node_modules folder; that way, it is easy to retrieve your dependencies from any computer without adding them to source control. To keep the "purity" of the node_modules folder, would it be possible to create a specific folder for external type declaration files and make the TypeScript compiler aware of it?

Collapse
 
suhas_chatekar profile image
Suhas Chatekar

You are spot on. I completely missed on that. Since I have never done such a thing myself before I searched for the best options to deal with this properly and came across this wonderfully written SO answer which does a lot more justice to the problem than what I could have done.

Collapse
 
kmcginn profile image
Kevin McGinn

Wonderful find! Thank you!