checkStore.ts 578 B

1234567891011121314151617181920212223
  1. import conformsTo from 'lodash/conformsTo'
  2. import isFunction from 'lodash/isFunction'
  3. import isObject from 'lodash/isObject'
  4. import invariant from 'invariant'
  5. /**
  6. * Validate the shape of redux store
  7. */
  8. export default function checkStore (store) {
  9. const shape = {
  10. dispatch: isFunction,
  11. subscribe: isFunction,
  12. getState: isFunction,
  13. replaceReducer: isFunction,
  14. runSaga: isFunction,
  15. injectedReducers: isObject,
  16. injectedSagas: isObject
  17. }
  18. invariant(
  19. conformsTo(store, shape),
  20. '(app/utils...) injectors: Expected a valid redux store'
  21. )
  22. }