Code Room
Code reviewHard
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.
Learn the concepts
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.