Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 模块';ng';没有导出的成员';用户界面';使用typescript的ui路由器类型定义时_Javascript_Angularjs_Typescript_Webstorm - Fatal编程技术网

Javascript 模块';ng';没有导出的成员';用户界面';使用typescript的ui路由器类型定义时

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

我正在尝试将此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://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包

    npm安装@types/angular ui引导程序

  • 检查tsConfig.json文件,在
    编译器选项
    中,查找
    类型
    数组。尝试删除
    类型
    或替换为
    类型根
    。类似如下:

    “编译器选项”:{
    “目标”:“ES5”,
    “源地图”:正确,
    ....
    ....
    “类型根”:[
    “节点\模块/@类型”
    ]
    },


  • 可能有点离题,但您知道如何查看msbuild执行引用的位置吗?请使用文本编辑器(它是xml文件)打开项目文件,或仅从Visual Studio中项目的上下文菜单中编辑项目文件。Hanks安装类型为我做了这件事。
    /// <reference path="path/to/angular-ui/angular-ui-router.d.ts" />