【发布时间】:2017-11-04 13:39:21
【问题描述】:
我不能声明函数,它返回承诺给Derivable。原因是下一个:
interface Some {
then(callback);
}
// Error: the return type of an async function must either be a valid promise or must not contain a callable 'then' member.
async function foo(): Promise<Some> {
return null;
}
这是打字稿中的错误吗?有任何解决方法吗?因此我不能使用 async/await。
【问题讨论】:
标签: typescript asynchronous promise async-await