0👍
It’s strange that the solution you linked didn’t work for you, but you could try asserting the type using the as
keyword.
Also, you should move the data id assignment into the if statement, otherwise you risk getting the error Cannot set property 'id' of undefined
at runtime:
if (commentaires) {
commentaires.id = data.id;
this.postComments.push(commentaires as DocumentData);
}
0👍
i found solution :
here the change :
async viewPost ({ state, commit }, post: { id?: any }): Promise<void> {
const postComments: firebase.firestore.DocumentData[] = []
const allCommentaires = await commentsCollection.where('postId', '==', post.id).get()
if (allCommentaires) {
allCommentaires.forEach(data => {
const commentaires = data.data()
commentaires.id = data.id
if (commentaires !== undefined) {
postComments.push(commentaires)
}
})
}
},
- [Vuejs]-How to use vuetify to send pdf/word document to .net core api
- [Vuejs]-Unit test with jest involving a class instance declared within a vue method
Source:stackexchange.com