wtih最新从不使用@ngrx/效果



我正在尝试在我的 Angular 5 项目中使用 ngrx 效果访问我的商店的一部分。 根据StackOverflow上的几个线程,以及几篇博客文章,我正在使用LatestFrom和我注入的商店。 我目前正在使用 Angular 5、ngrx 4.1.1 和 rxjs 5.5.2

我的问题是,我不断收到类型错误:

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

这是我正在使用的代码。 关于可能导致这种情况的原因的任何想法?

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>) {}
}

看起来像一个错字。我相信:

import 'rxjs/add/operator/withLastestFrom';

应该是:

import 'rxjs/add/operator/withLatestFrom';

最新更新