).asPromise()/** no "then" here, just the static methods from Bluebird, like Bluebird.all */无论如何,我可以提示asPromise 方法从返回实例方法(然后,捕捉,最后,减少,超时等等),而不必手动扩展 RequestHandle 接口?。: T | PromiseLike<T>) => void, reject: (reason?: any) => void) =>
一些库提供Thenable接口类型f.e。。
我对他们有些不太了解。Type 'Thenable<U>' is not assignable to type 'U | PromiseLike<U>'.Type 'Thenable<U>' is not assignable to type 'PromiseLike<U>'.: ((value: U) => TResult1 | PromiseLike<
这是另一个Node.js承诺实现,但这是用TypeScript编写的,它力求类型安全和清晰。整个项目位于这里。请随意下载并测试它。function isPromiseLike<T>(x: any): x is PromiseLike<T> {
return x != null && (<PromiseLike<T>>x).then !: T | PromiseLike<T>) => void, reject: (reason?: T
Type 'Promise<WriteResult>' is not assignable to type 'PromiseLike<void>'.: ((value: WriteResult) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((value: void) => TResult1 | PromiseLike<TResult1>) | n