我正在使用Ngrx 4.03和typeScript 2.5.2。TypeScript编译器错误地报告action.payload不存在
我已经定义了一个行动,例如:
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;
在我相应的减速,打字稿告诉我,action.payload
上不存在Action
,即使我可以登录值就好了。我究竟做错了什么?
我将呈现减速,如果这是错误所在。 – Meeker