Skip to content

Instantly share code, notes, and snippets.

@SuperOleg39
Created February 20, 2018 14:25
Show Gist options
  • Select an option

  • Save SuperOleg39/9100006a9485b1890830b47618846f58 to your computer and use it in GitHub Desktop.

Select an option

Save SuperOleg39/9100006a9485b1890830b47618846f58 to your computer and use it in GitHub Desktop.
export enum constants {
SET = 'feature/SET',
}
export type actions = {
set: {
type: constants.SET;
};
}
type RootAction = actions[keyof actions];
export const reducer = (state = initialState, action: RootAction): IState => {
switch (action.type) {
case constants.SET:
return state;
default:
return state;
}
}
export const actionCreators = {
set: (): actions['set'] => ({ type: constants.SET })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment