Questions tagged «typescript2.1»

4
编写自定义TypeScript定义文件时,出现错误“模块'名称'解析为...处的无类型模块”。
我找不到@type/{name}我已安装的NodeJS包之一的TypeScript定义,所以我尝试为其编写d.ts文件,然后将该文件放在{project root}\typings文件夹中。这是我的方法: // My source code: index.ts import Helper from 'node-helper-lib'; // My definition: \typings\node-helper-lib.d.ts declare....(something else) declare module 'node-helper-lib' { class Helper { ... } export = Helper; } 但是,Visual Studio Code不断产生此错误,并将红线放在下面declare module 'node-helper-lib': [ts]扩充中无效的模块名称。模块'node-helper-lib'解析为'{project path} \ node_modules \ node-helper-lib \ index.js'处的未类型化模块,无法对其进行扩充。 因为该库是无类型的,所以应该允许我在其中添加类型吗? 更新: 我在用: 打字稿:2.1.4 Visual Studio程式码:1.9.1 节点JS:6.9.4 …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.