我正在尝试这样做:
Stream<dynamic> searchEpic(
Stream<PerformSearchAction> actions,
EpicStore<AppState> store,
) {
return actions.asyncMap((action) => fetchPost()
.then((results) => SearchResultsAction(results['title']))
.catchError((error) => SearchErrorAction(error.message)));
}
但是我收到以下错误消息:
类型“ SearchErrorAction”不是类型“ FutureOr SearchResultsAction”的子类型
答案 0 :(得分:0)
我只需要将要通过管道工作的类型定义为dynamic
,就像这样:
Stream<dynamic> searchEpic(
Stream<PerformSearchAction> actions,
EpicStore<AppState> store,
) {
return actions.asyncMap<dynamic>((action) => fetchPost()
.then<dynamic>((results) => SearchResultsAction(results['title']))
.catchError((error) => SearchErrorAction(error.message)));
}