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

183
Views
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
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!