【发布时间】:2018-08-21 02:06:48
【问题描述】:
我正在使用连接到 Firestore 的先前 Rxjs 版本代码库中的代码,我更改了所有内容以使用正确的导入并添加了 .pipe(map)。我得到一个说法“[ts] Property 'pipe' 在类型'DocumentChangeAction [] 上不存在。”这是我的功能,它给了我这个问题。谢谢。
private mapAndUpdate(col: AngularFirestoreCollection<any>) {
var values;
if (this._done.value || this._loading.value) { return };
this._loading.next(true)
// Map snapshot with doc ref (needed for cursor)
return col.snapshotChanges()
.pipe(tap(arr => {
values = arr.pipe(
map((snap: any) => {
const data = snap.payload.doc.data();
const doc = snap.payload.doc;
return { ...data, doc };
}))
));
// If prepending, reverse array
values = this.query.prepend ? values.reverse() : values
// update source with new values, done loading
this._data.next(values)
this._loading.next(false)
// no more values, mark done
if (!values.length) {
this._done.next(true)
}
})
.take(1)
.subscribe()}
【问题讨论】:
标签: angular rxjs google-cloud-firestore