【发布时间】:2017-03-23 12:10:08
【问题描述】:
Tsconfig:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true,
"lib": [
"es6",
"dom"
],
"types": [
"hammerjs",
"jasmine",
"node",
"selenium-webdriver",
"webpack",
"core-js",
"google-maps"
]
},
"exclude": [
"node_modules"
"e2e"
],
"include": [
"src/**/*"
],
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"!./node_modules/**/*.ts",
"./src/custom-typings.d.ts"
],
}
执行 tsc 时出现以下错误:
node_modules/@types/core-js/index.d.ts(262,5):错误 TS2687:“标志”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(276,5):错误 TS2687:“EPSILON”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(311,5):错误 TS2687:“MAX_SAFE_INTEGER”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(318,5):错误 TS2687:“MIN_SAFE_INTEGER”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(457,5):错误 TS2403:后续变量声明必须具有相同的类型。变量 '[Symbol.toStringTag]' 必须是 '"Symbol"' 类型,但这里有 'string' 类型。 node_modules/@types/core-js/index.d.ts(457,5):错误 TS2687:'[Symbol.toStringTag]' 的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(464,5):错误 TS2687:“原型”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(492,5):错误 TS2687:“hasInstance”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(498,5):错误 TS2687:“isConcatSpreadable”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(504,5):错误 TS2687:“迭代器”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(510,5): 错误 TS2687:
的所有声明
为什么执行 tsc 命令时不会忽略 node_modules。 我在 2.0.3 版本中使用打字稿
【问题讨论】:
标签: javascript typescript tsc