错误TS2339:类型“ {}”上不存在属性“ uid”

时间:2019-11-05 03:13:16

标签: typescript firebase google-cloud-firestore

    if (this.sampleArr.length === 0) {
      this.afs.collection('users', ref => ref.where('displayName', '==', firstLetter))
      .snapshotChanges().subscribe(data => {
        data.forEach(childData => {
          const uid = childData.payload.doc.data();
          const isMember = ((this.groupInfo.superUser.includes(uid.uid))
                          || (this.groupInfo.administrators.includes(uid.uid))
                          || (this.groupInfo.members.includes(uid.uid)));
                      console.log('ismember', isMember);
          if (!isMember) {
            this.sampleArr.push(childData.payload.doc.data());
          }
          console.log('this.sampleArr', this.sampleArr);
        });
      });
    }

我有一个聊天应用程序,它限制了已经属于组的用户的添加。问题在于它抱怨有效载荷childData.payload.doc.data()上的.uid。尽管它可以在离子服务中使用,但由于该问题我无法制造:

enter image description here

uid显示在console.log中,但我无法编译。

任何帮助将不胜感激。

0 个答案:

没有答案