Answers for "Argument of type 'InitialState' is not assignable to parameter of type 'never'"

0

Argument of type 'InitialState' is not assignable to parameter of type 'never'

I also struggled with this problem. The best way to prevent bugs seems to me to add the State Interface as the return type of the reducer. Then you see the type errors inside the reducer instead on the useReducer line.

like this:

function reducer(state: IState, action: IFluxAction): IState {
   // reducer code
   // type errors are visible here 
}
Posted by: Guest on July-31-2020

Code answers related to "Argument of type 'InitialState' is not assignable to parameter of type 'never'"

Browse Popular Code Answers by Language