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

327
Views
How to call a Javascript function from TypeScript in React

I am building a React application in Typescript. In my React application, my Typescript code need to call a JavaScript function.

so I try the answer from here Call external Javascript function from react typescript components And I did

  1. Create a Myutil.js file which contains a JS function:

    export default { function myTestFunction(arg1, arg2) { ... return 1; } };

  2. In my Typscript code I call the function like let returnValue = myTestFunction("abc", "def");

But when I compile it, I get error saying

myutil.js(2,14): error TS1005: Build:':' expected.

And column 14 of line 2 is the beginning of the function name myTestFunction

 function myTestFunction
          ^
          |
         14

Can you please tell me what am I missing?

Thank you.

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!