ngrx:提供的参数与调用目标的任何签名都不匹配

ngrx: Supplied parameters do not match any signature of call target

我正在使用 ngrx/effects。

rxjs5.0.0-beta.12 更新为 5.0.0-rc.1,我的 IDE WebStorm 给我以下错误(红色下划线)。当我 运行 我的应用程序时,终端中也会显示相同的错误。

Supplied parameters do not match any signature of call target.

  @Effect() updateProfile$ = this.actions$
    .ofType(ProfileActions.PROFILE_UPDATE_PROFILE)
    .map<string>(toPayload)
    .switchMap(name => this.profileService.updateProfile(name)
      .map(name => ({ type: ProfileActions.PROFILE_UPDATE_PROFILE_SUCCESS, payload: name }))
      .catch(error => Observable.of({ type: ProfileActions.PROFILE_UPDATE_PROFILE_FAIL, payload: error }))
    );

.

  updateProfile(name: string): Observable<string> {
    return Observable.of(name);
  }

虽然它给了我错误,但应用程序仍然 运行 很好。

如何解决这个问题?

在 rxjs 5.0.0-rc.1 中,所有运算符的通用类型参数都更改为首先接受源可观察对象的类型。

您需要相应地更改 map 运算符调用:

actions$
  .ofType(ProfileActions.PROFILE_UPDATE_PROFILE)
  .map<Action, string>(toPayload)