Type Aliases, Unions & Intersections in TypeScript
From the TypeScript cheat sheet ยท Basic Types ยท verified Jul 2026
Type Aliases, Unions & Intersections
Create custom types with aliases, combine with unions and intersections
typescript
// Type alias
type ID = string | number;
// Union (one of)
type Status = "active" | "inactive" | "pending";
// Intersection (combine all)
type Employee = Person & { company: string };๐ก Union (|) means "one of these" โ intersection (&) means "all of these combined"
โก Literal types restrict values to exact strings, numbers, or booleans
๐ Intersections merge all properties โ conflicting properties become never
๐ข Use type aliases for unions/intersections; use interfaces for object shapes you might extend