Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptexcess property checksSingle-choice MCQ

A fresh object literal is assigned to a discriminated union. Why is the property `y` reported as an error here?

type A = { kind: "a"; x: number }; type B = { kind: "b"; y: number }; const v: A | B = { kind: "a", x: 1, y: 2 };