Reputation: 62
I'm migrating a project from JS to Typescript. But new TS class should coexist with previous JS. There is a function in scope called verifyActivityChange(). In javascript this function has been declared in the app.js file and can be called from anywhere.
How do I call this function from a Typescript class ?
In some TS file I was able to do
// @ts-ignore
import * as appjs from "./app.js";
appjs.verifyActivityChange();
Note sure if this is correct since I had to ignore compilation error. But if I'm doing the same process within a class I have an error appjs dosn't have a constructor.
Edit How do I call the function from the class
import {verifyActivityChange} from "./app.js";
export class ViewController {
public update(){
verifyActivityChange(); //how can I call this function ? it's on my page DOM
}
}
Upvotes: 0
Views: 241