```ts
function lineCost(price: number, quantity: number): number {
  if (typeof price !== 'number' || typeof quantity !== 'number') {
    throw new Error('Both price and quantity must be numbers');
  }
  return Math.round(price * quantity);
}

function basketCost(lines: { price: number; quantity: number }[], discount: number): number {
  if (!Array.isArray(lines) || lines.length === 0) {
    return 0;
  }

  const totalLineCost = lines.reduce((acc, line) => acc + lineCost(line.price, line.quantity), 0);

  if (discount > 100) {
    throw new Error('Discount cannot be above one hundred percent');
  }

  const discountAmount = Math.round(totalLineCost * (discount / 100));
  return Math.floor((totalLineCost - discountAmount) / 10) * 10;
}
```