Find: Wrong Utility Type
Find the Mistake Medium
Question
This code has a type error. Find the mistake:
Code
interface User { id: number; name: string; email: string; }
type Update = Pick<User, "id" | "name">;
const update: Update = { name: "Bob", email: "[email protected]" };
Hint
Check which properties Pick selects vs what the object provides.
Explanation
The Pick<User, "id" | "name"> type only has id and name properties — email is not included. The object has email which is not in the picked type, and is missing id. TypeScript errors: 'email' does not exist in type 'Update' and 'id' is missing. Fix: use Pick<User, "name" | "email"> or provide the correct properties.
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.