Webstorm给我一个错误:
TS2345:类型的参数(res:任意)=>属性“ type”的类型不兼容。不能将类型“ CLOSE_ACTIVE_CHATS”分配给类型“ DELETE_SELECTED_CHAT”。
switchMap((res) => {//error here
chat.mdRef.close();
if (chat.chat.state === 2) {
return [new CloseOpenChat(chat.chat._id), new
DeleteSelectedChat(),
new AddClosedChat(chat.chat)];
})
@Effect()
closeChat: Observable<any> = this.actions.pipe(
ofType(CLOSE_CHAT_CALL),
map((action: _Actions.AddClosedChat) => {
return action.payload;
}),
switchMap((chat: CloseChatI) => {
return this.messageService.closeChat(chat.chat._id).pipe(
// @ts-ignore
switchMap((res) => {
chat.mdRef.close();
if (chat.chat.state === 2) {
return [new CloseOpenChat(chat.chat._id), new
DeleteSelectedChat(),
new AddClosedChat(chat.chat)];
}
return [new CloseActiveChat(chat.chat._id), new
DeleteSelectedChat(),
new AddClosedChat(chat.chat)];
}),
catchError(ErrorService.handleError)
);
}),
catchError((err) => of(new CallFailed())
)
);
答案 0 :(得分:0)
DeleteSelectedChat()
似乎还分派了一个动作,导致分派了多个动作。
如果您将DeleteSelectedChat()
注释掉,您是否还会收到错误消息?