File tree Expand file tree Collapse file tree 8 files changed +18
-34
lines changed Expand file tree Collapse file tree 8 files changed +18
-34
lines changed Original file line number Diff line number Diff line change 11import { applyMiddleware , createStore } from "redux"
22import { composeWithDevTools } from "redux-devtools-extension"
33import createSagaMiddleware from "redux-saga"
4- import { combinedReducers } from "./reducers"
4+ import { combinedReducers , RootState } from "./reducers"
55import { rootSaga } from "./sagas"
6- import { IInitialState } from "./states"
76
87const sagaMiddleware = createSagaMiddleware ( )
98
10- export function configureStore ( initialState ?: IInitialState ) {
9+ export function configureStore ( initialState ?: RootState ) {
1110 const store = createStore (
1211 combinedReducers ,
1312 initialState ,
Original file line number Diff line number Diff line change 11import { applyMiddleware , createStore } from "redux"
22import createSagaMiddleware from "redux-saga"
3- import { combinedReducers } from "./reducers"
3+ import { combinedReducers , RootState } from "./reducers"
44import { rootSaga } from "./sagas"
5- import { IInitialState } from "./states"
65
76const sagaMiddleware = createSagaMiddleware ( )
87
9- export function configureStore ( initialState ?: IInitialState ) {
8+ export function configureStore ( initialState ?: RootState ) {
109 const store = createStore (
1110 combinedReducers ,
1211 initialState ,
Original file line number Diff line number Diff line change 11import { Env } from "../constants"
2- import { IInitialState } from "../store/states "
2+ import { RootState } from "./reducers "
33
44const configureStoreComponent = ( ( ) => {
55 if ( Env . NODE_ENV === "production" ) {
@@ -8,5 +8,5 @@ const configureStoreComponent = (() => {
88 return require ( "./configureStore.development" )
99} ) ( )
1010
11- export const configureStore = ( initialState ?: IInitialState ) =>
11+ export const configureStore = ( initialState ?: RootState ) =>
1212 configureStoreComponent . configureStore ( initialState )
Original file line number Diff line number Diff line change 1- import { IInitialState } from "../states "
1+ import { RootState } from "../reducers "
22
3- export const countSelector = ( state : IInitialState ) => state . counter . count
3+ export const countSelector = ( state : RootState ) => state . counter . count
Original file line number Diff line number Diff line change 1- import { IInitialState } from "../states "
1+ import { RootState } from "../reducers "
22
3- export const selectedPageSelector = ( state : IInitialState ) =>
3+ export const selectedPageSelector = ( state : RootState ) =>
44 state . page . selectedPage
Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ import {
55 reduxSagaDebounceReducer ,
66 reduxSagaThrottleReducer ,
77} from "./redux-saga/reducers"
8- import { IInitialState } from "./states"
98
10- export const combinedReducers = combineReducers < IInitialState > ( {
9+ export const combinedReducers = combineReducers ( {
1110 counter : countReducer ,
1211 page : pageReducer ,
1312 reduxSagaDebounce : reduxSagaDebounceReducer ,
1413 reduxSagaThrottle : reduxSagaThrottleReducer ,
1514} )
15+
16+ export type RootState = ReturnType < typeof combinedReducers >
Original file line number Diff line number Diff line change 1- import { IInitialState } from "../states "
1+ import { RootState } from "../reducers "
22import { IReduxSagaState } from "./states"
33
4- export const reduxSagaDebounceSelector = (
5- state : IInitialState
6- ) : IReduxSagaState => state . reduxSagaDebounce
4+ export const reduxSagaDebounceSelector = ( state : RootState ) : IReduxSagaState =>
5+ state . reduxSagaDebounce
76
8- export const reduxSagaThrottleSelector = (
9- state : IInitialState
10- ) : IReduxSagaState => state . reduxSagaThrottle
7+ export const reduxSagaThrottleSelector = ( state : RootState ) : IReduxSagaState =>
8+ state . reduxSagaThrottle
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments