Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumTypeScriptdiscriminated unionsSingle-choice MCQ

Why does passing `c` to `area` fail to type-check?

type Shape = | { kind: "circle"; radius: number } | { kind: "square"; side: number }; function area(s: Shape) { /* ... */ } const c = { kind: "circle", radius: 1 }; area(c);