/** * Defines boolean type opeartor tree type. * E.g. * ```ts * import { Op } from 'ts-typedefs'; * type ExampleBoolOp = Op.Or< * Op.If< Op.UnionIncludes, * Not>, * false * >, * Op.Extends * >; * ``` */ export type BoolOp = ( | true | false | If | Not | Or | Nor | And | Nand | Xor | Equiv | UnionIncludes | Extends ); /** * Defines a logical ternary operator. * @param TCond Boolean type that controlls which branch to choose. * @param TIfTrue True branch operator. * @param TElse False branch operator. */ export interface If< TCond extends BoolOp, TIfTrue extends BoolOp, TElse extends BoolOp = never > { 'ts-typedefs.Op.If': [TCond, TIfTrue, TElse]; } /** * Defines a logical negation operator applied to the given `TBoolOp`. */ export interface Not { 'ts-typedefs.Op.Not': TBoolOp; } /** * Defines a logical `and` operator applied to all the given `TBoolOps`. */ export interface And { 'ts-typedefs.Op.And': TBoolOps; } /** * Defines a logical `or` operator applied to all the given `TBoolOps`. */ export interface Or { 'ts-typedefs.Op.Or': TBoolOps; } /** * Defines a logical `not and` operator applied to all the given `TBoolOps`. * Same as `Op.Not>`. */ export interface Nand { 'ts-typedefs.Op.Nand': TBoolOps; } /** * Defines a logical `not or` operator applied to all the given `TBoolOps`. * Same as `Op.Not>`. */ export interface Nor { 'ts-typedefs.Op.Nor': TBoolOps; } /** * Defines a logical `xor` operator applied to the given `TBoolOp1` and `TBoolOp2`. * Same as `Op.Not>`. */ export interface Xor { 'ts-typedefs.Op.Xor': [TBoolOp1, TBoolOp2]; } /** * Defines a logical `equivalence` operator applied to the given `TBoolOp1` and `TBoolOp2`. * Same as `Op.Not>`. */ export interface Equiv { 'ts-typedefs.Op.Equiv': [TBoolOp1, TBoolOp2]; } /** * Defines a logical operator that verifies the given parameter to extend `TExtendee`. */ export interface Extends { 'ts-typedefs.Op.Extends': TExtendee; } /** * Shorthand for `Op.Not>`. */ export type NotExtends = Not>; /** * Defines the logical operator to check that the given parameter extends `TExtendee`. */ export interface UnionIncludes { 'ts-typedefs.Op.UnionIncludes': TNeedle; } /** * Shorthand for `Op.Not>`. */ export type UnionExcludes = Not>;