TypeScript

Functions in TS

Learn how to type function parameters, return values, and overloads in TypeScript.

By TechCoder TeamLast updated: 2026-06-02
In a Nutshell

Learn how to type function parameters, return values, and overloads in TypeScript. This hands-on tutorial focuses on practical implementation of functions in ts concepts.

Functions in TS

TypeScript allows you to specify the types of both the input values (parameters) and the output values (return type) of functions.

Parameter Type Annotations

function greet(name: string) {
  console.log("Hello, " + name.toUpperCase() + "!!");
}

Return Type Annotations

function getFavoriteNumber(): number {
  return 26;
}
TYPESCRIPT PLAYGROUND
⏳ Loading editor…

AI Mentor

Confused about "TypeScript function typing, parameters, return types, and arrow functions."? Ask our AI mentor for a simplified explanation.