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