Explore Library
Code Quiz

Type Alias vs Interface Merging

A duplicate type alias declaration reveals a key difference between type aliases and interfaces.

Codetypescript
type User = {
  name: string;
};

type User = {
  age: number;
};

const u: User = { name: "Ann", age: 30 };
console.log(u.name, u.age);

What is the bug in this code?