【发布时间】:2021-10-26 13:26:27
【问题描述】:
我没有找到解决问题的方法: Ts给我一个:
Argument of type 'DocumentData' is not assignable to parameter of type 'never'
我尝试了在这里找到的解决方案:Argument of type 'DocumentData | undefined' is not assignable to parameter of type 'DocumentData'
但它不起作用。
这是我的功能:
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}
我在这一行得到错误:
this.postComments.push(commentaires)
评论者在我上面写的错误下划线
你能帮帮我吗?
【问题讨论】:
标签: typescript firebase vue.js