Script Valley
TypeScript: Complete Course from Zero
Object Types and InterfacesLesson 2.2

TypeScript interfaces vs type aliases what is the difference

interface declaration, type alias declaration, extending interfaces, intersection types, declaration merging, when to use each

interface vs type

Both describe object shapes, and for most use cases they are interchangeable:

interface User {
  name: string;
  age: number;
}

type UserType = {
  name: string;
  age: number;
};

Key differences

Interfaces can be extended:

interface Animal { name: string; }
interface Dog extends Animal { breed: string; }

Type aliases support unions:

type ID = string | number; // can't do this with interface

Interfaces support declaration merging:

interface Window { myProp: string; }
interface Window { otherProp: number; }
// TypeScript merges both — useful for augmenting library types

Which to use

Use interface for object shapes you will extend or that describe a public API contract. Use type for unions, intersections, mapped types, and utility types. When in doubt, interface for objects is the community convention.

Up next

How to extend and implement interfaces in TypeScript

Sign in to track progress