我明白了,错误说属性'key'在类型'{}'上不存在。
getLastMessageForUser(): Observable<Message[]> {
return this.auth.getAuthenticatedUser()
.map(auth =>auth.uid)
.mergeMap(authId => this.db.list(`last-messages/${authId}`)
.snapshotChanges())
.mergeMap(lastMessages =>
Observable.forkJoin(
lastMessages.map(message =>
this.db.object(`/messages/${message.payload.val().key}`).valueChanges().first()),
(...vals) => {
console.log(vals);
return vals;
})
)
此功能应该给我用户的最后消息。如何更改message.payload.val()。key?
打字稿版本3.2.2