Find: Incorrect Interface
Find the Mistake Easy
Question
This code has a type error. Find the mistake:
Code
interface Person {
name: string;
age: number;
}
const p: Person = { name: "Alice" };
Hint
Compare the object properties against the interface definition.
Explanation
The object is missing the required age property. The interface Person requires both name and age, but the object only has name. TypeScript errors: Property 'age' is missing. Fix: add the age property: { name: "Alice", age: 30 } or make age optional in the interface.
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.