0
votes

I am trying to access part of my store within an ngrx effect in my Angular 5 project. As per several threads on StackOverflow, as well as several blog posts, I am using withLatestFrom, and my injected store. I am currently using Angular 5, ngrx 4.1.1, and rxjs 5.5.2

My problem is, I keep getting a type error:

error TS2339: Property 'withLatestFrom' does not exist on type 'Actions<Action>'.

Here is the code I am using. Any thoughts on what might be causing this?

import {Injectable} from '@angular/core';
import {Store} from '@ngrx/store';
import {Effect, Actions} from '@ngrx/effects';

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/withLastestFrom';

import * as EndpointActions from './endpoint.actions';
import {AppState} from '../../store/app.reducers';

@Injectable()
export class EndpointEffects {

  @Effect()
  setEndpointData = this.actions$
    .ofType(EndpointActions.SET_ENDPOINT_DATA)
    .withLatestFrom(this.store$.select(state => state.endpoint.endpointAddress))
    .map(([action, endpointAddress]) => {
      return {
        type: EndpointActions.TRY_ENDPOINT_ADDRESS,
        payload: {endpointAddress: endpointAddress}
      };
    });

  constructor(private actions$: Actions, private store$: Store<AppState>) {}
}
1
What versions of RXJS / NGRX are you using?user184994
Oops, that would have been useful, wouldn't it have? Added it to the question. (RXJS 5.5.2, ngrx 4.1.1 btw)MarkD

1 Answers

2
votes

Looks like a typo. I believe:

import 'rxjs/add/operator/withLastestFrom';

Should be:

import 'rxjs/add/operator/withLatestFrom';