我想使用Chai作为断言库而不是Jest。我使用的是typescript,我想用Chai期望的类型替换全局Jest。
我尝试做类似的事情:
import chai from "chai";
type ChaiExpect = typeof chai.expect;
declare global {
export const expect: ChaiExpect;
}
global.expect = chai.expect;
但打字稿抱怨是因为:
Cannot redeclare block-scoped variable 'expect'.ts(2451)
index.d.ts(39, 15): 'expect' was also declared here.
如何覆盖jest的index.d.ts
中声明的类型?