Code QuizIntermediate

Generic Collection Utility

Finding the type mismatch in a generic first-element helper.

Codetypescript
function first<T>(arr: T): T {
  return arr[0];
}

const nums = [10, 20, 30];
const n = first(nums);

What is the bug in this code?