Hongbo Miao
Hongbo Miao

Reputation: 49996

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

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

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

How to solve this issue?

Upvotes: 8

Views: 1265

Answers (1)

Mike R
Mike R

Reputation: 961

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)

Upvotes: 11

Related Questions