Angular 5 ngrx Effect no exported member 'ofType'
Looking at @ngrx/effects API, there's no sign that this library has implemented a lettable version of ofType
, so your second implementation won't work (at least not with ofType
inside the pipe).
Your first implementation is just missing an import for mergeMap
import 'rxjs/add/observable/mergeMap';
and probably map
and catch
as well
import 'rxjs/add/observable/map';import 'rxjs/add/observable/catch';
If you want to use ofType
with pipe
, this will probably work
@Effect()getWifiData: Observable<Action> = this.actions$.ofType(WifiTypes.getWifiNetworks) .pipe( mergeMap((action: GetWifiNetworks) => ...
since ofType()
returns an Observable which has .pipe
already added to it's prototype.
Footnote
After looking through the source code on github (as at 22 Jan 2018), I found an export for lettable ofType
here platform/modules/effects/src/index.ts.
But upon installing with @ngrx/effects@latest
(which gives me ver 4.1.1) I can't see this export reference under the installed node_modules folder.
In my component, I can't use import { ofType } from '@ngrx/effects';
either.
It looks like the docs are reflecting a nightly release.
https://github.com/ngrx/platform/issues/727
Nightly release is available here: https://github.com/ngrx/effects-builds