Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

typescript tsc is not excluding @types/corejs

Tags:

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"
],

}

When executing tsc I get following errors:

node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers. node_modules/@types/core-js/index.d.ts(276,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers. node_modules/@types/core-js/index.d.ts(311,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers. node_modules/@types/core-js/index.d.ts(318,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers. node_modules/@types/core-js/index.d.ts(457,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'. node_modules/@types/core-js/index.d.ts(457,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers. node_modules/@types/core-js/index.d.ts(464,5): error TS2687: All declarations of 'prototype' must have identical modifiers. node_modules/@types/core-js/index.d.ts(492,5): error TS2687: All declarations of 'hasInstance' must have identical modifiers. node_modules/@types/core-js/index.d.ts(498,5): error TS2687: All declarations of 'isConcatSpreadable' must have identical modifiers. node_modules/@types/core-js/index.d.ts(504,5): error TS2687: All declarations of 'iterator' must have identical modifiers. node_modules/@types/core-js/index.d.ts(510,5): error TS2687: All declarations of

Why node_modules are not ignored when executing tsc command. I am using typescript in 2.0.3 version

like image 718
Jerzy Gruszka Avatar asked Nov 09 '16 15:11

Jerzy Gruszka


1 Answers

Your tsconfig.json file lists core-js in the "types" property. This instructs the compiler to include node_module\@types\core-js. if you do not need it remove that entry.

See http://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types for more details about @types, and types in tsconfig.json.

like image 87
mohamed hegazy Avatar answered Oct 30 '22 06:10

mohamed hegazy