declare type UnionDescription = Record any>; declare type UnionResult = { T: Union; is: (name: NAME) => >(other: U) => other is ReturnType & { type: NAME; }; } & { [K in keyof T]: Factory & { T: ReturnType>; }; }; declare type ReturnType = T extends (...args: any[]) => infer R ? R : any; declare type Factory any, TYPE> = (...args: Arguments) => F extends (...args: any[]) => infer R ? { [K in keyof R | 'type']: K extends 'type' ? TYPE : R[K & keyof R]; } : (...args: any[]) => any; declare type Union = { [K in keyof T]: { [K2 in keyof ReturnType | 'type']: K2 extends 'type' ? K : ReturnType[K2]; }; }[keyof T]; declare type Arguments any> = T extends (...args: infer A) => any ? A : []; /** * Creates a type-safe union, providing: derived types, factories and type-guards in a single declaration. */ export declare function createUnion(description: D): UnionResult; export {};