Type Inference Quiz
Multiple Choice Easy
Question
What type does TypeScript infer for `let x = 42;`?
Hint
TypeScript widens literal values to their base type for mutable variables.
Explanation
TypeScript infers number for let x = 42;. For let variables, the literal 42 is widened to its base type number because the variable could be reassigned. If you used const x = 42;, TypeScript would infer the literal type 42 since const cannot be reassigned.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.