I have an error in switchMap operator:
@Injectable()
export class AvailableStoreTypesLoadedEffect {
constructor(private actions$: Actions,
private service: AvailableService) {
}
@Effect()
AvailableStoreTypesLoadedEffect$ = this.actions$
.ofType(FETCH_AVAILABLE_STORE_TYPES)
.pipe(
switchMap(action => this.service.fetchAvailableStoreTypes()),//Error:(22, 9) TS2684:The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable<{}>'.
map(res => new AvailableStoreTypesLoaded(res))
);
}
I tried with:
Observable.of({})
.pipe(
switchMap(() => Observable.of({}))//Error:(22, 9) TS2684:The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable<{}>'.
);
but I get the same error.
My environment is:
I imported the library from import { mergeMap } from 'rxjs/operator/mergeMap'; but it must be imported from import { mergeMap } from 'rxjs/operators';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With