Comments worth keeping
It reads the surrounding code, then proposes the exact change. Apply it from the thread.
38
export function invoiceTotal(lines: Line[], plan: Plan) {39
const subtotal = lines.reduce((sum, l) => sum + l.amount, 0);40−
const discount = subtotal * plan.discount;40+
Kilnon line 40
Suggested change
const discount = subtotal * (plan.discount?.rate ?? 0);41+
const tax = roundCents(subtotal - discount) * plan.taxRate;42
return { subtotal, discount, tax };