我试图将此代码更新到版本 6,但我无法弄清楚如何从阅读和玩耍中重新设计流程, map, first, toPromise() 曾经可以工作。任何 RxJS 人能够教育我或指出我正确的方向?
const chats: chats[] = <chats[]>await Observable.merge(
this.chatService.$chats.filter(chats => chats.length > 0),
Observable.timer(5000).map(x => {
throw 'Timeout'
})
).first().toPromise()
if(chats.find( chat => chat.id === chatId )) {
this.log.log(`Found active chat ${chatId}, navigating to it from push notification...`)
}