【发布时间】:2017-01-02 02:36:39
【问题描述】:
在针对 ES6 时,我遇到了一些 TS2300 重复标识符错误。
node_modules/typescript/lib/lib.es6.d.ts(17,14): error TS2300: Duplicate identifier 'PropertyKey'.
node_modules/typescript/lib/lib.es6.d.ts(26,5): error TS2300: Duplicate identifier '[Symbol.toStringTag]'.
node_modules/typescript/lib/lib.es6.d.ts(33,5): error TS2300: Duplicate identifier 'prototype'.
node_modules/typescript/lib/lib.es6.d.ts(61,5): error TS2300: Duplicate identifier 'hasInstance'.
这是我的tsconfig.json。
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": false,
"sourceMap": true,
"target": "es6",
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"node_modules"
]
}
我不确定为什么编译器在排除 node_modules 目录中的任何内容时仍然会抛出错误。我遵循了this 的建议,仍然出现同样的错误。
FWIW 我正在使用此命令进行编译。
./node_modules/.bin/tsc -p ./src
这似乎在使用 v2 beta 时有效。但是很高兴知道为什么使用 v1.8 会失败。我在 GitHub 上找不到任何报告的错误。
我错过了什么?
【问题讨论】: