import { type IsEqual, type AnyFunction, type UnionToIntersection } from "./types"; type ExtractIntersection[], GenericResult extends unknown = GenericInput> = GenericPredicatedInput extends [ (input: any) => input is infer InferredPredicate, ...infer InferredRest extends AnyFunction[] ] ? Extract extends infer InferredResult extends GenericInput ? InferredRest extends readonly [] ? InferredResult : ExtractIntersection : never : never; type ExtractPredicate[]> = GenericPredicatedInput extends [ (input: any) => input is infer InferredPredicate, ...infer InferredRest extends AnyFunction[] ] ? InferredRest extends readonly [] ? InferredPredicate : InferredPredicate | ExtractPredicate : GenericInput; type ComputeResult[]> = ExtractIntersection extends infer InferredResult extends GenericInput ? IsEqual extends true ? GenericInput & UnionToIntersection> : InferredResult : never; /** * The and() function combines several predicates or type guards. All must succeed for the result to be true and the type to be narrowed to the intersection. * * **Supported call styles:** * - Classic: `and(input, predicates)` → returns a value * - Curried: `and(predicates)` → returns a function waiting for the input * - Classic predicate: `and(input, predicates)` → narrows the input type * - Curried predicate: `and(predicates)` → narrows the input type * * Predicate overloads (type guards) narrow the output type. * * ```ts * interface Admin { * type: "admin"; * status: "active"; * meta: { * role: "super"; * }; * } * * interface Viewer { * type: "viewer"; * status: "active"; * meta: { * role: "reader"; * }; * } * * const result = pipe( * { * type: "admin", * status: "active", * meta: { * role: "super", * }, * } as Admin | Viewer, * when( * and([ * DObject.discriminate("type", "admin"), * DObject.discriminate("status", "active"), * ]), * (value) => { * // type: Admin * }, * ), * ); * ``` * * @see https://utils.duplojs.dev/en/v1/api/common/and * */ export declare function and input is any, (input: GenericInput) => input is any, ...((input: GenericInput) => input is any)[] ]>(predicatedList: GenericArrayPredicatedInput): (input: GenericInput) => input is ComputeResult; export declare function and(predicatedList: [ (input: GenericInput) => boolean, (input: GenericInput) => boolean, ...((input: GenericInput) => boolean)[] ]): (input: GenericInput) => boolean; export declare function and input is any, (input: GenericInput) => input is any, ...((input: GenericInput) => input is any)[] ]>(input: GenericInput, predicatedList: GenericArrayPredicatedInput): input is ComputeResult; export declare function and(input: GenericInput, predicatedList: [ (input: GenericInput) => boolean, (input: GenericInput) => boolean, ...((input: GenericInput) => boolean)[] ]): boolean; export {};