UNPKG

rivo

Version:

🤖 The ultimate library you need for composable type-level programming in TypeScript, powered by HKT.

19 lines (16 loc) • 444 B
import type { ToIntersection } from "./ToIntersection"; import type { Arg0, Fn } from "../HKT"; /** * Check whether a type is a union type. * * Sig: `(x: unknown) => boolean` */ export type IsUnion<U> = [U] extends [ToIntersection<U>] ? false : true; /** * [Fn] Check whether a type is a union type. * * Sig: `(x: unknown) => boolean` */ export interface IsUnionFn extends Fn<[unknown], boolean> { def: () => IsUnion<Arg0<this>>; }