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

187
Vistas
Why is this interface wrong?

Helo! I have a small problem with this interface:

interface Template {
  from_name: string;
  to_name: string;
  fullName: string;
  company: string;
  email: string;
  msg: string;
}

and I will use this here:

const onSubmit: SubmitHandler<IFormInput> = (data) => {
    let serviceId: any = process.env.REACT_APP_SERVICE_ID;
    let templateId: any = process.env.REACT_APP_TEMPLATE_ID;
    let userID: any = process.env.REACT_APP_USER_ID;

    let templateParams: Template = {
      from_name: "Contact Mailer",
      to_name: `${process.env.REACT_APP_TO_EMAIL}`,
      fullName: `${data.fullName}`,
      company: `${data.company}`,
      email: `${data.email}`,
      msg: `${data.message}`,
    };

    emailjs
      .send(`${serviceId}`, `${templateId}`, templateParams, `${userID}`)
      .then(
        function (response) {
          response.status ? setOpenSucces(true) : setOpenFail(true);
        },
        function (error) {
          setOpenFail(true);
          console.log("FAILED...", error);
        }
      )
      .catch((err) => {
        setOpenFail(true);
        console.log(err);
      });
  };

Returns me an error:

Unable to assign an argument of type "Template" to a parameter of type "Record<string, unknown>". No index signature for type "string" in type "Template".ts(2345)

What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
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