首页 文章

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

提问于
浏览
2

我升级到Typescript 2.9.1(从2.8)后我得到编译错误说

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

当我使用typescript 2.7和2.8时,这种情况从未发生过 .

环境:

  • MacOS 10.13.5

  • Node.js v9.11.1

  • NPM:6.1.0

  • Typescript 2.9.1(在我项目的 node_modules 文件夹中,没有全局打字稿)

// 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 回答

  • 1

    只是一个解决方法,我正在使用 skipLibCheck: true 来绕过lib文件中的类型检查,所以's no error. But I still don'知道为什么会在2.9.1中发生这种情况 .

相关问题