// Vlastní utility typ pro objekty s ID
type HasId<T> = T & { id: string };

// Místo generic constraint
function processEntity<T>(entity: HasId<T>) {
    console.log(entity.id);
    return entity;
}

// Použití:
const user = { id: "123", name: "Jan" };
processEntity(user); // OK