Type Guards Quiz
Multiple Choice Medium
Question
Which of the following is a valid user-defined type guard?
Hint
Type guards use a special return type predicate with the is keyword.
Explanation
A user-defined type guard uses the x is Type predicate as its return type. This tells TypeScript that if the function returns true, the parameter x is of type Type. The is keyword is the defining feature of type guards.
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.