我正在使用 Ngrx 4.03 和 typeScript 2.5.2。
我已经定义了一个动作:
import { Action } from '@ngrx/store';
import { IUser } from '../models';
export const LOGIN_SUCCESS = '[Auth] Login Success';
export const LOGOUT_SUCCESS = '[Auth] Logout Success';
export class LoginSuccess implements Action {
readonly type = LOGIN_SUCCESS;
constructor (
public payload: IUser
) {}
}
export class LogoutSuccess implements Action {
readonly type = LOGOUT_SUCCESS;
}
export type AuthActions
= LoginSuccess
| LogoutSuccess;
在我相应的减速器中,TypeScript 告诉我 that action.payload
doesn't exist on Action
,即使我可以很好地记录该值。我究竟做错了什么?