```typescript
export function lineCost(price: number, quantity: number): number {
  if (isNaN(price) || isNaN(quantity)) {
    throw new Error("Both price and quantity must be numbers.");
  }
  return Math.round(price * quantity);
}

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

  const total = lines.reduce((sum, line) => sum + line.price * line.quantity, 0);

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

  const discountedTotal = Math.round(total - (total / 100) * discount);
  return Math.floor(discountedTotal);
}
```