Difference between Type and Interface in Typescript.
🚀 “What’s the difference between type and interface in TypeScript?” — The Most Asked Interview Question!
Last week during a technical interview, the interviewer smiled and asked me one of the classic TypeScript questions:
👉 “Can you tell me the difference between type and interface?”
I’ve been asked this so many times that I finally decided to put the answer here for everyone who is preparing for React / React Native / TypeScript interviews.
🟦 My simple, interview-friendly answer:
1️⃣ interface is mainly for objects
It’s TypeScript’s way of defining the shape of an object. And yes — interfaces can be extended easily.
interface User {
name: string;
age: number;
}
interface Employee extends User {
salary: number;
}
2️⃣ type is more flexible
It can represent unions, primitives, tuples, functions, etc.
type Status = "success" | "error";
type Point = [number, number];
type UserFn = () => void;
🟩 3️⃣ Both can describe objects — that’s where confusion begins
type User = { name: string }
interface User { name: string }
Both work. But their abilities differ 👇
🟧 4️⃣ Interfaces can merge, types cannot
If you declare an interface twice, TypeScript merges them automatically:
interface User { name: string }
interface User { age: number }
// becomes:
interface User { name: string; age: number }
❌ Doing this with type gives an error.
🟪 5️⃣ Types support unions & intersections
This is something interfaces cannot do:
type ApiResponse = SuccessResponse | ErrorResponse;
🎯 My closing line in the interview:
“Use interface when modelling objects and extending shapes. Use type when you need flexibility like unions, tuples, or combining multiple types.”
Interviewer nodded. ✔️ Interview continued smoothly. 😄
💬 What about you?
Have you been asked this question too? How do you answer it?
meaningful
meaningful 💫