import type {AndAll} from './and-all.d.ts'; // For `@link` import type {Or} from './or.d.ts'; // For `@link` import type {Xor} from './xor.d.ts'; // For `@link` /** Returns a boolean for whether two given types are both `true`. Use-case: Constructing complex conditional types where multiple conditions must be satisfied. An `any` operand is treated as `boolean`; non-boolean operands are rejected. @example ``` import type {And} from 'type-fest'; type TT = And; //=> true type TF = And; //=> false type FT = And; //=> false type FF = And; //=> false ``` Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases. For example, `And` expands to `And | And`, which simplifies to `true | false` (i.e., `boolean`). @example ``` import type {And} from 'type-fest'; type A = And; //=> boolean type B = And; //=> boolean type C = And; //=> false type D = And; //=> false type E = And; //=> boolean ``` Note: If either of the types is `never`, the result becomes `false`. @example ``` import type {And} from 'type-fest'; type A = And; //=> false type B = And; //=> false type C = And; //=> false type D = And; //=> false type E = And; //=> false type F = And; //=> false type G = And; //=> false ``` @see {@link AndAll} @see {@link Or} @see {@link Xor} */ export type And = // Keep generic operands conditional; the tuple matcher can prematurely narrow their unresolved result to `false`. [A] extends [never] ? false : [B] extends [never] ? false : A extends true ? B extends true ? true : false : false; export {};