Quiz · Generics · lesson 6 of 10
Quiz — a constraint
On which line does tsc report an error?
function longest<T extends { length: number }>(a: T, b: T): T {
return a.length >= b.length ? a : b;
}
console.log(longest("cat", "horse"));
console.log(longest(10, 200));