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

Two members of this union share the SAME discriminant value. Inside the `if`, what is the narrowed type of `u`?

type U = | { tag: "a"; x: number } | { tag: "a"; y: string } | { tag: "b"; z: boolean }; function handle(u: U) { if (u.tag === "a") { // narrowed type of u here? } }