I recently started learning TypeScript and I'm delving into state management in Angular 11. However, when I try to create an effect, I encounter an error stating Argument of type '(action: User & TypedAction<"login start">) => void'.
I have attempted the following code:
login$ = createEffect(() => {
return this.actions$.pipe(
ofType(loginstart),
// Argument of type '(action: User & TypedAction<"login start">) => void' is not assignable to parameter of type '(value: User & TypedAction<"login start">, index: number) => ObservableInput<any>'.
// Type 'void' is not assignable to type 'ObservableInput<any>'
exhaustMap((action) => {
console.log(action);
})
);
});
Action
const LOGIN_START = 'login start';
export const loginstart = createAction(LOGIN_START, props<User>());
export interface User {
name: string;
email: string;
}
How should I go about resolving this issue?