仅在尝试使用.rejected() / .fufilled()
语法时,我才应该在应该使用typejs的打字稿中出现编译错误
Promise.resolve().should // is fine, is an Assertion
Promise.resolve().should.rejected // is fine, is a Function
Promise.resolve().should.rejected() // TS2349 Cannot invoke expression whose type lacks a call signature. Type Promise<any> has no compatible call signatures
我试图像这样强制转换为PromisedAssertion
:(<PromisedAssertion>Promise.resolve())
或(Promise.resolve() as PromisedAssertion)
无效。我该如何解决?
.should
可以正常工作
答案 0 :(得分:0)
在应该转换为any
的同时,创建了针对应回购的问题