Type Aliases vs Interfaces
Both describe object shapes. Interfaces can be extended and merged, while type aliases can also name unions, tuples and mapped types. Pick one style and stay consistent.
Example
interface User { id: number }
interface User { name: string }
type Id = string | number;
type Pair = [string, number];
const u: User = { id: 1, name: "Ada" };
const p: Pair = ["a", 1];
console.log(u.name, p[1]);Result
Ada 1
Exercise
Merge declarations.
User { id: number }Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.