Explore Library
Code QuizIntermediate

Default Type Parameter Mismatch

A generic interface with a default type parameter is used with a value that violates that default.

Codetypescript
interface Container<T = number> {
  value: T;
}

// No type argument given, so T falls back to the default
const box: Container = { value: "hello" };

console.log(box.value);

What is the bug in this code?