如何修复接口“QuerySnapshot<T>”错误地扩展了 Firebase 和 Angular 中的接口“QuerySnapshot<DocumentData>”?

问题描述 投票:0回答:2

我安装了最新版本的

@angular/fire
,但出现了很多意外错误。如果有人知道这个问题的解决方案。请告诉我。

node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:18 - 错误 TS2430:接口“DocumentSnapshotExists”错误地扩展了接口“DocumentSnapshot”。 “data(...)”返回的类型在这些类型之间不兼容。 类型“T”不可分配给类型“DocumentData |”不明确的'。 类型“T”不可分配给类型“DocumentData”。

13 导出接口 DocumentSnapshotExists 扩展 firebase.firestore.DocumentSnapshot { ~~~~~~~~~~~~~~~~~~~~~~

node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:41 13 导出接口DocumentSnapshotExists extends firebase.firestore.DocumentSnapshot { 〜 此类型参数可能需要

extends firebase.firestore.DocumentData
约束。 node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:41 13 导出接口DocumentSnapshotExists extends firebase.firestore.DocumentSnapshot { 〜 此类型参数可能需要
extends firebase.firestore.DocumentData | undefined
约束。

任何解决方案表示赞赏!

angular typescript firebase angularfire
2个回答
0
投票

Firebase 和 Angular/Fire 之间不匹配 尝试安装两个最新版本

npm install firebase@latest @angular/fire@latest

0
投票

I encountered the same problem and here is what worked for me. the commented lines have been replaced by those below. for more detail I suggest this github link: https://github.com/angular/angularfire/issues/3255

© www.soinside.com 2019 - 2024. All rights reserved.