代码之家  ›  专栏  ›  技术社区  ›  Duiz

JetBrains TypeScript检查器和d.ts参考

  •  0
  • Duiz  · 技术社区  · 6 年前

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

    此外,我还将JetBrains WebStorm用作IDE及其“TypeScript检查器”。

    问题-它与包含的不正确工作

    <reference path="Declarations.d.ts" />
    

    Grunt编译需要该引用,但inspector不认为它是定义,而且我在d.ts和ts模块中遇到了大量错误:

    标识符类名重复

    如何解决?

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

    1 回复  |  直到 6 年前
        1
  •  1
  •   lena    6 年前

    Webstorm使用 <reference path> TS的指令包括,就像编译器所做的那样:)这是预期的且完全有效的行为。并排除中的引用文件 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.