Interfaces vs Type Aliases

Define object shapes with interface and type. When to use which, plus optional, readonly, extends, and intersections.

Step 1 of 6

Two ways to name an object shape

TypeScript gives you two tools for naming shapes:

  • interface User { id: number; name: string }
  • type User = { id: number; name: string }

For object shapes, they’re 95% interchangeable. Pick a convention and stick to it. The 5% where they differ matters when authoring libraries — covered later.

Web Standard

Interfaces support declaration merging: multiple interface User { ... } blocks in scope merge into one. Type aliases do not. Library authors use interfaces for public types so consumers can extend them; application code mostly doesn’t care.

Learn more on MDN
TYPESCRIPTREAD ONLY