4

我有错误:Subsequent variable declarations must have the same type

发生这种情况是因为我需要两个依赖项;声明相同的类型。

开玩笑/node_modules/@types/jest/index.d.ts=>declare var test: jest.

测试咖啡馆 node_modules/testcafe//ts-defs/index.d.ts=>declare var test: TestFn;

我的项目是一个使用 webpack、babel 和 Typescript 的 react/redux 项目。

当我通过npm start它运行我的开发服务器时发生错误webpack-dev-server。它在我运行时也会产生问题,jest因为它使用了 testcafe 的声明Test类型版本。

如何解决?

4

1 回答 1

1

根据此处的讨论:https ://github.com/DevExpress/testcafe/issues/1537

您可以排除 TestCafe 在本地文件中查找的端到端测试tsconfig.json文件。

这是一个黑客,但它对我有用。

示例tsconfig.json文件,假设您所有的端到端测试模块都在test/e2e

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "sourceMap": true,
    "strict": true,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true
  },
  "exclude": [
    "test/e2e"
  ]
}
于 2018-08-15T19:43:18.610 回答