Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptconditional-type distributionSingle-choice MCQ1 views

Consider this attempt to convert a union to an intersection. What is `R`, and which type-system feature is being exploited?

type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; type R = UnionToIntersection<{ a: 1 } | { b: 2 }>;