Interview Q&A / TypeScript

BeginnerIn-depth2 min readUpdated 30 Sept 2026

What is the difference between interface and type in TypeScript?

SHORT ANSWER

Both describe the shape of data. An interface describes objects and can be extended or merged; a type alias can name any type, including unions, tuples and primitives.

Explain it simply

An interface is like a form template for an object: "a User must have a name and an email". A type alias is a nickname you can give to any kind of type: an object, a union like "small" | "large", a tuple, or even a plain string. For everyday object shapes, both work almost the same way.

Example

ts
// Interface: good for object shapes and public APIs
interface User {
  id: number;
  name: string;
}
interface Admin extends User {
  permissions: string[];
}

// Type alias: can also name unions and tuples
type Status = "active" | "blocked";
type Point = [number, number];
type AdminUser = User & { permissions: string[] };

How it works

  • interface can be extended with extends and can be declared again with the same name; TypeScript merges the declarations ("declaration merging"). Libraries use this so users can add fields.
  • type cannot be re-declared, but it can express unions (A | B), intersections (A & B), mapped types and conditional types.
  • Error messages for interfaces are often a little easier to read because the interface name is shown.

Real-world use

  • Use interfaces for objects, class contracts and library types that others may extend.
  • Use type aliases for unions (API states, button variants), tuples, function types and advanced mapped types.
  • Many teams pick one style for objects and stick to it; consistency matters more than the choice.

Common mistakes

  • Thinking interfaces are "faster" or "better" in every case. For most code there is no practical difference.
  • Trying to write a union with an interface. Unions need type.
  • Accidentally merging two interfaces with the same name in one file and getting surprising extra fields.

What to say in the interview

"Both interface and type describe shapes, and for plain objects they are mostly interchangeable. Interfaces can be extended and support declaration merging, which is useful for public APIs. Type aliases are more flexible: they can name unions, tuples, primitives and advanced mapped or conditional types. I usually use interfaces for object contracts and type aliases for unions and utility types, and I follow the team's convention."

Follow-up questions

  • What is declaration merging and when is it useful?
  • How do you extend a type alias?
  • Can a class implement a type alias?

#types#interfaces

Related questions

Practise more TypeScript questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open TypeScript quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.