Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumTypeScriptuser-defined type guardsSingle-choice MCQ

In the `else` branch, what is the narrowed type of `pet`?

interface Cat { meow(): void } interface Dog { bark(): void } function isCat(pet: Cat | Dog): pet is Cat { return (pet as Cat).meow !== undefined; } function handle(pet: Cat | Dog) { if (isCat(pet)) { // ... } else { pet; // <-- here } }