UNPKG

@finsweet/ts-utils

Version:

Typescript utils for custom Webflow projects.

5 lines (4 loc) 263 B
/** * Converts a union like `Interface1 | Interface2` to an intersection `Interface1 & Interface2`. */ export type UnionToIntersection<Union> = (Union extends unknown ? (k: Union) => void : never) extends (k: infer Intersection) => void ? Intersection : never;