Created
September 29, 2017 04:57
-
-
Save AustinMatherne/01bc74b57b55c40759f57e7ef12ca9b9 to your computer and use it in GitHub Desktop.
String Enum Typed Actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// counter.actions.ts | |
import { Action } from '@ngrx/store'; | |
export const enum CounterTypes { | |
INCREMENT = '[Counter] Increment'; | |
DECREMENT = '[Counter] Decrement'; | |
RESET = '[Counter] Reset'; | |
}; | |
export class Increment implements Action { | |
readonly type = CounterTypes.INCREMENT; | |
} | |
export class Decrement implements Action { | |
readonly type = CounterTypes.DECREMENT; | |
} | |
export class Reset implements Action { | |
readonly type = CounterTypes.RESET; | |
constructor(public payload: number) {} | |
} | |
export type CounterActions | |
= Increment | |
| Decrement | |
| Reset; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment