Skip to content

Commit e90d501

Browse files
cellogtimdorr
andcommitted
fix replaceReducer type (reduxjs#3507)
* fix replaceReducer type * remove extraneous type * Update the JSDoc so IDEs don't complain. * new test for replaceReducers Co-authored-by: Tim Dorr <[email protected]> Former-commit-id: 65ca503
1 parent b1f6049 commit e90d501

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

index.d.ts.REMOVED.git-id

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
50e8d018faee8887ed82337fcd1993ad07df0968
1+
2fc2af4c9eb4ea9e5952cc465881eed93434efcd

src/createStore.js.REMOVED.git-id

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cef9a2ecaeff319d4986af24babf1c79ec9912c6
1+
57c57d7636d7bc54dd85411f400e868fdd912ed6

test/replaceReducers.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { createStore, combineReducers } from '..'
2+
3+
describe('replaceReducers test', () => {
4+
it('returns the original store', () => {
5+
const nextReducer = combineReducers({
6+
foo: (state = 1, _action) => state,
7+
bar: (state = 2, _action) => state
8+
})
9+
const store = createStore((state, action) => {
10+
if (state === undefined) return 5
11+
return action
12+
})
13+
14+
const nextStore = store.replaceReducer(nextReducer)
15+
16+
expect(nextStore).toBe(store)
17+
})
18+
})

0 commit comments

Comments
 (0)