UNPKG

rambda

Version:

Lightweight faster alternative to Ramda

26 lines (24 loc) 571 B
import {Boolean, False, True} from './Boolean' /** Logical **`^`** operator (behaves like the JS one) * @param B1 Left-hand side * @param B2 Right-hand side * @returns **`Boolean`** * @example * ```ts * import {B} from 'ts-toolbelt' * * type test0 = B.Xor<B.True, B.True> // False * type test1 = B.Xor<B.False, B.True> // True * type test2 = B.Xor<B.Boolean, B.True> // Boolean * ``` */ export type Xor<B1 extends Boolean, B2 extends Boolean> = { 0: { 0: False 1: True } 1: { 0: True 1: False } }[B1][B2]