【发布时间】:2021-07-04 16:06:46
【问题描述】:
所以这里是 authService.ts :
user$: Observable<firebase.User>
constructor(private afAuth: AngularFireAuth) {
this.user$ = afAuth.authState ; //<-------- here's the problem
}```
【问题讨论】:
-
我该如何解决这个错误:错误 TS2322: Type'Observable
-
您需要将 observable 的类型设置为 Observable
因为这是 authstate 的定义方式:github.com/angular/angularfire/blob/master/src/auth/auth.ts#L40
标签: angular typescript firebase-authentication observable angularfire