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

Why does TypeScript reject this type-guard declaration?

interface Animal { legs: number } interface Plant { leaves: number } function isPlant(x: Animal): x is Plant { return true; }