/** * And (same as Extract) * @desc Set intersection of given union types `A` and `B` * @example * // Expect: "2" | "3" * And<'1' | '2' | '3', '2' | '3' | '4'>; * * // Expect: () => void * And void), Function>; */ export declare type And = A extends B ? A : never; /** * Diff (same as Exclude) * @desc Set difference of given union types `A` and `B` * @example * // Expect: "1" * Diff<'1' | '2' | '3', '2' | '3' | '4'>; * * // Expect: string | number * Diff void), Function>; */ export declare type Diff = A extends B ? never : A; /** * Complement * @desc Set complement of given union types `A` and (it's subset) `A1` * @example * // Expect: "1" * Complement<'1' | '2' | '3', '2' | '3'>; */ export declare type Complement = Diff; /** * SymDiff * @desc Set difference of union and intersection of given union types `A` and `B` * @example * // Expect: "1" | "4" * SymDiff<'1' | '2' | '3', '2' | '3' | '4'>; */ export declare type SymDiff = Diff; /** * Undef * @desc Exclude undefined from set `A` * @example * // Expect: "string | null" * SymDiff; */ export declare type Undef = A extends undefined ? never : A; /** * FunctionKeys * @desc Get union type of keys that are functions in object type `T` * @example * type MixedProps = {name: string; setName: (name: string) => void; someKeys?: string; someFn?: (...args: any) => any;}; * * // Expect: "setName | someFn" * type Keys = FunctionKeys; */ export declare type FunctionKeys = { [K in keyof T]-?: Undef extends Function ? K : never; }[keyof T]; /** * NonFunctionKeys * @desc Get union type of keys that are non-functions in object type `T` * @example * type MixedProps = {name: string; setName: (name: string) => void; someKeys?: string; someFn?: (...args: any) => any;}; * * // Expect: "name | someKey" * type Keys = NonFunctionKeys; */ export declare type NonFunctionKeys = { [K in keyof T]-?: Undef extends Function ? never : K; }[keyof T]; /** * RequiredKeys * @desc Get union type of keys that are required in object type `T` * @see https://stackoverflow.com/questions/52984808/is-there-a-way-to-get-all-required-properties-of-a-typescript-object * @example * type Props = { req: number; reqUndef: number | undefined; opt?: string; optUndef?: number | undefined; }; * * // Expect: "req" | "reqUndef" * type Keys = RequiredKeys; */ export declare type RequiredKeys = { [K in keyof T]-?: {} extends Pick ? never : K; }[keyof T]; /** * OptionalKeys * @desc Get union type of keys that are optional in object type `T` * @see https://stackoverflow.com/questions/52984808/is-there-a-way-to-get-all-required-properties-of-a-typescript-object * @example * type Props = { req: number; reqUndef: number | undefined; opt?: string; optUndef?: number | undefined; }; * * // Expect: "opt" | "optUndef" * type Keys = OptionalKeys; */ export declare type OptionalKeys = { [K in keyof T]-?: {} extends Pick ? K : never; }[keyof T]; //# sourceMappingURL=set-types.d.ts.map