IntelliJ无法识别打字稿命名的模块声明

时间:2015-04-15 16:21:15

标签: intellij-idea typescript

我的模块名称需要采用某种格式。我这样做时打字稿很好:

// knockout interfaces, this is knockout.d.ts
declare var ko: KnockoutStatic;
declare module "core!lib/knockout" {
    export = ko;
}

然后在我使用它的文件中:

import ko = require('core!lib/knockout');
但是,IntelliJ并不喜欢它。它说"找不到外部模块&core!lib / knockout'。我使用的是最新的稳定版本(14.1),内置的1.4编译器和自定义编译器会发生这种情况。

我想这可能是Jetbrains的错误?

1 个答案:

答案 0 :(得分:1)

如果使用import语句将其添加到文件中,则错误可能会消失

/// <reference path="test.ts" />

我认为真正的问题是配置不完全正确。配置根是正确的还是您可能正在使用版本控制?

链接中的相关位:

From the Scope drop-down list, choose the scope to apply the compiler in. The available options are: – Project Files: all the files within the project content roots (see Content Root and Configuring Content Roots). 
– Project Production Files: all the files within the project content roots excluding test sources. 
– Project Test Files: all the files within the project test source roots. 
– Open Files: all the files that are currently opened in the editor. 

VCS Scopes: these scopes are only available if your project is under version control. 
– Changed Files: all changed files, that is, all files associated with all existing changelists. 
– Default: all the files associated with the changelist 

请参阅https://www.jetbrains.com/idea/help/transpiling-typescript-to-javascript.html