Skip to content

Instantly share code, notes, and snippets.

@AustinMatherne
Created September 29, 2017 04:57
Show Gist options
  • Save AustinMatherne/01bc74b57b55c40759f57e7ef12ca9b9 to your computer and use it in GitHub Desktop.
Save AustinMatherne/01bc74b57b55c40759f57e7ef12ca9b9 to your computer and use it in GitHub Desktop.
String Enum Typed Actions
// 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