Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
Convertir Javascript a Typescript useReducer gancho

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 ()

}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!