Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

237
Vistas
How can i use typescript file on my auth.tsx file

My question will be a little easy, but I'm new to typescript so I'm having trouble coding it.

I have a form structure and this form works with jwt tokens in the backend. Naturally, I have to make requests to this API, so I created a file named auth.tsx under an action file and wrote the necessary codes, but since I have typescript on my system, I am getting any errors in some data types.

Here are the data types I'm getting error on and an example of a variable

export const reset_password_confirm = (uid, token, new_password, re_new_password) => async dispatch => {
    const config = {
        headers: {
            'Content-Type': 'application/json'
        }
    };

    const body = JSON.stringify({ uid, token, new_password, re_new_password });

    try {
        await axios.post(`${process.env.REACT_APP_API_URL}/auth/users/reset_password_confirm/`, body, config);

        dispatch({
            type: PASSWORD_RESET_CONFIRM_SUCCESS
        });
    } catch (err) {
        dispatch({
            type: PASSWORD_RESET_CONFIRM_FAIL
        });
    }
};

and then i get this error:

The 'new_password' parameter has an implicit type 'any'.

I also get this error in the variables I listed below.

uid, token, email, new_password, password, dispatch. 

How can i use typescript in this file Can anyone help please. Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In typescript function arguments need types. This enforces what kind of thing can be passed to a function, and lets you know how to use that thing inside the function.

For example:

import { DispatchOrSomething } from 'redux-or-whatever-lib'

export const reset_password_confirm = (
  uid: number,
  token: string,
  new_password: string,
  re_new_password: string
) => async (dispatch: DispatchOrSomething) => {
  //...
}

For example, look at this playground

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda