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
import{combineReducers}from"redux";importglobal,{GlobalState}from"./global";importfoo,{FooState}from"./global";importbar,{BarState}from"./global";exportdefaultcombineReducers({
global,
foo,
bar
});exportinterfaceRootState{global: GlobalState,foo: FooState,bar: BarState,}
import{combineReducers,Reducer}from"redux";declaretypeReducerState<T>=TextendsReducer<infer S> ? S : never;exportconstreducer=combineReducers({
global,
foo,
bar,});// get global internal state typingexporttypeGlobalState=ReducerState<typeofglobal>;// get root state with combine all state typingexporttypeRootState=ReducerState<typeofreducer>;
This can greatly reduce the writing of boilerplate code.
This can greatly reduce the writing of boilerplate code.
RootState can be automatically generated.
infer
keyword release for TypeScript 2.8The text was updated successfully, but these errors were encountered: