Q:

NGRX/store sideEffect issue with startWith

I have a side-effect that looks like this;
 @Effect()
  loadAll$: Observable<Action> = this.actions$
    .ofType(reservationsActions.LOAD_ALL)
    .startWith(new reservationsActions.LoadAll())
    .switchMap(() =>
      this.reservationsService.index() 
     .map((reservations: Reservation[]) => new reservationsActions.LoadAllSuccess(reservations))
);

I grabbed that from this repo ngrx exmplae
and I get this error
Property 'startWith' does not exist on type 'Actions<Action>'.

A:

When upgrading to rxjs 6 you need to adjust your syntax to use the pipe operator.
Original
  @Effect()
  loadAll$: Observable<Action> = this.actions$
   .ofType(reservationsActions.LOAD_ALL)
   .startWith(new reservationsActions.LoadAll())
   .switchMap(() =>
     this.reservationsService.index() 
    .map((reservations: Reservation[]) => new 
         reservationsActions.LoadAllSuccess(reservations))
   );

New
  @Effect()
  loadAll$: Observable<Action> = this.actions$.pipe(
   ofType(reservationsActions.LOAD_ALL),
   startWith(new reservationsActions.LoadAll()),
  switchMap(() =>
    this.reservationsService.index() 
   .map((reservations: Reservation[]) => new 
reservationsActions.LoadAllSuccess(reservations))
   ));

