CHALLENGE 2: Inference vs Annotation ==================================== ANSWER: const x = 42; // ✅ Inference works (clearly a number) const y = null; // ❌ NEEDS ANNOTATION function process(value) { ... } // ❌ NEEDS ANNOTATION const isReady = true; // ✅ Inference works (clearly a boolean) DETAILED EXPLANATION: 1. "const x = 42" - Inference: ✅ Clear it's a number - Keep it: const x = 42; - No annotation needed 2. "const y = null" - Inference: ❌ TypeScript infers type 'null' (too specific!) - You probably want it to accept null OR some other type later - Fix it: const y: string | null = null; OR: const y: number | null = null; - The annotation clarifies your intent 3. "function process(value) { ... }" - Inference: ❌ Parameter has no type (inferred as 'any') - ALWAYS annotate function parameters - Fix it: function process(value: string): void { ... } OR: function process(value: unknown): unknown { ... } - Depends on what the function does 4. "const isReady = true" - Inference: ✅ Clear it's a boolean - Keep it: const isReady = true; - No annotation needed GOLDEN RULE: - Variables assigned clear values? Use inference - Function parameters? ALWAYS annotate - Variables that might be null? ALWAYS annotate - Function return values? Highly recommended