export enum AuthActionTypes {
Login = '[Auth] Login',
Logout = '[Auth] Logout',
LoginSuccess = '[Auth] Login Success',
LoginFailure = '[Auth] Login Failure',
LoginRedirect = '[Auth] Login Redirect'
}
export type AuthActions =
| Login
| LoginSuccess
| LoginFailure
| LoginRedirect
| Logout;
第二个export是什么意思? “|” 是什么语法?
AuthActionTypes是一个枚举,包括5个可选值
export是导出类型
竖线语法叫做 String Literal Types
String Literal Types
String literal types allow you to specify the exact value a string must have. In practice string literal types combine nicely with union types, type guards, and type aliases. You can use these features together to get enum-like behavior with strings.
也就是AuthActions虽然是字符串,但是只能取以上枚举的那几个值之一
具体看
http://www.typescriptlang.org/docs/handbook/advanced-types.html