i changed the code to:
this.itemsCollection = this.afs.collection('posts', ref => ref.orderBy('createdDate', 'desc'));
this.items = this.itemsCollection.snapshotChanges().pipe(
map(actions => actions.map(a => {
const data = a.payload.doc.data() as Item;
const id = a.payload.doc.id;
return { id, ...data };
}))
);
and it worked perfectly.