I'm trying to loop through an object by doing:
const db = admin.firestore()
const devicesRef = db.collection('devices')
const devices = await devicesRef.get();
devices.forEach(async (result, idx, array) => {
});
But I get an error:
Argument of type '(result: any, idx: any, array: any) => Promise' is not assignable to parameter of type '(result: QueryDocumentSnapshot) => void'.
Which I don't really understand. If I get rid of idx, array
the script works perfectly, but I want to know when the last loop is being performed, which is why I add idx, array
...
Any ideas what the error messages might mean?