import type {If} from './if.d.ts'; import type {And} from './and.d.ts'; // For `@link` import type {Or} from './or.d.ts'; // For `@link` /** Returns a boolean for whether only one of two given types is `true`. Use-case: Constructing complex conditional types where one single condition must be satisfied. An `any` operand is treated as `boolean`; non-boolean operands are rejected. @example ``` import type {Xor} from 'type-fest'; type TT = Xor; //=> false type TF = Xor; //=> true type FT = Xor; //=> true type FF = Xor; //=> 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, `Xor` expands to `Xor | Xor`, which simplifies to `true | false` (i.e., `boolean`). @example ``` import type {Xor} from 'type-fest'; type A = Xor; //=> boolean type B = Xor; //=> boolean type C = Xor; //=> boolean type D = Xor; //=> boolean type E = Xor; //=> boolean ``` Note: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly. @example ``` import type {Xor} from 'type-fest'; type A = Xor; //=> true type B = Xor; //=> true type C = Xor; //=> false type D = Xor; //=> false type E = Xor; //=> boolean type F = Xor; //=> boolean type G = Xor; //=> false ``` @see {@link And} @see {@link Or} */ // Branch on each operand directly; `If` treats `never` as false and distributes `any` and `boolean`. export type Xor = If, If>; export {};