Code RoomTotal field type changed
HardPrep Room Coding #1975

Total field type changed

Code reviewCode quality & reviewSenior–Staff~25 min

Review this TypeScript serializer change to a public v1 order API. The `total` field used to be a number; a teammate switched it to a formatted string to display currency.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 25 min
Mark a line and say what kind of problem it is.0 findings
1// before: return { id: o.id, total: o.totalCents / 100 }
2function serializeOrder(o: Order) {
3 return {
4 id: o.id,
5 status: o.status,
6 total: formatCurrency(o.totalCents, o.currency), // "$42.00"
7 currency: o.currency,
8 };
9}
10 
11function formatCurrency(cents: number, ccy: string): string {
12 return new Intl.NumberFormat('en-US', {
13 style: 'currency', currency: ccy,
14 }).format(cents / 100);
15}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.