Skip to content

Commit 5f58127

Browse files
committed
Use casts instead of ts-ignore
1 parent 2050197 commit 5f58127

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/combineReducers.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ export default function combineReducers<M extends UnknownReducersMapObject>(
176176
const key = finalReducerKeys[i]
177177
const reducer = finalReducers[key]
178178
const previousStateForKey = state[key]
179-
// @ts-ignore
180-
const nextStateForKey = reducer(previousStateForKey, action)
179+
const nextStateForKey = reducer(
180+
previousStateForKey as undefined,
181+
action as never
182+
)
181183
if (typeof nextStateForKey === 'undefined') {
182184
const actionType = action && action.type
183185
throw new Error(
@@ -188,8 +190,8 @@ export default function combineReducers<M extends UnknownReducersMapObject>(
188190
`If you want this reducer to hold no value, you can return null instead of undefined.`
189191
)
190192
}
191-
// @ts-ignore
192-
nextState[key as keyof typeof nextState] = nextStateForKey
193+
nextState[key as keyof typeof nextState] =
194+
nextStateForKey as (typeof nextState)[keyof typeof nextState]
193195
hasChanged = hasChanged || nextStateForKey !== previousStateForKey
194196
}
195197
hasChanged =

0 commit comments

Comments
 (0)