打字稿-重复的标识符“ beforeEach”

时间:2018-07-23 20:13:13

标签: typescript create-react-app

我刚刚尝试使用create-react-app(1.5.2)引导新项目

create-react-app test-ts --scripts-version=react-scripts-ts

在不碰任何东西的情况下,我“开始纱线”,我得到了以下信息:

<project root>/node_modules/@types/jest/index.d.ts
(23,13): Duplicate identifier 'beforeEach'.

当我放

'skipLibCheck': true

在tsconfig.json中,所有代码都可以毫无问题地进行编译。

我显然在另一台ubuntu机器上尝试过,并且在没有'skipLibCheck'的情况下也可以正常工作:在tsconfig.json中为true

我已经尝试使用新版本的node和npm,已经尝试了

rm -rf ./node_modules
(npm|yarn) install

错误仍然存​​在。 您认为可能有什么问题?

这是我的tsconfig.json:

{
   "compilerOptions": {
       "baseUrl": ".",
       "outDir": "build/dist",
       "module": "esnext",
       "target": "es5",
       "lib": ["es6", "dom"],
       "sourceMap": true,
       "allowJs": true,
       "jsx": "react",
       "moduleResolution": "node",
       "rootDir": "src",
       "forceConsistentCasingInFileNames": true,
       "noImplicitReturns": true,
       "noImplicitThis": true,
       "noImplicitAny": true,
       "strictNullChecks": true,
       "suppressImplicitAnyIndexErrors": true,
       "noUnusedLocals": true
  },
  "exclude": [
      "node_modules",
      "build",
      "scripts",
      "acceptance-tests",
      "webpack",
      "jest",
      "src/setupTests.ts"
  ]
}

0 个答案:

没有答案