Using .length in typescript ionic

Greetings members, i have been trying to retrieve a particular user profile from Firebase using users:users:FirebaseListObservable<any[]>;
.
.
.
Then the loop through the users in firebase using for loop

getByID(key){
    for(var i=0; i<(this.users).length; i++){
        if(this.users[i].key == key){
            return Promise.resolve(this.users[i])
        }

    }
}

using this loop, i got error on the line for for(var i=0; i<(this.users).length; i++) complaining about “[ts] Property ‘length’ does not exist on type ‘FirebaseListObservable<any[]>’.” what could be the issue, i am using Ionicv2 typescriptPreformatted text

maybe try to write this without (...)?

I tried without the brackets but the error still remains

try to console.log(this.users) and console.log(this.users) , show us what it show

1 Like