function types in typescript code example
Example 1: simple function in typescript
// Named function
//function with type as number
function add(x: number, y: number): number {
// return sum of numbers entered as params
return x + y;
}
// Anonymous function
// variable to call and define function
let myAdd = function (x: number, y: number): number {
// return sum of numbers entered as params
return x + y;
};
Example 2: types function typescript
interface Easy_Fix_Solution {
title: string;
callback: Function;
}