Narrow with Type Guards
Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.
The problem
- medium
- Pro
A function accepts either a string, a list of strings or an error object, and needs to handle each differently. Explain how TypeScript narrows a union type inside your checks, and how you'd write your own reusable type guard.
Talk this problem through with an AI coach
This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.