【问题标题】:Got "TS2300: Duplicate identifier 'Account'" error after upgraded to Typescript 2.9.1升级到 Typescript 2.9.1 后出现“TS2300: Duplicate identifier 'Account'”错误
【发布时间】:2018-11-14 14:20:05
【问题描述】:

在我升级到 Typescript 2.9.1(从 2.8)后,我得到了编译错误提示

node_modules/typescript/lib/lib.es2017.full.d.ts:33:11 - 错误 TS2300:重复的标识符“帐户”。

这在我使用 typescript 2.7 和 2.8 时从未发生过。

环境:

  • MacOS 10.13.5
  • Node.js v9.11.1
  • NPM:6.1.0
  • Typescript 2.9.1(在我项目的 node_modules 文件夹中,没有全局 typescript)
// tsconfig.json { “编译器选项”:{ “模块”:“commonjs”, “目标”:“es2017”, “noImplicitAny”:是的, "moduleResolution": "节点", “源地图”:是的, "outDir": "ts-build", "baseUrl": ".", “路径”:{ “核心/*”: [ “./服务器/内核/*” ] }, "rootDir": ".", “allowJs”:是的, “类型根”:[ “node_modules/@types” ], “emitDecoratorMetadata”:真, “experimentalDecorators”:是的, “类型”:[], “keyofStringsOnly”:真 }, “包括”: [ “服务器/**/*”, “应用程序。*.js” ], “排除”: [ “节点模块” ] }

【问题讨论】:

    标签: typescript


    【解决方案1】:

    只是一种解决方法,我使用 skipLibCheck: true 绕过 lib 文件中的类型检查,因此没有错误。但是我仍然不知道为什么会在 2.9.1 中发生这种情况。

    【讨论】:

      猜你喜欢
      • 2016-01-02
      • 2017-07-14
      • 2013-09-07
      • 2020-01-19
      • 2014-10-06
      • 1970-01-01
      • 2021-09-26
      • 2011-06-23
      • 2013-11-04
      相关资源
      最近更新 更多