Interfaces
interface User {
id: number;
name: string;
}
Generics
function wrap<T>(item: T): T[] {
return [item];
}
Enums
enum Status { Active, Inactive }
Types
type Point = { x: number; y: number };
Optional
function greet(msg?: string) {
console.log(msg || "Hi");
}
Assertions
const str = someVal as string;