Tag Archives: node

Using External Modules in TypeScript

Joseph DotsonWhen programming in TypeScript, you may need to use existing JavaScript modules. This should be a lot easier than it is. You should be able to just use a require and pass a flag in to let the compiler know that it’s a js library in order to convert it to an Any, however that is not possible.

What actually needs to be done is the creation of a .d.ts file. This file (or files) declares the shape of the module. This includes any functions or interfaces that might be needed used when using the class.

Read more