I am updating some old Javascript to Typescript. In Javascript you can do the following [ref]:
if (typeof functionName === "function") {
// safe to use the function
functionName();
}
In Typescript this gives a syntax error "Cannot find name 'updateRadarCharts'"
I can resolve the issue with a declare statement
declare var functionName: Function;
However this doesn't feel like a clean solution because it is possible this won't be declared (hence the check). Is there a cleaner way to do this in TS ?