Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property 'take' does not exist on type 'FirebaseObjectObservable<any>'

I'm getting a typescript compilation error when using angularfire2:

Property 'take' does not exist on type 'FirebaseObjectObservable'

I'm importing the take operator from rxjs so this question doesn't help: AngularFire2 typings: "Property 'take' does not exist on type 'FirebaseObjectObservable<any>'"

Imports:

import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { AngularFire, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2';
import { Subscription } from 'rxjs';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/throttleTime';
import 'rxjs/add/operator/take';

Code that causes error:

this.af.database.object(`/xyz`).take(1);

Compiles if I cast to 'any':

var test: any = this.af.database.object(`/xyz`);
test.take(1);

Versions:

"typescript": "^2.1.4"  
"rxjs": "^5.0.3"
"angularfire2": "^2.0.0-beta.6-preview"

I also tested and using 'take' on an rxjs Observable works fine. Since FirebaseObjectObservable extends Observable it should also work fine. Any ideas why typescript is giving me an error here?

like image 305
Will Avatar asked Oct 30 '22 14:10

Will


1 Answers

Updating to angularfire2 2.0.0-beta.7.1-pre and doing a clean npm install fixed the issue.

like image 52
Will Avatar answered Nov 15 '22 14:11

Will