Code Room
Code reviewHardcr-g351
Subject Contract violationsLevel Senior–Staff~25 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this TypeScript handler for `PATCH /users/:id` that updates a user profile.

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
app.patch('/users/:id', async (req, res) => {  const body = req.body as Partial<UserProfile>;  const updated: UserProfile = {    name: body.name,    email: body.email,    bio: body.bio,    phone: body.phone,    notifications: body.notifications,  };  await db.users.replace(req.params.id, updated);  res.json(updated);});
Run or narrate your approach, then ask the coach.