Ngrx: Delivered parameters do not match any target call signature

I am using ngrx / effects.

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

The supplied parameters do not match any target call signature.

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 occurs when I use map<string>(toPayload) . I tried switching to .map<any>(action => action.payload) , but still the same error.

  • Effects without map<string>(toPayload) do not give an error.

Although this gives me an error, the application still works well.

How to solve this problem?

+7
angular typescript rxjs5 ngrx
source share
1 answer

In rxjs 5.0.0-rc.1, the universal type parameters for all operators have been changed to accept the type of source observed first.

You will need to modify the map operator statement accordingly:

 actions$ .ofType(ProfileActions.PROFILE_UPDATE_PROFILE) .map<Action, string>(toPayload) 
+11
source share

All Articles