Rxjs 通过将有效载荷传递给concatMapTo[操作]在NGX效果中发布

Rxjs 通过将有效载荷传递给concatMapTo[操作]在NGX效果中发布,rxjs,ngrx,ngrx-effects,rxjs-observables,Rxjs,Ngrx,Ngrx Effects,Rxjs Observables,下面是加载应用程序时用来触发某些操作的效果。当我运行下面的代码时,它抛出了错误 @Injectable() export class BootStrapEffects { bootStrap$ = createEffect(() => { return this.actions$.pipe( ofType(GetPrefSuccess), map((action) => action.payload), concatMapTo((pa

下面是加载应用程序时用来触发某些操作的效果。当我运行下面的代码时,它抛出了错误


@Injectable()
export class BootStrapEffects {
  bootStrap$ = createEffect(() => {
    return this.actions$.pipe(
      ofType(GetPrefSuccess),
      map((action) => action.payload),
      concatMapTo((payload: any) => [
        GetUser(payload.parsed.userId),
        GetMenu(payload.parsed.language),
      ])
    )
  })

  constructor(private actions$: Actions) {}
}
上面的代码抛出了下面的错误


error TypeError: You provided 'function (payload) { return [
                Object(_app_store_actions_account_action__WEBPACK_IMPORTED_MODULE_3__["GetUser"])(),
                Object(_app_store_actions_product_action__WEBPACK_IMPORTED_MODULE_7__["GetMenu"])()

  ]; }' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
来自TSLint

Argument of type '() => Observable<never>' is not assignable to parameter of type '() => never'.
  Type 'Observable<never>' is not assignable to type 'never'.ts(2345)
“()=>Observable”类型的
参数不能分配给“()=>never”类型的参数。
类型“Observable”不可分配给类型“never”。ts(2345)

有人能帮我解决这个错误吗?

你可以尝试用
concatMap
替换
concatMap
concatMapTo
将observable作为参数,不关心上游返回的内容,这意味着您无法使用上游的有效负载