Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularFire2 typings: "Property 'take' does not exist on type 'FirebaseObjectObservable<any>'"

I've updated my ionic app from beta 11 to rc0. So it means I've switched from typescript 1.8 to 2.

I've configured AngularFire2 according to this site Getting Started with Ionic 2 RC0, Firebase 3 + AngularFire 2

I had this line of code working:

this.af.database.object(`comments/${commentId}`).take(1).subscribe({
    data => console.log(data)
});

But now getting this error

error TS2339: Property 'take' does not exist on type 'FirebaseObjectObservable'.

Any ideas on what's going on? How can I solve this?

like image 274
Dee Avatar asked Jan 05 '23 06:01

Dee


1 Answers

For more recents versions of rxjs (v6) and angularfire (v5), the syntax I used is :

import { take } from 'rxjs/operators'

...

this.afAuth.authState.pipe(take(1)).subscribe(user => {
  ...
})
like image 96
Gullfaxi171 Avatar answered Jan 13 '23 09:01

Gullfaxi171