Reputation: 789
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 example
and I get the following error:
Property 'startWith' does not exist on type 'Actions'.
Upvotes: 1
Views: 1038
Reputation: 157
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))
));
Upvotes: 3
Reputation: 789
just figured it out, this was missing.
import 'rxjs/add/operator/startWith'
Upvotes: 0