Skip to content

Commit

Permalink
Use casts instead of ts-ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 committed Mar 25, 2023
1 parent 2050197 commit 5f58127
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/combineReducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,10 @@ export default function combineReducers<M extends UnknownReducersMapObject>(
const key = finalReducerKeys[i]
const reducer = finalReducers[key]
const previousStateForKey = state[key]
// @ts-ignore
const nextStateForKey = reducer(previousStateForKey, action)
const nextStateForKey = reducer(
previousStateForKey as undefined,
action as never
)
if (typeof nextStateForKey === 'undefined') {
const actionType = action && action.type
throw new Error(
Expand All @@ -188,8 +190,8 @@ export default function combineReducers<M extends UnknownReducersMapObject>(
`If you want this reducer to hold no value, you can return null instead of undefined.`
)
}
// @ts-ignore
nextState[key as keyof typeof nextState] = nextStateForKey
nextState[key as keyof typeof nextState] =
nextStateForKey as (typeof nextState)[keyof typeof nextState]
hasChanged = hasChanged || nextStateForKey !== previousStateForKey
}
hasChanged =
Expand Down

0 comments on commit 5f58127

Please sign in to comment.