/** * If A extends B, returns Then (default true) or else Else (default false) * @example * ```ts * Extends<1, number> => true * Extends<1, string> => false * Extends<1, number, 'a', 'b'> => 'a' * Extends<1, string, 'a', 'b'> => 'b' * ``` */ export type Extends = A extends B ? Then : Else; /** * If A does not extend B, returns Then (default true) or else Else (default false) * @example * ```ts * NotExtends<1, number> => false * NotExtends<1, string> => true * NotExtends<1, number, 'a', 'b'> => 'b' * NotExtends<1, string, 'a', 'b'> => 'a' * ``` */ export type NotExtends = A extends B ? Else : Then; /** * Returns never if the given type is false, otherwise unknown. * @example * ```ts * Check> => unknown * Check> => never * ``` */ export type Check = V extends false ? never : unknown; /** * Returns never if the given type is false, otherwise true. * @example * ```ts * Validate> => true * Validate> => never * ``` */ export type Validate = V extends false ? never : true; /** * Returns false is the given type is false, true otherwise. * @example * ```ts * Pred => false * Pred => true * Pred => true * ``` */ export type Pred = V extends false ? false : true; /** * Returns true if the input type is false, and false if the input type is true. * @example * ```ts * Not => false * Not => true * Not => never * ``` */ export type Not = boolean extends V ? never : V extends true ? false : true;