UNPKG

@jakesidsmith/redux-create-reducer

Version:

A utility to create redux reducers from a set of handlers

6 lines (5 loc) 341 B
import { Action, AnyAction, Reducer } from 'redux'; export declare type Handlers<S, A extends Action = AnyAction> = { [P in A['type']]: (state: S, action: A) => Exclude<S, undefined>; }; export declare function createReducer<S, A extends Action = AnyAction>(handlers: Handlers<S, A>, initialState: Exclude<S, undefined>): Reducer<S, A>;