8

I am using ngrx/effects.

After updating rxjs from 5.0.0-beta.12 to 5.0.0-rc.1, my IDE WebStorm gives me the error below (red underline). And when I run my app, the same error also shows in the terminal.

Supplied parameters do not match any signature of call target.

enter image description here

  @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);
  }
  • This error happens whenever I use map<string>(toPayload). I tried to change to .map<any>(action => action.payload), but still same error.

  • The effects without map<string>(toPayload) won't give the error.

Although it gives me the error, the app still runs well.

How to solve this issue?

Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267

1 Answers1

11

In rxjs 5.0.0-rc.1 the generic type parameters for all operators were changed to accept the type of the source observable first.

You will need to change the map operator call accordingly:

actions$
  .ofType(ProfileActions.PROFILE_UPDATE_PROFILE)
  .map<Action, string>(toPayload)
Mike R
  • 951
  • 1
  • 8
  • 13
  • 1
    Just add Mike's words from Gitter, `Action` is from `import { Action } from '@ngrx/store';`. Or `.map< ProfileActions, string>(toPayload)` works too. – Hongbo Miao Oct 16 '16 at 20:13