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
Create a Myutil.js file which contains a JS function:
export default { function myTestFunction(arg1, arg2) { ... return 1; } };
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.