[TypeScript] ReturnType
Constructs a type consisting of the return type of function Type
.
https://www.typescriptlang.org/docs/handbook/utility-types.html
import { configureStore } from "@reduxjs/toolkit"; import cartReducer from "../features/cart/cartSlice"; import productsReducer from "../features/products/productsSlice"; export const store = configureStore({ reducer: { cart: cartReducer, products: productsReducer, }, }); export type RootState = ReturnType<typeof store.getState>; export type AppDispatch = typeof store.dispatch;