在VSCode中为节点模块使用自己的打字稿types定义

我目前正在我的项目中实施twilio库。 由于库没有可用的types定义,所以我自己把它们写在一个名为twilio.d.ts的文件中,并把它放在我的主项目中。 我目前的编辑器是VSCode,我没有得到任何forms的twilio模块intellisense。

如果我把这些定义放在文件index.d.tsnode_modules/@types/twilio文件夹中,它就可以工作。 有没有其他方式来告诉打字稿编译器在项目中包含twilio.d.ts并将其与twilio模块关联?

链接到要点: https : //gist.github.com/aksharpatel47/a1b40e61f5759d653187eebfce0c323b

我的tsconfig.json

 { "compilerOptions": { "module": "commonjs", "moduleResolution": "node", "target": "es5", "lib": [ "es2015" ], "sourceMap": true, "strictNullChecks": true, "typeRoots": [ "./custom", "./node_modules/@types" ] }, "exclude": [ "node_modules" ] } 

我的文件夹结构

 - custom - twilio - index.d.ts - node_modules - index.ts - package.json - tsconfig.json