import type {Primitive} from './primitive'; /** Returns a boolean for whether the two given types are equal. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 */ export type IsEqual = (() => G extends T ? 1 : 2) extends (() => G extends U ? 1 : 2) ? true : false; /** Infer the length of the given array ``. @link https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f */ type TupleLength = T extends {readonly length: infer L} ? L : never; /** Create a tuple type of the given length ``. @link https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f */ type BuildTuple = T extends {readonly length: L} ? T : BuildTuple; /** Create a tuple of length `A` and a tuple composed of two other tuples, the inferred tuple `U` and a tuple of length `B`, then extracts the length of tuple `U`. @link https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f */ export type Subtract = BuildTuple extends [...(infer U), ...BuildTuple] ? TupleLength : never; /** Matches any primitive, `Date`, or `RegExp` value. */ export type BuiltIns = Primitive | Date | RegExp; /** Gets keys from a type. Similar to `keyof` but this one also works for union types. The reason a simple `keyof Union` does not work is because `keyof` always returns the accessible keys of a type. In the case of a union, that will only be the common keys. @link https://stackoverflow.com/a/49402091 */ export type KeysOfUnion = T extends T ? keyof T : never; export type UpperCaseCharacters = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z'; export type WordSeparators = '-' | '_' | ' '; export type StringDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';