Code QuizIntermediate

Using keyof as a Constraint

Spot why the key parameter isn't restricted to the object's keys.

Codetypescript
function getProp<T, K>(obj: T, key: K): T[K] {
  return obj[key];
}

getProp({ name: "Ada" }, "name");

What is the bug in this property accessor?