Spot the bug in firstLabel

from Basic types
TypeScript 6 beginner 4 min 1 issue to find

Find the unchecked assumption in this generated label helper.

TypeScript
function firstLabel(labels: string[]): string {
  return labels[0].toUpperCase();
}

console.log(firstLabel([]));
Open in playground
Report an error