I have recently updated to Angular 9 and keep receiving this error in my user.effects.ts file:
ERROR in src/app/modules/core/store/user/user.effects.ts:30:9 - error TS2345: Argument of type 'OperatorFunction<IUser, { payload: Partial<IUser>; } & TypedAction<"[Use
r] Data Received">>' is not assignable to parameter of type 'OperatorFunction<unknown[], { payload: Partial<IUser>; } & TypedAction<"[User] Data Received">>'.
Type 'IUser' is missing the following properties from type 'unknown[]': length, pop, push, concat, and 26 more.
30 map(
~~~~
31 (data: IUser) => UserActions.dataReceived({ payload: UserService.parseData(data) })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 )
My code is as follows:
@Effect()
getData$ = this.actions$.pipe(
ofType(UserActions.getData),
switchMap(() => {
return this.userService.getUserById(localStorage.getItem('uid')).pipe(
map(
(data: IUser) => UserActions.dataReceived({ payload: UserService.parseData(data) })
)
);
})
);
Your code should be
new UserActions.dataReceived({ payload: UserService.parseData(data) })
Let me know if you still have any issue