Reputation: 49996
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.
@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?
Upvotes: 8
Views: 1265
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