1
当目标ES6时,我收到许多TS2300重复标识符错误。从tsconfig中排除node_modules目录仍在编译
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测试版。但很高兴知道为什么它使用v1.8失败。我在GitHub上找不到任何报告的错误。
我错过了什么?
这是否意味着使用当前稳定的TypeScript编译器无法定位ES6? – onetwothree
@onetwothree FWIW,TypeScript 2.0现已发布。 – MEMark