我正在尝试这样做:

Stream<dynamic> searchEpic(
  Stream<PerformSearchAction> actions,
  EpicStore<AppState> store,
) {
  return actions.asyncMap((action) => fetchPost()
      .then((results) => SearchResultsAction(results['title']))
      .catchError((error) => SearchErrorAction(error.message)));
}

但是我收到以下错误消息:

最佳答案

我只需要将要通过管道工作的类型定义为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)));
}

10-05 20:59
查看更多