TypeScript编译器(tsc)没有排除@types/corejs

5

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: “flags”的所有声明必须具有相同的修饰符。 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: “prototype”的所有声明必须具有相同的修饰符。 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: “iterator”的所有声明必须具有相同的修饰符。 node_modules/@types/core-js/index.d.ts(510,5): 错误TS2687:

为什么执行tsc命令时,node_modules不会被忽略掉? 我正在使用2.0.3版本的typescript。

1个回答

4

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接