Dan
Dan

Reputation: 49

TypeScript is not ignoring node_modules library

I am working on a react project, react version 15.4.2 .. it's an existing project and I need to have it on the same react version. I also have a tsconfig file. I tried to use react material ui:

npm install [email protected] --save

When I try to start the server, I get errors such as:

[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14427,101): error TS1005: ')'
expected. [17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14439,89): error TS1005: ',' expected.
[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14451,89): error TS1005: ',' expected.
[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14463,65): error TS1005: '(' expected.
[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14463,107): error TS1005: ')'
expected. [17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14475,74): error TS1005: ',' expected.
[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14487,55): error TS1005: '(' expected.
[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14487,92): error TS1005: ')' expected.
[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14499,77): error TS1005: ',' expected.
[17:00:59] Error - typescript -
node_modules\csstype\index.d.ts(14512,67): error TS1005: '(' expected.

Here's my tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "forceConsistentCasingInFileNames": true,
    "module": "commonjs",
    "jsx": "react",
    "declaration": true,
    "sourceMap": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "typeRoots": [
      "./node_modules/@types"
    ],
    "types": [

    ],
    "lib": [
      "es5",
      "es6",
      "dom",
      "es2015.collection"
    ]
  },
  "exclude": [
    "./node_modules/*"
    ] 
}

I tried everything, using exclude, or adding es6 as a lib, and even using an empty types array in tsconfig.

Any idea?

Upvotes: 4

Views: 505

Answers (0)

Related Questions