Reputation: 1684
So basicly I want to render a returntype for my combined reducers which I do just fine by:
const rootReducer = combineReducers({
notes: notesReducer,
categories: categoriesReducer,
flyout: flyoutReducer
// more reducers
});
export type AppState = ReturnType<typeof rootReducer>;
However if I were to accept a passed in value to the function I am having issues returning the types correctly. Example below:
const rootReducer = history =>
combineReducers({
router: connectRouter(history),
page: pageReducer,
....
....
export type AppState = ReturnType<typeof rootReducer>;
How can I invoke the function to get the same returned types??
Upvotes: 0
Views: 40
Reputation: 249716
You can just use ReturnType
twice:
const rootReducer = history =>
combineReducers({
router: connectRouter(history),
page: pageReducer,
});
export type AppState = ReturnType<ReturnType<typeof rootReducer>>;
Upvotes: 1