我正在使用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