TypeScript useReducer and the ‘undefined’ is not assignable error Solving the frustrating TypeScript error