Type annotations are explicit type declarations that tell TypeScript what type a variable, parameter, or return value should be.
// Variable annotations
let username: string = "john";
let age: number = 25;
let isLoggedIn: boolean = false;
// Function parameter and return type annotations
function greet(name: string): string {
return `Hello, ${name}!`;
}
// Array annotations
let numbers: number[] = [1, 2, 3];
let names: Array<string> = ["Alice", "Bob"];