diff --git a/index.d.ts b/index.d.ts index 50e8d018fa..d31a15ffea 100644 --- a/index.d.ts +++ b/index.d.ts @@ -326,7 +326,9 @@ export interface Store { * * @param nextReducer The reducer for the store to use instead. */ - replaceReducer(nextReducer: Reducer): void + replaceReducer( + nextReducer: Reducer + ): Store /** * Interoperability point for observable/reactive libraries. @@ -667,3 +669,9 @@ export function compose( ): (...args: any[]) => R export function compose(...funcs: Function[]): (...args: any[]) => R + +export const __DO_NOT_USE__ActionTypes: { + INIT: string + REPLACE: string + PROBE_UNKNOWN_ACTION: () => string +} diff --git a/src/createStore.js b/src/createStore.js index cef9a2ecae..1f4a09c5c0 100644 --- a/src/createStore.js +++ b/src/createStore.js @@ -238,6 +238,7 @@ export default function createStore(reducer, preloadedState, enhancer) { // will receive the previous state. This effectively populates // the new state tree with any relevant data from the old one. dispatch({ type: ActionTypes.REPLACE }) + return store } /** @@ -284,11 +285,12 @@ export default function createStore(reducer, preloadedState, enhancer) { // the initial state tree. dispatch({ type: ActionTypes.INIT }) - return { + const store = { dispatch, subscribe, getState, replaceReducer, [$$observable]: observable } + return store }