Review code with anchored comments.

Start with uploaded files, pasted code, a public Git URL, or a blank workspace, then share a Cote for precise line-by-line review.

Drag files or folders hereClick to select files from your computer
Start without files
TScalculate-pricing.ts2 open threads
38export function calculatePricing(input: PricingInput) {
39 const subtotal = input.items.reduce((sum, item) => {
40 return sum + item.price * item.quantity;
41 }, 0);
42
43 const discount = getDiscount(subtotal, input.customer);
44 const taxableAmount = subtotal - discount.amount;
45
46 const tax = calculateTax(taxableAmount, {
47 region: input.customer.region,
48 category: input.options?.category ?? "standard",
49 currency: input.currency,
50 });
51
52 return roundMoney(taxableAmount + tax.amount);
53}
Maya TanLines 43-44

Guard against discounts larger than the subtotal before this value reaches tax.

Review Issue
Arun LeeLines 48-49

Extract these tax options into a named object so the student can test them directly.

Fix Prompt