I've been struggling to find a solution to my issue: Ts gives me an error:
Argument of type 'DocumentData' is not assignable to parameter of type 'never'
I attempted the solution I found on this page: Argument of type 'DocumentData | undefined' is not assignable to parameter of type 'DocumentData'
but it doesn't seem to be working.
Here is my function:
async viewPost (post: { id?: unknown }) {
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) {
this.postComments.push(commentaires)
}
})
}
this.fullPost = post
this.showPostModal = true}
The error occurs at this line:
this.postComments.push(commentaires)
"commentaires" is underlined with the same error mentioned above.
Can anyone offer assistance?