6
我试图使用由angular-cli生成的项目将firebase.Promise
转换为Observable
。Firebase:firebase.Promise <any>与Rxjs Promise的兼容性<any>
Here据说firebase.Promise
与Native Promise
和Promise/A+
兼容。
但是,当我尝试使用rxjs的Observable.fromPromise()
方法时出现错误。
Argument of type 'firebase.Promise<any>' is not assignable to parameter of type 'Promise<any>'.
Types of property 'then' are incompatible.
Type '(onResolve?: (a: any) => any, onReject?: (a: Error) => any) => Promise<any>' is not assignable to type '{ <TResult1, TResult2>(onfulfilled: (value:
any) => TResult1 | PromiseLike<TResult1>, onrejected:...'.
Type 'firebase.Promise<any>' is not assignable to type 'Promise<any>'.
它实际上是工作,但有错误是烦人,如何避免在一个干净的方式这个错误的任何想法?
谢谢。
您使用的打字稿? – martin
是的,我正在使用TS – Thib