Code Room
Code reviewHardcr-g347
Subject Backward compatibilityLevel Senior–Staff~25 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

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.

Talk through your review
Code to reviewtypescript
// before:  return { id: o.id, total: o.totalCents / 100 }function serializeOrder(o: Order) {  return {    id: o.id,    status: o.status,    total: formatCurrency(o.totalCents, o.currency), // "$42.00"    currency: o.currency,  };} function formatCurrency(cents: number, ccy: string): string {  return new Intl.NumberFormat('en-US', {    style: 'currency', currency: ccy,  }).format(cents / 100);}
Run or narrate your approach, then ask the coach.