// T musí mít vlastnost 'length'
function printLength<T extends { length: number }>(item: T): void {
    console.log(item.length);
}

// Použití:
printLength("hello");     // OK - string má length
printLength([1, 2, 3]);   // OK - pole má length
printLength({ length: 5 }); // OK - objekt má vlastnost length
printLength(123);         // Chyba - číslo nemá length