how to tell typescript that a function recieves javascript code example
Example 1: typescript function as parameter
function createPerson(name: string, doAction: () => void): void {
console.log(`Hi, my name is ${name}.`);
doAction(); // doAction as a function parameter.
}
// Hi, my name is Bob.
// performs doAction which is waveHands function.
createPerson('Bob', waveHands());
Example 2: typescript function type
interface Date {
toString(): string;
setTime(time: number): number;
// ...
}