Javascript 模块';ng';没有导出的成员';用户界面';使用typescript的ui路由器类型定义时
我正在尝试将此typescript定义文件用于Javascript 模块';ng';没有导出的成员';用户界面';使用typescript的ui路由器类型定义时,javascript,angularjs,typescript,webstorm,Javascript,Angularjs,Typescript,Webstorm,我正在尝试将此typescript定义文件用于ui路由器: 以下是定义文件顶部的代码: // Type definitions for Angular JS 1.1.5+ (ui.router module) // Project: https://github.com/angular-ui/ui-router // Definitions by: Michel Salib <https://github.com/michelsalib> // Definitions: https
ui路由器
:
以下是定义文件顶部的代码:
// Type definitions for Angular JS 1.1.5+ (ui.router module)
// Project: https://github.com/angular-ui/ui-router
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare module ng.ui {
interface IState {
...
这是在Visual Studio中工作的,但现在使用WebStorm时,我收到一条消息说“
模块“ng”没有导出的成员“ui”
有人能给我一些建议吗?这与WebStorm的不同模块系统有关吗?您是否尝试过在模块源文件中添加参考注释?类似于
/// <reference path="path/to/angular-ui/angular-ui-router.d.ts" />
//
Visual Studio不需要这样做,因为它的msbuild任务会自动告诉编译器引用项目中包含的任何定义。我猜WebStorm不使用msbuild项目文件
npm安装@types/angular ui引导程序
编译器选项
中,查找类型
数组。尝试删除类型
或替换为类型根
。类似如下:
“编译器选项”:{
“目标”:“ES5”,
“源地图”:正确,
....
....
“类型根”:[
“节点\模块/@类型”
]
},
可能有点离题,但您知道如何查看msbuild执行引用的位置吗?请使用文本编辑器(它是xml文件)打开项目文件,或仅从Visual Studio中项目的上下文菜单中编辑项目文件。Hanks安装类型为我做了这件事。
/// <reference path="path/to/angular-ui/angular-ui-router.d.ts" />