TypeScript不会忽略node_modules库

时间:2020-03-21 21:07:01

标签: reactjs typescript tsconfig formsy-material-ui

我正在开发一个React项目,React版本15.4.2 ..这是一个现有项目,我需要在相同的React版本上使用它。我也有一个tsconfig文件。我尝试使用react material ui:

npm install material-ui@v1.0.0-beta.47 --save

当我尝试启动服务器时,出现如下错误:

[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14427,101):错误TS1005:')'
预期。 [17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14439,89):错误TS1005:','预期。
[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14451,89):错误TS1005:','预期。
[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14463,65):错误TS1005:'('预期。
[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14463,107):错误TS1005:')'
预期。 [17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14475,74):错误TS1005:','预期。
[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14487,55):错误TS1005:'('预期。
[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14487,92):错误TS1005:')'预期。
[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14499,77):错误TS1005:','预期。
[17:00:59]错误-打字稿-
node_modules \ csstype \ index.d.ts(14512,67):错误TS1005:'('预期。

这是我的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/*"
    ] 
}

我尝试了一切,使用exclude或将es6添加为lib,甚至在tsconfig中使用了空的类型数组。

有什么主意吗?

0 个答案:

没有答案