【问题标题】:ShouldJs Typescript issues with promisesShouldJs Typescript 与 Promise 有问题
【发布时间】:2018-07-20 20:11:30
【问题描述】:

只有在尝试使用 .rejected() / .fufilled() 语法时,我才在使用 shouldjs 的 typescript 中遇到编译错误

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(&lt;PromisedAssertion&gt;Promise.resolve())(Promise.resolve() as PromisedAssertion) 无效。我该如何解决这个问题?

.should 否则工作正常

【问题讨论】:

标签: typescript promise should.js


【解决方案1】:

针对 should repo 创建了一个问题,同时转换为 any 工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-09
    • 1970-01-01
    • 2019-09-25
    • 2018-02-09
    • 2021-08-29
    • 1970-01-01
    • 2020-03-21
    • 2016-08-27
    相关资源
    最近更新 更多