Fill: Type Guard
Fill in the Blank Medium
Question
Fill in the blank to make this a valid type guard:
Code
function isError(x: unknown): x ___ Error {
return x instanceof Error;
}
Hint
Type guards use a special keyword in the return type predicate.
Explanation
The keyword is is. The full signature is x is Error. The is keyword creates a type predicate that tells TypeScript: if this function returns true, x is of type Error.
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.