mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Improve store typings
Use proper thunk middleware type
This commit is contained in:
parent
e554e1db4f
commit
4083839841
3 changed files with 8 additions and 13 deletions
2
lib/hyper.d.ts
vendored
2
lib/hyper.d.ts
vendored
|
|
@ -190,9 +190,7 @@ export type HyperActions = (
|
|||
|
||||
type immutableRecord<T> = {[k in keyof T]: Immutable<T[k]>};
|
||||
|
||||
import {ThunkDispatch} from 'redux-thunk';
|
||||
import configureStore from './store/configure-store';
|
||||
export type HyperThunkDispatch = ThunkDispatch<HyperState, undefined, HyperActions>;
|
||||
export type HyperDispatch = ReturnType<typeof configureStore>['dispatch'];
|
||||
|
||||
import {ReactChild} from 'react';
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
import {createStore, applyMiddleware} from 'redux';
|
||||
import thunk from 'redux-thunk';
|
||||
import _thunk, {ThunkMiddleware} from 'redux-thunk';
|
||||
import rootReducer from '../reducers/index';
|
||||
import effects from '../utils/effects';
|
||||
import * as plugins from '../utils/plugins';
|
||||
import writeMiddleware from './write-middleware';
|
||||
import {composeWithDevTools} from 'redux-devtools-extension';
|
||||
import {HyperState, HyperThunkDispatch} from '../hyper';
|
||||
import {HyperState, HyperActions} from '../hyper';
|
||||
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
|
||||
|
||||
export default () => {
|
||||
const enhancer = composeWithDevTools(
|
||||
applyMiddleware<HyperThunkDispatch, HyperState>(thunk, plugins.middleware, thunk, writeMiddleware, effects)
|
||||
);
|
||||
const enhancer = composeWithDevTools(applyMiddleware(thunk, plugins.middleware, thunk, writeMiddleware, effects));
|
||||
|
||||
return createStore(rootReducer, enhancer);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
import {createStore, applyMiddleware} from 'redux';
|
||||
import thunk from 'redux-thunk';
|
||||
import _thunk, {ThunkMiddleware} from 'redux-thunk';
|
||||
import rootReducer from '../reducers/index';
|
||||
import effects from '../utils/effects';
|
||||
import * as plugins from '../utils/plugins';
|
||||
import writeMiddleware from './write-middleware';
|
||||
import {HyperState, HyperThunkDispatch} from '../hyper';
|
||||
import {HyperState, HyperActions} from '../hyper';
|
||||
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
|
||||
|
||||
export default () =>
|
||||
createStore(
|
||||
rootReducer,
|
||||
applyMiddleware<HyperThunkDispatch, HyperState>(thunk, plugins.middleware, thunk, writeMiddleware, effects)
|
||||
);
|
||||
createStore(rootReducer, applyMiddleware(thunk, plugins.middleware, thunk, writeMiddleware, effects));
|
||||
|
|
|
|||
Loading…
Reference in a new issue