bigbuffet-rw/app/soapbox/store.ts
marcin mikołajczak 47b67df323 Use RootState in AppDispatch type
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-06-18 11:34:38 +02:00

25 lines
735 B
TypeScript

import { configureStore } from '@reduxjs/toolkit';
import thunk, { ThunkDispatch } from 'redux-thunk';
import errorsMiddleware from './middleware/errors';
import soundsMiddleware from './middleware/sounds';
import appReducer from './reducers';
import type { AnyAction } from 'redux';
export const store = configureStore({
reducer: appReducer,
middleware: [
thunk,
errorsMiddleware(),
soundsMiddleware(),
],
devTools: true,
});
export type Store = typeof store;
// Infer the `RootState` and `AppDispatch` types from the store itself
// https://redux.js.org/usage/usage-with-typescript
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = ThunkDispatch<RootState, {}, AnyAction>;