Code Room
Vibe codingMediumvc-g037
Subject Ai code reviewLevel Mid–Senior~14 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

An AI assistant wrote this TypeScript to deep-merge a partial user override onto defaults for a settings page:

typescript
function merge<T extends object>(base: T, override: Partial<T>): T {  const out: any = { ...base };  for (const key in override) {    const v = override[key];    if (typeof v === "object") {      out[key] = merge(out[key], v as any);    } else {      out[key] = v;    }  }  return out;}

The basic case works. Which inputs break it, and why is this subtly worse than a shallow merge?

What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.