Reputation: 351
I noticed issue #990 but no resolution.
Project is compiling, but I'm getting a linting error saying Property 'pipe' does not exist on type 'Actions' in my effects and also in my components when i try to use .pipe with store. However, I don't get the issue in the same component when I use .pipe on observable.
// Linting problem example doesn't exist on type Store / Action
this.item$ = this.store.pipe(select(item));
@Effect({ dispatch: false })
logout$ = this.actions$.pipe(
ofType<Logout>(AuthActionTypes.LogoutAction),
tap(() => {
localStorage.removeItem(USER);
this.router.navigate(['/']);
})
);
// No problems
this.item$.pipe(takeUntil(this.onDestroy$)).subscribe(status => {
// Package.json this is Angular 6 with rxjs 6 and NgRx libraries
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.5",
"@angular/animations": "^6.1.0",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@ngrx/effects": "^6.1.0",
"@ngrx/entity": "^6.1.0",
"@ngrx/router-store": "^6.1.0",
"@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^6.1.0",
"core-js": "^2.5.4",
"rxjs": "~6.2.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.8.0",
"@angular/cli": "~6.2.4",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@ngrx/schematics": "^6.1.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"ngrx-store-freeze": "^0.2.4",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~2.9.2"
}
}
Upvotes: 3
Views: 4302
Reputation: 52494
Had the same error. In my case it was because I was because I was importing Actions from '@ngrx/store-devtools/src/reducer' instead of '@ngrx/effects'
import { Injectable } from '@angular/core';
import { createEffect } from '@ngrx/effects';
//import { Actions } from '@ngrx/store-devtools/src/reducer'; --> wrong
import { Actions, ofType } from '@ngrx/effects';
import { map, mergeMap } from 'rxjs/operators';
import { ProductService } from '../product.service';
import * as ProductActions from './product.actions';
@Injectable()
export class ProductEffects {
constructor(private actions$: Actions,
private productsService: ProductService) { }
loadProducts$ = createEffect(() => {
return this.actions$.pipe(
ofType(ProductActions.loadProducts),
mergeMap(() => this.productsService.getProducts().pipe(
map(products => ProductActions.loadProductsSuccess({ products }))
))
)
})
}
Upvotes: 4