TypeScript · easy
Billing uses one document builder for invoices and credits, but every call currently produces an invoice. A credit note therefore charges the customer again instead of returning the money.
Build the document that matches the requested kind: invoices keep a positive total and credits make it negative. makeDoc("invoice", 10) → { type: "invoice", total: 10 }; makeDoc("credit", 10) → { type: "credit", total: -10 }.
workspace/
└── src/
└── docs.ts (always builds an invoice)With sharpen installed, this command opens exactly this challenge in your local arena:
sharpen 24
First time? The full install is right below.
npm install -g @juanwmedia/sharpen sharpen 24 npx @juanwmedia/sharpen 24 sharpen update