Typescript Error Property 'members' does not exist on type '{}'
up vote
0
down vote
favorite
This piece of code has been working well until a few days ago when I upgraded angularfire and firebase:
From "angularfire2": "5.0.0-rc.4", to "angularfire2": "^5.1.0",
from "firebase": "4.8.0", to "firebase": "^5.5.7":
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
this.group = group.payload.val();
this.groupMembers = null;
// Get group members
if (group.payload.val().members) {
group.payload.val().members.forEach((memberId) => {
this.dataProvider.getUser(memberId).snapshotChanges().subscribe((member) => {
this.addOrUpdateMember(member);
});
});
// Get user's contacts to add
this.dataProvider.getCurrentUser().snapshotChanges().subscribe((account) => {
if (account.payload.val().contacts) {
//Delete log
console.log('My contacts',account.payload.val().contacts);
for (var i = 0; i < account.payload.val().contacts.length; i++) {
this.dataProvider.getUser(account.payload.val().contacts[i]).snapshotChanges().subscribe((contact) => {
// Only contacts that are not yet a member of this group can be added.
contact = { $key: contact.key, ...contact.payload.val()};
//Delete log
console.log('Is contact',contact,' already added?',this.isMember(contact));
if (!this.isMember(contact))
this.addOrUpdateContact(contact);
});
}
if (!this.contacts) {
this.contacts = ;
}
} else {
this.contacts = ;
}
});
}
this.loadingProvider.hide();
});
This is the getGroup() in the provider:
getGroup(groupId) {
return this.angularfire.object('/groups/' + groupId);
}
It is bringing this error everywhere there is payload.val().someProperty in the project.
typescript
add a comment |
up vote
0
down vote
favorite
This piece of code has been working well until a few days ago when I upgraded angularfire and firebase:
From "angularfire2": "5.0.0-rc.4", to "angularfire2": "^5.1.0",
from "firebase": "4.8.0", to "firebase": "^5.5.7":
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
this.group = group.payload.val();
this.groupMembers = null;
// Get group members
if (group.payload.val().members) {
group.payload.val().members.forEach((memberId) => {
this.dataProvider.getUser(memberId).snapshotChanges().subscribe((member) => {
this.addOrUpdateMember(member);
});
});
// Get user's contacts to add
this.dataProvider.getCurrentUser().snapshotChanges().subscribe((account) => {
if (account.payload.val().contacts) {
//Delete log
console.log('My contacts',account.payload.val().contacts);
for (var i = 0; i < account.payload.val().contacts.length; i++) {
this.dataProvider.getUser(account.payload.val().contacts[i]).snapshotChanges().subscribe((contact) => {
// Only contacts that are not yet a member of this group can be added.
contact = { $key: contact.key, ...contact.payload.val()};
//Delete log
console.log('Is contact',contact,' already added?',this.isMember(contact));
if (!this.isMember(contact))
this.addOrUpdateContact(contact);
});
}
if (!this.contacts) {
this.contacts = ;
}
} else {
this.contacts = ;
}
});
}
this.loadingProvider.hide();
});
This is the getGroup() in the provider:
getGroup(groupId) {
return this.angularfire.object('/groups/' + groupId);
}
It is bringing this error everywhere there is payload.val().someProperty in the project.
typescript
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This piece of code has been working well until a few days ago when I upgraded angularfire and firebase:
From "angularfire2": "5.0.0-rc.4", to "angularfire2": "^5.1.0",
from "firebase": "4.8.0", to "firebase": "^5.5.7":
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
this.group = group.payload.val();
this.groupMembers = null;
// Get group members
if (group.payload.val().members) {
group.payload.val().members.forEach((memberId) => {
this.dataProvider.getUser(memberId).snapshotChanges().subscribe((member) => {
this.addOrUpdateMember(member);
});
});
// Get user's contacts to add
this.dataProvider.getCurrentUser().snapshotChanges().subscribe((account) => {
if (account.payload.val().contacts) {
//Delete log
console.log('My contacts',account.payload.val().contacts);
for (var i = 0; i < account.payload.val().contacts.length; i++) {
this.dataProvider.getUser(account.payload.val().contacts[i]).snapshotChanges().subscribe((contact) => {
// Only contacts that are not yet a member of this group can be added.
contact = { $key: contact.key, ...contact.payload.val()};
//Delete log
console.log('Is contact',contact,' already added?',this.isMember(contact));
if (!this.isMember(contact))
this.addOrUpdateContact(contact);
});
}
if (!this.contacts) {
this.contacts = ;
}
} else {
this.contacts = ;
}
});
}
this.loadingProvider.hide();
});
This is the getGroup() in the provider:
getGroup(groupId) {
return this.angularfire.object('/groups/' + groupId);
}
It is bringing this error everywhere there is payload.val().someProperty in the project.
typescript
This piece of code has been working well until a few days ago when I upgraded angularfire and firebase:
From "angularfire2": "5.0.0-rc.4", to "angularfire2": "^5.1.0",
from "firebase": "4.8.0", to "firebase": "^5.5.7":
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
this.group = group.payload.val();
this.groupMembers = null;
// Get group members
if (group.payload.val().members) {
group.payload.val().members.forEach((memberId) => {
this.dataProvider.getUser(memberId).snapshotChanges().subscribe((member) => {
this.addOrUpdateMember(member);
});
});
// Get user's contacts to add
this.dataProvider.getCurrentUser().snapshotChanges().subscribe((account) => {
if (account.payload.val().contacts) {
//Delete log
console.log('My contacts',account.payload.val().contacts);
for (var i = 0; i < account.payload.val().contacts.length; i++) {
this.dataProvider.getUser(account.payload.val().contacts[i]).snapshotChanges().subscribe((contact) => {
// Only contacts that are not yet a member of this group can be added.
contact = { $key: contact.key, ...contact.payload.val()};
//Delete log
console.log('Is contact',contact,' already added?',this.isMember(contact));
if (!this.isMember(contact))
this.addOrUpdateContact(contact);
});
}
if (!this.contacts) {
this.contacts = ;
}
} else {
this.contacts = ;
}
});
}
this.loadingProvider.hide();
});
This is the getGroup() in the provider:
getGroup(groupId) {
return this.angularfire.object('/groups/' + groupId);
}
It is bringing this error everywhere there is payload.val().someProperty in the project.
typescript
typescript
edited Nov 9 at 11:24
Grimthorr
4,28942035
4,28942035
asked Nov 9 at 7:57
Paul Kitatta
163
163
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Here is how I get the data from firebase.
firebase.database().ref('/MyCustomFolder').once("value").then(snapshot => {
let data = snapshot.val();
console.log(data.customers);
});
I suggest trying the following:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data = group.val();
let payload = data.payload;
if (payload.members) {
/* do something */
}
Thanks @Dmitry for response. But is I change then I get a new error: Typescript Error Property 'members' does not exist on type 'DatabaseSnapshot<{}>'. Property 'members' does not exist on type 'DatabaseSnapshotExists<{}>'.
– Paul Kitatta
Nov 9 at 13:14
@PaulKitatta I think i did a mistake. I edited my answer
– Dmitry Stepanov
Nov 12 at 9:55
it gives new error:Property 'val' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>'.. But I found solution.
– Paul Kitatta
Nov 12 at 11:26
add a comment |
up vote
0
down vote
accepted
This is what I had to do to get it working:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data: any = group.payload.val();
if (data.members) {
/* do something */
}
So apparently I had to include : any. Again, given that is was working before I made the upgrade - the experts will tell us more of the cause.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Here is how I get the data from firebase.
firebase.database().ref('/MyCustomFolder').once("value").then(snapshot => {
let data = snapshot.val();
console.log(data.customers);
});
I suggest trying the following:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data = group.val();
let payload = data.payload;
if (payload.members) {
/* do something */
}
Thanks @Dmitry for response. But is I change then I get a new error: Typescript Error Property 'members' does not exist on type 'DatabaseSnapshot<{}>'. Property 'members' does not exist on type 'DatabaseSnapshotExists<{}>'.
– Paul Kitatta
Nov 9 at 13:14
@PaulKitatta I think i did a mistake. I edited my answer
– Dmitry Stepanov
Nov 12 at 9:55
it gives new error:Property 'val' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>'.. But I found solution.
– Paul Kitatta
Nov 12 at 11:26
add a comment |
up vote
0
down vote
Here is how I get the data from firebase.
firebase.database().ref('/MyCustomFolder').once("value").then(snapshot => {
let data = snapshot.val();
console.log(data.customers);
});
I suggest trying the following:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data = group.val();
let payload = data.payload;
if (payload.members) {
/* do something */
}
Thanks @Dmitry for response. But is I change then I get a new error: Typescript Error Property 'members' does not exist on type 'DatabaseSnapshot<{}>'. Property 'members' does not exist on type 'DatabaseSnapshotExists<{}>'.
– Paul Kitatta
Nov 9 at 13:14
@PaulKitatta I think i did a mistake. I edited my answer
– Dmitry Stepanov
Nov 12 at 9:55
it gives new error:Property 'val' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>'.. But I found solution.
– Paul Kitatta
Nov 12 at 11:26
add a comment |
up vote
0
down vote
up vote
0
down vote
Here is how I get the data from firebase.
firebase.database().ref('/MyCustomFolder').once("value").then(snapshot => {
let data = snapshot.val();
console.log(data.customers);
});
I suggest trying the following:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data = group.val();
let payload = data.payload;
if (payload.members) {
/* do something */
}
Here is how I get the data from firebase.
firebase.database().ref('/MyCustomFolder').once("value").then(snapshot => {
let data = snapshot.val();
console.log(data.customers);
});
I suggest trying the following:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data = group.val();
let payload = data.payload;
if (payload.members) {
/* do something */
}
edited Nov 12 at 9:50
answered Nov 9 at 12:11
Dmitry Stepanov
1766
1766
Thanks @Dmitry for response. But is I change then I get a new error: Typescript Error Property 'members' does not exist on type 'DatabaseSnapshot<{}>'. Property 'members' does not exist on type 'DatabaseSnapshotExists<{}>'.
– Paul Kitatta
Nov 9 at 13:14
@PaulKitatta I think i did a mistake. I edited my answer
– Dmitry Stepanov
Nov 12 at 9:55
it gives new error:Property 'val' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>'.. But I found solution.
– Paul Kitatta
Nov 12 at 11:26
add a comment |
Thanks @Dmitry for response. But is I change then I get a new error: Typescript Error Property 'members' does not exist on type 'DatabaseSnapshot<{}>'. Property 'members' does not exist on type 'DatabaseSnapshotExists<{}>'.
– Paul Kitatta
Nov 9 at 13:14
@PaulKitatta I think i did a mistake. I edited my answer
– Dmitry Stepanov
Nov 12 at 9:55
it gives new error:Property 'val' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>'.. But I found solution.
– Paul Kitatta
Nov 12 at 11:26
Thanks @Dmitry for response. But is I change then I get a new error: Typescript Error Property 'members' does not exist on type 'DatabaseSnapshot<{}>'. Property 'members' does not exist on type 'DatabaseSnapshotExists<{}>'.
– Paul Kitatta
Nov 9 at 13:14
Thanks @Dmitry for response. But is I change then I get a new error: Typescript Error Property 'members' does not exist on type 'DatabaseSnapshot<{}>'. Property 'members' does not exist on type 'DatabaseSnapshotExists<{}>'.
– Paul Kitatta
Nov 9 at 13:14
@PaulKitatta I think i did a mistake. I edited my answer
– Dmitry Stepanov
Nov 12 at 9:55
@PaulKitatta I think i did a mistake. I edited my answer
– Dmitry Stepanov
Nov 12 at 9:55
it gives new error:
Property 'val' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>'.. But I found solution.– Paul Kitatta
Nov 12 at 11:26
it gives new error:
Property 'val' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>'.. But I found solution.– Paul Kitatta
Nov 12 at 11:26
add a comment |
up vote
0
down vote
accepted
This is what I had to do to get it working:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data: any = group.payload.val();
if (data.members) {
/* do something */
}
So apparently I had to include : any. Again, given that is was working before I made the upgrade - the experts will tell us more of the cause.
add a comment |
up vote
0
down vote
accepted
This is what I had to do to get it working:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data: any = group.payload.val();
if (data.members) {
/* do something */
}
So apparently I had to include : any. Again, given that is was working before I made the upgrade - the experts will tell us more of the cause.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
This is what I had to do to get it working:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data: any = group.payload.val();
if (data.members) {
/* do something */
}
So apparently I had to include : any. Again, given that is was working before I made the upgrade - the experts will tell us more of the cause.
This is what I had to do to get it working:
this.dataProvider.getGroup(this.groupId).snapshotChanges().subscribe((group) => {
let data: any = group.payload.val();
if (data.members) {
/* do something */
}
So apparently I had to include : any. Again, given that is was working before I made the upgrade - the experts will tell us more of the cause.
answered Nov 12 at 11:34
Paul Kitatta
163
163
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221792%2ftypescript-error-property-members-does-not-exist-on-type%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown