In the invoice preview service, after a recent refactor, two regressions appeared. The code still compiles, but in a number of scenarios the service either reports success where the source data is unusable, or starts behaving unpredictably after the caller changes the result.
loadInvoicePreview(invoiceId) accepts a string invoice identifier.InvoicePreview can be safely assembled:
invoiceId — string;customer — non-empty string;lines — an array of objects with title and amount fields;total — a finite number.Invalid invoice preview payload.invoiceId.src/invoicePreview.ts.lines with string amount values or an empty customer name.loadInvoicePreview(' inv-42 '), then change lines[0].title on the returned object or add a new item to lines, after which call inv-42 again.5.822ES modulesstrict=trueUse line comments to explain the problem, its impact, the fix and how to test it.