```ts
export 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);
}

export function basketCost(lines: { price: number; quantity: number }[], discount: number): number {
    if (!Array.isArray(lines)) {
        throw new Error('The lines parameter must be an array.');
    }
    if (typeof discount !== 'number' || isNaN(discount) || discount > 100) {
        throw new Error('Discount must be a number between 0 and 100 inclusive.');
    }

    const totalCost = lines.reduce((acc, line) => acc + lineCost(line.price, line.quantity), 0);
    const discountedTotal = Math.floor(totalCost * (1 - discount / 100));
    return discountedTotal;
}
```