Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 586 Bytes

File metadata and controls

26 lines (17 loc) · 586 Bytes

Home > types-kit > UnionToIntersection

UnionToIntersection type

Convert union type to Intersection type.

Signature:

export type UnionToIntersection<U> = (
  U extends any ? (k: U) => void : never
) extends (k: infer I) => void
  ? I
  : never

Example

// Expect: { a: number } & { b: number }
type Props = UnionToIntersection<{ a: number } | { b: number }>