Tengo problemas para convertir una línea de código a Typescript que estoy tratando de aprender. Recibo algunas líneas de error relacionadas con mi enlace useReducer. He comentado las líneas de arriba y debajo de los problemas con el mensaje de error que estoy recibiendo.
const ACTIONS = { ADD_DIGIT: "add-digit", CLEAR: "clear", DELETE_DIGIT: "delete-digit", CHOOSE_OPERATION: "choose-operation", EVALUATE: "evaluate", }; // Binding element 'type' implicitly has an 'any' type. const reducer = (state: any, { type, payload }) => { // ^^ERROR switch (type) { case ACTIONS.ADD_DIGIT: return { ...state, // ##Cannot find name 'currentOperand' currentOperand: `${currentOperand || ""}${payload.digit}`, // ^^ERROR }; } }; const App: React.FC = () => { const [{ currentOperand, previousOperand, operation }, dispatch] = useReducer( reducer, {} ); dispatch({ type: ACTIONS.ADD_DIGIT, payload: { digit: 1 } }); return ()
}