TypeScript functions work like JavaScript’s, but you can explicitly define parameter types and return types for safer, clearer code.
function functionName(param: type): returnTypefunction add(a: number, b: number): numberfunction log(message: string): voidTypeScript supports ES6 arrow functions too, with type annotations:
const multiply = (x: number, y: number): number => {
return x * y;
};
console.log(multiply(3, 5));
void.