You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To provide a redux' 100% typed reducer builder, producing a reducer which returns an Immutable<State> object using immer.
Example usage
// actions.tsimport{createAction}from'typesafe-actions'exportconstmyAction1=createAction('action_id')<string>()exportconstmyAction2=createAction('action_id')<number>()// reducers.tsimportcreateReducerBuilderfrom'typesafe-actions-reducer-builder'import{myAction1,myAction2}from'./actions.ts'interfaceState{var1: stringvar2: number}constinitialState: State={var1: '',var2: 0,}// provides state's interfaceconstreducer=createReducerBuilder(initialState)// provides action's interface.handle(myAction1)// type-hinted Reducer<TState, TAction>.reducer((state,action)=>{// argument override as immer will take care of it with proxiesstate.var1=action.payloadreturnstate}).handle(myAction2).reducer((state,action)=>{// type hinted state, actionstate.var2=action.payloadreturnstate}).build()
The text was updated successfully, but these errors were encountered:
Hello!
I'd like to keep this issue to gather information about "satellite" projects enhancing the experience with typesafe-actions.
I'll start with my library, others will come as people will reply.
P.S.
Maybe a wiki page?
typesafe-actions-reducer-builder
github: https://github.com/elegos/typesafe-actions-reducer-builder
npmjs: https://www.npmjs.com/package/typesafe-actions-reducer-builder
Goal of the library
To provide a redux' 100% typed reducer builder, producing a reducer which returns an
Immutable<State>
object usingimmer
.Example usage
The text was updated successfully, but these errors were encountered: