clean-jsdoc-theme TypeDoc APIv0.0.0

UnionToIntersection

UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never

Source: common.ts:317

Union to intersection type conversion

Type Parameters

  • U — Union type

Example

CODE
type A = { a: string }
type B = { b: number }
type AB = UnionToIntersection<A | B>
// { a: string } & { b: number }