How to use Mocha and Jest with TypeScript without conflicts?

前端 未结 2 1084
挽巷
挽巷 2021-02-20 03:19

I\'m trying to install Mocha and Jest with types on one project. We use strict typecheck, so I get errors related to conflicting globals type.

I\'ve tried to create ambi

2条回答
  •  长情又很酷
    2021-02-20 04:01

    As of August 2019, this appears to have been fixed on master, but a new version has not been released yet.

    In the meantime, I was able to address these errors by adding the following to one of my definitions:

    declare module '@jest/types/build/Global' {
      interface DescribeBase extends mocha.SuiteFunction {}
      interface ItBase extends mocha.TestFunction {}
    }
    

提交回复
热议问题