JetBrains TypeScript 检查器和 d.ts 参考资料

JetBrains TypeScript inspector & d.ts references

有一个由 Grunt 编译的 TypeScript 项目。

我还使用 JetBrains WebStorm 作为 IDE 及其 TypeScript 检查器。

问题 - 它与包含的

一起工作不正确
<reference path="Declarations.d.ts" />

Grunt 编译需要该引用,但检查器不将其识别为定义,我在 d.ts 和 TS 模块中遇到了很多错误:

Duplicate identifier ClassName

如何解决?

尝试使用 tsconfig 文件,但在我的情况下无法使用它。

Webstorm 对 TS 使用 <reference path> 指令,就像编译器一样:) 这是预期的且完全有效的行为。排除 tsconfig.json 中引用的文件确实没有帮助,因为还包括从包含文件中明确引用的文件。见 http://www.typescriptlang.org/docs/handbook/tsconfig-json.html : Any files that are referenced by files included via the "files" or "include" properties are also included. Similarly, if a file B.ts is referenced by another file A.ts, then B.ts cannot be excluded unless the referencing file A.ts is also specified in the "exclude" list.