提问者:小点点

升级到Typescript 2.9.1后出现“TS2300:重复标识符'Account'”错误


在我升级到Typescript 2.9.1(从2.8升级到2.8)后,我遇到了编译错误:

node_modules/typescript/lib/lib.es2017.full.d.ts:33:11 - error TS2300: Duplicate identifier 'Account'.

当我使用Typescript2.7和2.8时,这种情况从来没有发生过。

环境:

  • MacOS 10.13.5
  • node.js v9.11.1
  • NPM:6.1.0
  • typescript 2.9.1(在我的项目的node_module文件夹中,没有全局typescript)
// tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es2017",
    "noImplicitAny": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "ts-build",
    "baseUrl": ".",
    "paths": {
      "kernel/*": [
        "./server/kernel/*"
      ]
    },
    "rootDir": ".",
    "allowJs": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "types": [],
    "keyofStringsOnly": true
  },
  "include": [
    "server/**/*",
    "app.*.js"
  ],
  "exclude": [
    "node_modules"
  ]
}

共1个答案

匿名用户

只是一个解决办法,我使用skiplibcheck:true绕过lib文件中的类型检查,这样就不会出现错误。但我仍然不知道为什么会在2.9.1中发生这种情况。