Web30 min · Lesson 1 of 3

Interfaces, Types & Enums

The building blocks of type safety. When to use Interfaces vs. Type aliases and the pitfalls of Enums.

Interfaces vs Type Aliases

Both allow you to describe the shape of an object, but Interfaces are extendable (declaration merging), while Types are more flexible (unions, intersections).

The Enum Problem

Modern TypeScript often avoids enum in favor of const objects or union types, which result in smaller, more idiomatic JavaScript code after compilation.