type alias

Creates a name for any type including primitives, unions, tuples, and objects. Cannot be re-opened like interfaces.

Syntax

typescript
type AliasName = TypeExpression;

Example

typescript
type ID = string | number;
type Status = "active" | "inactive" | "pending";
type Point = { x: number; y: number };
type Callback = (error: Error | null, data: string) => void;

const id: ID = "abc-123";