TypeScript Microservices
上QQ阅读APP看书,第一时间看更新

Using the dts-gen tool

This is an open sourced utility provided by Microsoft. We will use it to generate our typings for any project. Shoot up a Terminal as Admin or use sudo su - and enter the following:

npm install -g dts-gen

For all global modules, we will use the command prompt as Admin for Windows, and for Linux/Mac we will use the root user or sudo su -

We will use one globally available module and generate its typing. Install lusca and generate its typing using the following command:

dts-gen -m lusca

You should see output such as Wrote 83 Lines to lusca.d.ts, and when you check, you can see all method declarations there, just like an interface.