Explore Library
Code QuizAdvanced

Interface Property Type Mismatch

Spot the type annotation error when building an object from an interface.

Codetypescript
interface User {
  id: number;
  name: string;
  isActive: boolean;
}

const user: User = {
  id: "123",
  name: "Alice",
  isActive: true
};

console.log(user.id);

What is the bug in this code that causes a TypeScript compile error?