Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49185

Property 'forEach' does not exist on type

$
0
0

Hello, I am trying to fetch data from firestore but getting an error that Property ‘forEach’ does not exist on type ‘DocumentSnapshot’
I’d really appreciate any guidance on fixing this error. Thanks!

const listMemPanel = async () => {
    try {
      let list: members[] = []
      const res = await firebase.firestore().collection('Membership').doc('Subscription').get();
      res.forEach((doc: { data: () => { (): any; new(): any; id: any; name: any; code: any; email: any; }; }) => {
          let obj = {
              id: doc.data().id,
              name:doc.data().name,
              code:doc.data().code,
              email:doc.data().email
          };
          list.push(obj)
      });
      setListMembers(list)
  } catch (error) {}
}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49185

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>