Search code examples
javascripttypescriptmoduleexternal

How to import an external javascript library in a typescript project


I want to create a small library as an excuse to learn Typescript, but what happens is that I really am not able to import a Javascript library (node-json-equal) to my typescript project. I didn't find a lot on internet that explain clearly how it works, so I bet you to explain me how to solve the problem properly and why is my approach incorrect... well I guess because properly that external library isn't typed.

Project image


Solution

  • I finally found the problem. It wasn't related with my source code, but my dockerfile. Basically I added package-lock.json that was corrupted, so in the end the module wasn't downloaded. I solved adding the package.json instead.