//#region src/api/api.d.ts /** * **ValueCallback**`` * * A type utility to build a simple "value callback". * * ```ts * // (v: V) => `hi ${string}`; * type T = ValueCallback; * ``` */ type ValueCallback = (v: V) => TReturn; type _GetEscapeFunction = WhenNever, T[K], never> }>>, Err<"no-escape-function">>; /** * **GetEscapeFunction**`` * * Gets an escape function from an `Api` and from a `Dictionary | TypeFunction` * if it exists. If it does not exist then returns an ErrorCondition. */ type GetEscapeFunction = T extends Api ? T["surface"] extends Dictionary ? _GetEscapeFunction> : T["surface"] extends TypedFunction ? _GetEscapeFunction>> : Err<"no-escape-function"> : T extends Dictionary ? _GetEscapeFunction> : T extends TypedFunction ? _GetEscapeFunction>> : Err<"no-escape-function">; interface FluentState { state: T; config: { useOnce: keyof T[]; used: keyof T[]; }; } interface FluentFn>(state: T) => TypedFunction), TOnce extends boolean>(cb: TCb, useOnce?: TOnce) => void, TOnce extends boolean = false> { name: TName; fn: TFn; useOnce: TOnce; } type ExpandFluentFns, TFns extends readonly FluentFn[], TFluentApi extends Dictionary = EmptyObject> = [] extends TFns ? TFluentApi : ExpandFluentFns, TFluentApi & Record["name"], First$1["fn"]>>; /** * **FluentApi**`` * * Defines the callback loop necessary to manage state via a * Fluent API. */ type FluentApi[]> = >(state: T) => ExpandRecursively, TFluentFns>>; /** * **ApiState** * * For API's which manage state, the state should be a Dictionary * or Tuple in shape. */ type ApiState = Dictionary | Tuple$1; /** * **ApiConfig**`` * * The configuration of your API provides opportunities to * show or mask various parts of your surface area based on * the current _state_ you are in. */ interface ApiConfig = ApiSurface, TState extends ApiState = ApiState> { callOnce: readonly string[]; called: readonly string[]; mask: ((state: TState, called: readonly string[]) => readonly (KeyOf : EmptyObject>)[]); } /** * **ApiOptions**`<[TSurface]>` * * The _options_ which go into defining an API surface. */ interface ApiOptions { /** * any _state_ which the API is managing (making it a `FluentApi`) * * @default Unset; */ state: Unset | Dictionary; /** * An array of _keys_ to the API surface which should only be allowed * to be called once (and will be _masked_ thereafter from runtime). * * **Note:** _this only really makes sense when you're managing state_. */ callOnce: TSurface extends Unset ? readonly PropertyKey[] : TSurface extends Dictionary | TypedFunction ? readonly PublicKeyOf : EmptyObject>[] : never; } /** * **Api** * * An API definition typically created via `AsApi` which is * not responsible for managing state. * * **Related:** `FluentApi`, `AsFluentApi` */ interface Api { _kind: "api"; surface: TSurface; } /** * **ApiReturn** * * The expected/desired types that could result from calling the API's * _endpoints_. * * Note: this does not consider the possibility of a user */ type ApiReturn = "surface" extends keyof T ? T["surface"] extends Dictionary ? TupleToUnion> : never : unknown; /** * **ApiSurface**`` * * Extracts the API's surface area from an `Api`. */ type ApiSurface = T["surface"]; /** * **ApiCallback**`` * * Defines a callback function which receives an API Surface (`TSurface`). * It is required that one of the properties on this surface be designated * as an `EscapeFunction` and if that is not done this utility will produce * an `ErrorCondition<"no-escape-function">`. * * * **Related:** `HandleApiCallback`, `ApiCallbackInfo` */ type ApiCallback = ) => unknown>(cb: TCall) => ReturnType; /** * **Api**`` * * Validates a candidate for a _stateless_ API and returns it as an `Api` * if valid. If not valid you'll get a `ErrorCondition`. */ type AsApi = HasEscapeFunction extends true ? Api : Err<"no-escape-function">; type ApiStateInitializer = (state: T) => TApi; /** * A builder API for defining _stateless_ API's. * * Note: ironically this is **not** a stateless API. */ interface DefineStatelessApi[]; callOnce: ["escapeFunction"]; } = { called: []; callOnce: ["escapeFunction"]; }> { escapeFunction: (state: T) => unknown>(key: Fail>>, fn: TFn) => ReturnType; addFn: (state: T) => (key: Fail>, fn: TFn) => ExpandRecursively> extends T["surface"] ? UpsertKeyValue>> : never; } /** * **ApiEscape**`` * * Given a `T` which extends `Api` or `ApiCallback`, this utility will expose * the escape function. */ type ApiEscape> = T extends ApiCallback ? T extends TypedFunction ? Parameters[0] extends Dictionary | TypedFunction ? GetEscapeFunction[0]> : never : never : GetEscapeFunction; /** * **ApiHandler**`` * * An API handler for a specific API */ type ApiHandler unknown> = (api: TApi) => (result: R) => unknown; //#endregion //#region src/api/Callback.d.ts /** * **Callback**`<[TArgs], [TRtn]>` * * Defines the general shape of a _callback function_. */ type Callback = AsNarrowingFn; //#endregion //#region src/api/Endpoint.d.ts /** * Represents an API endpoint in a convenient fashion. */ interface RestEndpoint, TPath extends `/${UrlPathChars}${string}`, TQuery extends `?${string}` | undefined> { method: TMethod; base: TBase; path: TPath; qp: TQuery; type: { url: string; request: string; response: string; }; params: GetUrlDynamics<`${TBase}${TPath}${TQuery}`>; requestHeaders: HttpHeaders; requestBody?: DefineObject; responseContentType?: TypeSubtype; responseBody?: DefineObject; } //#endregion //#region ../constants/src/Alpha.d.ts /** * An array of all the lower-cased alphabetic characters */ declare const LOWER_ALPHA_CHARS: ["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"]; /** * An array of all the upper-cased alphabetic characters */ declare const UPPER_ALPHA_CHARS: ["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"]; //#endregion //#region ../constants/src/Characters.d.ts declare const WHITESPACE_CHARS: readonly [" ", "\n", "\t", "\b"]; //#endregion //#region ../constants/src/colors.d.ts declare const CSS_NAMED_COLORS: ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "grey", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"]; declare const CSS_COLOR_LOOKUP: { aliceblue: "rgb(240,248,255)"; antiquewhite: "rgb(250,235,215)"; aqua: "rgb(0,255,255)"; aquamarine: "rgb(127,255,212)"; azure: "rgb(240,255,255)"; beige: "rgb(245,245,220)"; bisque: "rgb(255,228,196)"; black: "rgb(0,0,0)"; blanchedalmond: "rgb(255,235,205)"; blue: "rgb(0,0,255)"; blueviolet: "rgb(138,43,226)"; brown: "rgb(165,42,42)"; burlywood: "rgb(222,184,135)"; cadetblue: "rgb(95,158,160)"; chartreuse: "rgb(127,255,0)"; chocolate: "rgb(210,105,30)"; coral: "rgb(255,127,80)"; cornflowerblue: "rgb(100,149,237)"; cornsilk: "rgb(255,248,220)"; crimson: "rgb(220,20,60)"; cyan: "rgb(0,255,255)"; darkblue: "rgb(0,0,139)"; darkcyan: "rgb(0,139,139)"; darkgoldenrod: "rgb(184,134,11)"; darkgray: "rgb(169,169,169)"; darkgreen: "rgb(0,100,0)"; darkgrey: "rgb(169,169,169)"; darkkhaki: "rgb(189,183,107)"; darkmagenta: "rgb(139,0,139)"; darkolivegreen: "rgb(85,107,47)"; darkorange: "rgb(255,140,0)"; darkorchid: "rgb(153,50,204)"; darkred: "rgb(139,0,0)"; darksalmon: "rgb(233,150,122)"; darkseagreen: "rgb(143,188,143)"; darkslateblue: "rgb(72,61,139)"; darkslategray: "rgb(47,79,79)"; darkslategrey: "rgb(47,79,79)"; darkturquoise: "rgb(0,206,209)"; darkviolet: "rgb(148,0,211)"; deeppink: "rgb(255,20,147)"; deepskyblue: "rgb(0,191,255)"; dimgray: "rgb(105,105,105)"; dimgrey: "rgb(105,105,105)"; dodgerblue: "rgb(30,144,255)"; firebrick: "rgb(178,34,34)"; floralwhite: "rgb(255,250,240)"; forestgreen: "rgb(34,139,34)"; fuchsia: "rgb(255,0,255)"; gainsboro: "rgb(220,220,220)"; ghostwhite: "rgb(248,248,255)"; gold: "rgb(255,215,0)"; goldenrod: "rgb(218,165,32)"; gray: "rgb(128,128,128)"; green: "rgb(0,128,0)"; greenyellow: "rgb(173,255,47)"; grey: "rgb(128,128,128)"; honeydew: "rgb(240,255,240)"; hotpink: "rgb(255,105,180)"; indianred: "rgb(205,92,92)"; indigo: "rgb(75,0,130)"; ivory: "rgb(255,255,240)"; khaki: "rgb(240,230,140)"; lavender: "rgb(230,230,250)"; lavenderblush: "rgb(255,240,245)"; lawngreen: "rgb(124,252,0)"; lemonchiffon: "rgb(255,250,205)"; lightblue: "rgb(173,216,230)"; lightcoral: "rgb(240,128,128)"; lightcyan: "rgb(224,255,255)"; lightgoldenrodyellow: "rgb(250,250,210)"; lightgray: "rgb(211,211,211)"; lightgreen: "rgb(144,238,144)"; lightgrey: "rgb(211,211,211)"; lightpink: "rgb(255,182,193)"; lightsalmon: "rgb(255,160,122)"; lightseagreen: "rgb(32,178,170)"; lightskyblue: "rgb(135,206,250)"; lightslategray: "rgb(119,136,153)"; lightslategrey: "rgb(119,136,153)"; lightsteelblue: "rgb(176,196,222)"; lightyellow: "rgb(255,255,224)"; lime: "rgb(0,255,0)"; limegreen: "rgb(50,205,50)"; linen: "rgb(250,240,230)"; magenta: "rgb(255,0,255)"; maroon: "rgb(128,0,0)"; mediumaquamarine: "rgb(102,205,170)"; mediumblue: "rgb(0,0,205)"; mediumorchid: "rgb(186,85,211)"; mediumpurple: "rgb(147,112,219)"; mediumseagreen: "rgb(60,179,113)"; mediumslateblue: "rgb(123,104,238)"; mediumspringgreen: "rgb(0,250,154)"; mediumturquoise: "rgb(72,209,204)"; mediumvioletred: "rgb(199,21,133)"; midnightblue: "rgb(25,25,112)"; mintcream: "rgb(245,255,250)"; mistyrose: "rgb(255,228,225)"; moccasin: "rgb(255,228,181)"; navajowhite: "rgb(255,222,173)"; navy: "rgb(0,0,128)"; oldlace: "rgb(253,245,230)"; olive: "rgb(128,128,0)"; olivedrab: "rgb(107,142,35)"; orange: "rgb(255,165,0)"; orangered: "rgb(255,69,0)"; orchid: "rgb(218,112,214)"; palegoldenrod: "rgb(238,232,170)"; palegreen: "rgb(152,251,152)"; paleturquoise: "rgb(175,238,238)"; palevioletred: "rgb(219,112,147)"; papayawhip: "rgb(255,239,213)"; peachpuff: "rgb(255,218,185)"; peru: "rgb(205,133,63)"; pink: "rgb(255,192,203)"; plum: "rgb(221,160,221)"; powderblue: "rgb(176,224,230)"; purple: "rgb(128,0,128)"; rebeccapurple: "rgb(102,51,153)"; red: "rgb(255,0,0)"; rosybrown: "rgb(188,143,143)"; royalblue: "rgb(65,105,225)"; saddlebrown: "rgb(139,69,19)"; salmon: "rgb(250,128,114)"; sandybrown: "rgb(244,164,96)"; seagreen: "rgb(46,139,87)"; seashell: "rgb(255,245,238)"; sienna: "rgb(160,82,45)"; silver: "rgb(192,192,192)"; skyblue: "rgb(135,206,235)"; slateblue: "rgb(106,90,205)"; slategray: "rgb(112,128,144)"; slategrey: "rgb(112,128,144)"; snow: "rgb(255,250,250)"; springgreen: "rgb(0,255,127)"; steelblue: "rgb(70,130,180)"; tan: "rgb(210,180,140)"; teal: "rgb(0,128,128)"; thistle: "rgb(216,191,216)"; tomato: "rgb(255,99,71)"; turquoise: "rgb(64,224,208)"; violet: "rgb(238,130,238)"; wheat: "rgb(245,222,179)"; white: "rgb(255,255,255)"; whitesmoke: "rgb(245,245,245)"; yellow: "rgb(255,255,0)"; yellowgreen: "rgb(154,205,50)"; }; //#endregion //#region ../constants/src/Comparisons.d.ts declare const COMPARISON_OPERATIONS: readonly ["extends", "startsWith", "endsWith", "endsWithNumber", "startsWithNumber", "onlyNumbers", "alphaNumeric", "onlyLetters", "contains", "containsSome", "containsAll", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "objectKeyGreaterThan", "objectKeyGreaterThanOrEqual", "objectKeyLessThan", "objectKeyLessThanOrEqual", "objectKeyEquals", "objectKeyExtends", "objectKeyStartsWith", "betweenInclusively", "betweenExclusively", "equals", "equalsSome", "errors", "errorsOfType", "before", "after", "sameDay", "sameMonth", "sameMonthYear", "sameYear", "truthy", "falsy", "true", "false", "returnEquals", "returnExtends", "isTemplateLiteral", "hasLength"]; //#endregion //#region ../constants/src/Consonants.d.ts declare const CONSONANTS: readonly ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z", "y"]; //#endregion //#region ../constants/src/Constant.d.ts /** * **Constant**`` * * A static value of a particular _kind_. */ interface Constant { _type: "Constant"; kind: TKind; value: TVal; } //#endregion //#region ../constants/src/DateTime.d.ts /** * **MONTH_NAME** * * Full month names. */ declare const MONTH_NAME: readonly ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; /** * **MONTH_ABBR** * * Abbreviated month names. */ declare const MONTH_ABBR: readonly ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; declare const MONTH_NAME_LOOKUP: { readonly January: { readonly abbrev: "Jan"; readonly num: 1; readonly twoDigitStr: "01"; }; readonly February: { readonly abbrev: "Feb"; readonly num: 2; readonly twoDigitStr: "02"; }; readonly March: { readonly abbrev: "Mar"; readonly num: 3; readonly twoDigitStr: "03"; }; readonly April: { readonly abbrev: "Apr"; readonly num: 4; readonly twoDigitStr: "04"; }; readonly May: { readonly abbrev: "May"; readonly num: 5; readonly twoDigitStr: "05"; }; readonly June: { readonly abbrev: "Jun"; readonly num: 6; readonly twoDigitStr: "06"; }; readonly July: { readonly abbrev: "Jul"; readonly num: 7; readonly twoDigitStr: "07"; }; readonly August: { readonly abbrev: "Aug"; readonly num: 8; readonly twoDigitStr: "08"; }; readonly September: { readonly abbrev: "Sep"; readonly num: 9; readonly twoDigitStr: "09"; }; readonly October: { readonly abbrev: "Oct"; readonly num: 10; readonly twoDigitStr: "10"; }; readonly November: { readonly abbrev: "Nov"; readonly num: 11; readonly twoDigitStr: "11"; }; readonly December: { readonly abbrev: "Dec"; readonly num: 12; readonly twoDigitStr: "12"; }; }; declare const MONTH_ABBREV_LOOKUP: { readonly Jan: { readonly name: "January"; readonly num: 1; readonly twoDigitStr: "01"; }; readonly Feb: { readonly name: "February"; readonly num: 2; readonly twoDigitStr: "02"; }; readonly Mar: { readonly name: "March"; readonly num: 3; readonly twoDigitStr: "03"; }; readonly Apr: { readonly name: "April"; readonly num: 4; readonly twoDigitStr: "04"; }; readonly May: { readonly name: "May"; readonly num: 5; readonly twoDigitStr: "05"; }; readonly Jun: { readonly name: "June"; readonly num: 6; readonly twoDigitStr: "06"; }; readonly Jul: { readonly name: "July"; readonly num: 7; readonly twoDigitStr: "07"; }; readonly Aug: { readonly name: "August"; readonly num: 8; readonly twoDigitStr: "08"; }; readonly Sep: { readonly name: "September"; readonly num: 9; readonly twoDigitStr: "09"; }; readonly Oct: { readonly name: "October"; readonly num: 10; readonly twoDigitStr: "10"; }; readonly Nov: { readonly name: "November"; readonly num: 11; readonly twoDigitStr: "11"; }; readonly Dec: { readonly name: "December"; readonly num: 12; readonly twoDigitStr: "12"; }; }; /** the seasons in a year */ declare const SEASONS: readonly ["Summer", "Spring", "Fall", "Winter"]; type Season$1 = typeof SEASONS[number]; type MonthAbbr = typeof MONTH_ABBR[number]; type Hemisphere$1 = "northern" | "southern"; /** * Maps each season to the months which represent that season (by * hemisphere). */ declare const SEASON_TO_MONTH_LOOKUP: Record; declare const MONTH_TO_SEASON_LOOKUP: Record>; declare const DATE_TYPE: readonly ["datetime", "date", "year-independent", "year-month", "year"]; /** * months with 30 days */ declare const ISO_DATE_30: readonly ["04", "06", "09", "11"]; /** * months with 31 days */ declare const ISO_DATE_31: readonly ["01", "03", "05", "07", "08", "10", "12"]; //#endregion //#region ../constants/src/DoubleLeap_Typical.d.ts /** * Double Leap Years for modern times (1400-2300) */ declare const DOUBLE_LEAP_MODERN: readonly [1408, 1416, 1444, 1452, 1460, 1468, 1476, 1484, 1492, 1520, 1528, 1536, 1544, 1552, 1560, 1568, 1596, 1604, 1612, 1620, 1628, 1636, 1644, 1672, 1680, 1688, 1696, 1704, 1712, 1720, 1748, 1756, 1764, 1772, 1780, 1788, 1796, 1824, 1832, 1840, 1848, 1856, 1864, 1872, 1908, 1916, 1924, 1932, 1940, 1948, 1976, 1984, 1992, 2000, 2008, 2016, 2024, 2052, 2060, 2068, 2076, 2084, 2092, 2128, 2136, 2144, 2152, 2160, 2168, 2176, 2204, 2212, 2220, 2228, 2236, 2244, 2252, 2280, 2288, 2296]; //#endregion //#region ../constants/src/EscapeCodes.d.ts /** * Escape Code Characters * * Includes: * - `ESCAPE_CODE`, * - `BEL`, * - `NON_BREAKING_SPACE`, * - `LINE_FEED`, * - `FORM_FEED`, * - `HORIZONTAL_TAB`, * - `CARRIAGE_RETURN`, * - `FILE_SEPARATOR` * - `GROUP_SEPARATOR`, * - `RECORD_SEPARATOR`, * - `UNIT_SEPARATOR`, * - `NULL_CHAR`, * - Unicode _space_ characters with differing widths/behaviors * - _and more_ */ declare const ESCAPE_CODE_CHARS: ["\u001B", "\u0007", "\b", "\t", "\n", "\r", "\v", "\f", "\0", "", "\u001C", "\u001D", "\u001E", "\u001F", " ", " ", " ", " ", " ", " ", " "]; //#endregion //#region ../constants/src/Geo.d.ts declare const HEMISPHERE: readonly ["northern", "southern"]; /** * The continents on planet earth */ declare const CONTINENTS: readonly ["Africa", "Australia", "Antarctica", "Asia", "Europe", "North America", "South America"]; /** * The 9 provinces to the US which are granted State codes. */ declare const US_STATE_LOOKUP_PROVINCES: readonly [{ readonly name: "Puerto Rico"; readonly abbrev: "PR"; }, { readonly name: "Virgin Islands"; readonly abbrev: "VI"; }, { readonly name: "Palau"; readonly abbrev: "PW"; }, { readonly name: "Federated States of Micronesia"; readonly abbrev: "FM"; }, { readonly name: "Northern Mariana Islands"; readonly abbrev: "MP"; }, { readonly name: "District of Columbia"; readonly abbrev: "DC"; }, { readonly name: "Marshall Islands"; readonly abbrev: "MH"; }, { readonly name: "American Samoa"; readonly abbrev: "AS"; }, { readonly name: "Guam"; readonly abbrev: "GU"; }]; /** * All 50 states and 9 provinces which have State abbreviations. * * Data format is: `[name, abbrev, flag]` where the boolean flag * indicates whether the line item is one of the 50 true states. */ declare const US_STATE_LOOKUP: readonly [{ readonly name: "Alabama"; readonly abbrev: "AL"; }, { readonly name: "Alaska"; readonly abbrev: "AK"; }, { readonly name: "Arizona"; readonly abbrev: "AZ"; }, { readonly name: "Arkansas"; readonly abbrev: "AR"; }, { readonly name: "California"; readonly abbrev: "CA"; }, { readonly name: "Colorado"; readonly abbrev: "CO"; }, { readonly name: "Connecticut"; readonly abbrev: "CT"; }, { readonly name: "Delaware"; readonly abbrev: "DE"; }, { readonly name: "Florida"; readonly abbrev: "FL"; }, { readonly name: "Georgia"; readonly abbrev: "GA"; }, { readonly name: "Hawaii"; readonly abbrev: "HI"; }, { readonly name: "Idaho"; readonly abbrev: "ID"; }, { readonly name: "Illinois"; readonly abbrev: "IL"; }, { readonly name: "Indiana"; readonly abbrev: "IN"; }, { readonly name: "Iowa"; readonly abbrev: "IA"; }, { readonly name: "Kansas"; readonly abbrev: "KS"; }, { readonly name: "Kentucky"; readonly abbrev: "KY"; }, { readonly name: "Louisiana"; readonly abbrev: "LA"; }, { readonly name: "Maine"; readonly abbrev: "ME"; }, { readonly name: "Maryland"; readonly abbrev: "MD"; }, { readonly name: "Massachusetts"; readonly abbrev: "MA"; }, { readonly name: "Michigan"; readonly abbrev: "MI"; }, { readonly name: "Minnesota"; readonly abbrev: "MN"; }, { readonly name: "Mississippi"; readonly abbrev: "MS"; }, { readonly name: "Missouri"; readonly abbrev: "MO"; }, { readonly name: "Montana"; readonly abbrev: "MT"; }, { readonly name: "Nebraska"; readonly abbrev: "NE"; }, { readonly name: "Nevada"; readonly abbrev: "NV"; }, { readonly name: "New Hampshire"; readonly abbrev: "NH"; }, { readonly name: "New Jersey"; readonly abbrev: "NJ"; }, { readonly name: "New Mexico"; readonly abbrev: "NM"; }, { readonly name: "New York"; readonly abbrev: "NY"; }, { readonly name: "North Carolina"; readonly abbrev: "NC"; }, { readonly name: "North Dakota"; readonly abbrev: "ND"; }, { readonly name: "Ohio"; readonly abbrev: "OH"; }, { readonly name: "Oklahoma"; readonly abbrev: "OK"; }, { readonly name: "Oregon"; readonly abbrev: "OR"; }, { readonly name: "Pennsylvania"; readonly abbrev: "PA"; }, { readonly name: "Rhode Island"; readonly abbrev: "RI"; }, { readonly name: "South Carolina"; readonly abbrev: "SC"; }, { readonly name: "South Dakota"; readonly abbrev: "SD"; }, { readonly name: "Tennessee"; readonly abbrev: "TN"; }, { readonly name: "Texas"; readonly abbrev: "TX"; }, { readonly name: "Utah"; readonly abbrev: "UT"; }, { readonly name: "Vermont"; readonly abbrev: "VT"; }, { readonly name: "Virginia"; readonly abbrev: "VA"; }, { readonly name: "Washington"; readonly abbrev: "WA"; }, { readonly name: "West Virginia"; readonly abbrev: "WV"; }, { readonly name: "Wisconsin"; readonly abbrev: "WI"; }, { readonly name: "Wyoming"; readonly abbrev: "WY"; }, { readonly name: "Puerto Rico"; readonly abbrev: "PR"; }, { readonly name: "Virgin Islands"; readonly abbrev: "VI"; }, { readonly name: "Palau"; readonly abbrev: "PW"; }, { readonly name: "Federated States of Micronesia"; readonly abbrev: "FM"; }, { readonly name: "Northern Mariana Islands"; readonly abbrev: "MP"; }, { readonly name: "District of Columbia"; readonly abbrev: "DC"; }, { readonly name: "Marshall Islands"; readonly abbrev: "MH"; }, { readonly name: "American Samoa"; readonly abbrev: "AS"; }, { readonly name: "Guam"; readonly abbrev: "GU"; }]; /** * A lookup which provides a list of state abbreviations associated * with the first digit of the zip code. */ declare const ZIP_TO_STATE: { readonly 0: readonly ["CT", "MA", "ME", "NH", "NJ", "NY", "PR", "RI", "VT", "VI"]; readonly 1: readonly ["DE", "NY", "PA"]; readonly 2: readonly ["DC", "MD", "NC", "SC", "VA", "WV"]; readonly 3: readonly ["AL", "FL", "GA", "MS", "TN"]; readonly 4: readonly ["IN", "KY", "MI", "OH"]; readonly 5: readonly ["IA", "MN", "MT", "ND", "SD", "WI"]; readonly 6: readonly ["IL", "KS", "MO", "NE"]; readonly 7: readonly ["AR", "LA", "OK", "TX"]; readonly 8: readonly ["AZ", "CO", "ID", "NM", "NV", "UT", "WY"]; readonly 9: readonly ["AK", "AS", "CA", "GU", "HI", "MH", "FM", "MP", "OR", "PW", "WA"]; }; /** * Languages with current ISO 639 Set 1 (two-letter) codes, ordered by Set 1 code. * Set 2 uses the terminological (ISO 639-2/T) code where variants exist. * * @see https://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt */ declare const LOCALES: [{ readonly set1: "aa"; readonly set2: "aar"; readonly language: "Afar"; }, { readonly set1: "ab"; readonly set2: "abk"; readonly language: "Abkhazian"; }, { readonly set1: "ae"; readonly set2: "ave"; readonly language: "Avestan"; }, { readonly set1: "af"; readonly set2: "afr"; readonly language: "Afrikaans"; }, { readonly set1: "ak"; readonly set2: "aka"; readonly language: "Akan"; }, { readonly set1: "am"; readonly set2: "amh"; readonly language: "Amharic"; }, { readonly set1: "an"; readonly set2: "arg"; readonly language: "Aragonese"; }, { readonly set1: "ar"; readonly set2: "ara"; readonly language: "Arabic"; }, { readonly set1: "as"; readonly set2: "asm"; readonly language: "Assamese"; }, { readonly set1: "av"; readonly set2: "ava"; readonly language: "Avaric"; }, { readonly set1: "ay"; readonly set2: "aym"; readonly language: "Aymara"; }, { readonly set1: "az"; readonly set2: "aze"; readonly language: "Azerbaijani"; }, { readonly set1: "ba"; readonly set2: "bak"; readonly language: "Bashkir"; }, { readonly set1: "be"; readonly set2: "bel"; readonly language: "Belarusian"; }, { readonly set1: "bg"; readonly set2: "bul"; readonly language: "Bulgarian"; }, { readonly set1: "bi"; readonly set2: "bis"; readonly language: "Bislama"; }, { readonly set1: "bm"; readonly set2: "bam"; readonly language: "Bambara"; }, { readonly set1: "bn"; readonly set2: "ben"; readonly language: "Bengali"; }, { readonly set1: "bo"; readonly set2: "bod"; readonly language: "Tibetan"; }, { readonly set1: "br"; readonly set2: "bre"; readonly language: "Breton"; }, { readonly set1: "bs"; readonly set2: "bos"; readonly language: "Bosnian"; }, { readonly set1: "ca"; readonly set2: "cat"; readonly language: "Catalan; Valencian"; }, { readonly set1: "ce"; readonly set2: "che"; readonly language: "Chechen"; }, { readonly set1: "ch"; readonly set2: "cha"; readonly language: "Chamorro"; }, { readonly set1: "co"; readonly set2: "cos"; readonly language: "Corsican"; }, { readonly set1: "cr"; readonly set2: "cre"; readonly language: "Cree"; }, { readonly set1: "cs"; readonly set2: "ces"; readonly language: "Czech"; }, { readonly set1: "cu"; readonly set2: "chu"; readonly language: "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic"; }, { readonly set1: "cv"; readonly set2: "chv"; readonly language: "Chuvash"; }, { readonly set1: "cy"; readonly set2: "cym"; readonly language: "Welsh"; }, { readonly set1: "da"; readonly set2: "dan"; readonly language: "Danish"; }, { readonly set1: "de"; readonly set2: "deu"; readonly language: "German"; }, { readonly set1: "dv"; readonly set2: "div"; readonly language: "Divehi; Dhivehi; Maldivian"; }, { readonly set1: "dz"; readonly set2: "dzo"; readonly language: "Dzongkha"; }, { readonly set1: "ee"; readonly set2: "ewe"; readonly language: "Ewe"; }, { readonly set1: "el"; readonly set2: "ell"; readonly language: "Modern Greek (1453-)"; }, { readonly set1: "en"; readonly set2: "eng"; readonly language: "English"; }, { readonly set1: "eo"; readonly set2: "epo"; readonly language: "Esperanto"; }, { readonly set1: "es"; readonly set2: "spa"; readonly language: "Spanish; Castilian"; }, { readonly set1: "et"; readonly set2: "est"; readonly language: "Estonian"; }, { readonly set1: "eu"; readonly set2: "eus"; readonly language: "Basque"; }, { readonly set1: "fa"; readonly set2: "fas"; readonly language: "Persian"; }, { readonly set1: "ff"; readonly set2: "ful"; readonly language: "Fulah"; }, { readonly set1: "fi"; readonly set2: "fin"; readonly language: "Finnish"; }, { readonly set1: "fj"; readonly set2: "fij"; readonly language: "Fijian"; }, { readonly set1: "fo"; readonly set2: "fao"; readonly language: "Faroese"; }, { readonly set1: "fr"; readonly set2: "fra"; readonly language: "French"; }, { readonly set1: "fy"; readonly set2: "fry"; readonly language: "Western Frisian"; }, { readonly set1: "ga"; readonly set2: "gle"; readonly language: "Irish"; }, { readonly set1: "gd"; readonly set2: "gla"; readonly language: "Gaelic; Scottish Gaelic"; }, { readonly set1: "gl"; readonly set2: "glg"; readonly language: "Galician"; }, { readonly set1: "gn"; readonly set2: "grn"; readonly language: "Guarani"; }, { readonly set1: "gu"; readonly set2: "guj"; readonly language: "Gujarati"; }, { readonly set1: "gv"; readonly set2: "glv"; readonly language: "Manx"; }, { readonly set1: "ha"; readonly set2: "hau"; readonly language: "Hausa"; }, { readonly set1: "he"; readonly set2: "heb"; readonly language: "Hebrew"; }, { readonly set1: "hi"; readonly set2: "hin"; readonly language: "Hindi"; }, { readonly set1: "ho"; readonly set2: "hmo"; readonly language: "Hiri Motu"; }, { readonly set1: "hr"; readonly set2: "hrv"; readonly language: "Croatian"; }, { readonly set1: "ht"; readonly set2: "hat"; readonly language: "Haitian; Haitian Creole"; }, { readonly set1: "hu"; readonly set2: "hun"; readonly language: "Hungarian"; }, { readonly set1: "hy"; readonly set2: "hye"; readonly language: "Armenian"; }, { readonly set1: "hz"; readonly set2: "her"; readonly language: "Herero"; }, { readonly set1: "ia"; readonly set2: "ina"; readonly language: "Interlingua (International Auxiliary Language Association)"; }, { readonly set1: "id"; readonly set2: "ind"; readonly language: "Indonesian"; }, { readonly set1: "ie"; readonly set2: "ile"; readonly language: "Interlingue; Occidental"; }, { readonly set1: "ig"; readonly set2: "ibo"; readonly language: "Igbo"; }, { readonly set1: "ii"; readonly set2: "iii"; readonly language: "Sichuan Yi; Nuosu"; }, { readonly set1: "ik"; readonly set2: "ipk"; readonly language: "Inupiaq"; }, { readonly set1: "io"; readonly set2: "ido"; readonly language: "Ido"; }, { readonly set1: "is"; readonly set2: "isl"; readonly language: "Icelandic"; }, { readonly set1: "it"; readonly set2: "ita"; readonly language: "Italian"; }, { readonly set1: "iu"; readonly set2: "iku"; readonly language: "Inuktitut"; }, { readonly set1: "ja"; readonly set2: "jpn"; readonly language: "Japanese"; }, { readonly set1: "jv"; readonly set2: "jav"; readonly language: "Javanese"; }, { readonly set1: "ka"; readonly set2: "kat"; readonly language: "Georgian"; }, { readonly set1: "kg"; readonly set2: "kon"; readonly language: "Kongo"; }, { readonly set1: "ki"; readonly set2: "kik"; readonly language: "Kikuyu; Gikuyu"; }, { readonly set1: "kj"; readonly set2: "kua"; readonly language: "Kuanyama; Kwanyama"; }, { readonly set1: "kk"; readonly set2: "kaz"; readonly language: "Kazakh"; }, { readonly set1: "kl"; readonly set2: "kal"; readonly language: "Kalaallisut; Greenlandic"; }, { readonly set1: "km"; readonly set2: "khm"; readonly language: "Central Khmer"; }, { readonly set1: "kn"; readonly set2: "kan"; readonly language: "Kannada"; }, { readonly set1: "ko"; readonly set2: "kor"; readonly language: "Korean"; }, { readonly set1: "kr"; readonly set2: "kau"; readonly language: "Kanuri"; }, { readonly set1: "ks"; readonly set2: "kas"; readonly language: "Kashmiri"; }, { readonly set1: "ku"; readonly set2: "kur"; readonly language: "Kurdish"; }, { readonly set1: "kv"; readonly set2: "kom"; readonly language: "Komi"; }, { readonly set1: "kw"; readonly set2: "cor"; readonly language: "Cornish"; }, { readonly set1: "ky"; readonly set2: "kir"; readonly language: "Kirghiz; Kyrgyz"; }, { readonly set1: "la"; readonly set2: "lat"; readonly language: "Latin"; }, { readonly set1: "lb"; readonly set2: "ltz"; readonly language: "Luxembourgish; Letzeburgesch"; }, { readonly set1: "lg"; readonly set2: "lug"; readonly language: "Ganda"; }, { readonly set1: "li"; readonly set2: "lim"; readonly language: "Limburgan; Limburger; Limburgish"; }, { readonly set1: "ln"; readonly set2: "lin"; readonly language: "Lingala"; }, { readonly set1: "lo"; readonly set2: "lao"; readonly language: "Lao"; }, { readonly set1: "lt"; readonly set2: "lit"; readonly language: "Lithuanian"; }, { readonly set1: "lu"; readonly set2: "lub"; readonly language: "Luba-Katanga"; }, { readonly set1: "lv"; readonly set2: "lav"; readonly language: "Latvian"; }, { readonly set1: "mg"; readonly set2: "mlg"; readonly language: "Malagasy"; }, { readonly set1: "mh"; readonly set2: "mah"; readonly language: "Marshallese"; }, { readonly set1: "mi"; readonly set2: "mri"; readonly language: "Maori"; }, { readonly set1: "mk"; readonly set2: "mkd"; readonly language: "Macedonian"; }, { readonly set1: "ml"; readonly set2: "mal"; readonly language: "Malayalam"; }, { readonly set1: "mn"; readonly set2: "mon"; readonly language: "Mongolian"; }, { readonly set1: "mr"; readonly set2: "mar"; readonly language: "Marathi"; }, { readonly set1: "ms"; readonly set2: "msa"; readonly language: "Malay"; }, { readonly set1: "mt"; readonly set2: "mlt"; readonly language: "Maltese"; }, { readonly set1: "my"; readonly set2: "mya"; readonly language: "Burmese"; }, { readonly set1: "na"; readonly set2: "nau"; readonly language: "Nauru"; }, { readonly set1: "nb"; readonly set2: "nob"; readonly language: "Norwegian Bokmål"; }, { readonly set1: "nd"; readonly set2: "nde"; readonly language: "North Ndebele"; }, { readonly set1: "ne"; readonly set2: "nep"; readonly language: "Nepali"; }, { readonly set1: "ng"; readonly set2: "ndo"; readonly language: "Ndonga"; }, { readonly set1: "nl"; readonly set2: "nld"; readonly language: "Dutch; Flemish"; }, { readonly set1: "nn"; readonly set2: "nno"; readonly language: "Norwegian Nynorsk"; }, { readonly set1: "no"; readonly set2: "nor"; readonly language: "Norwegian"; }, { readonly set1: "nr"; readonly set2: "nbl"; readonly language: "South Ndebele"; }, { readonly set1: "nv"; readonly set2: "nav"; readonly language: "Navajo; Navaho"; }, { readonly set1: "ny"; readonly set2: "nya"; readonly language: "Chichewa; Chewa; Nyanja"; }, { readonly set1: "oc"; readonly set2: "oci"; readonly language: "Occitan (post 1500)"; }, { readonly set1: "oj"; readonly set2: "oji"; readonly language: "Ojibwa"; }, { readonly set1: "om"; readonly set2: "orm"; readonly language: "Oromo"; }, { readonly set1: "or"; readonly set2: "ori"; readonly language: "Oriya"; }, { readonly set1: "os"; readonly set2: "oss"; readonly language: "Ossetian; Ossetic"; }, { readonly set1: "pa"; readonly set2: "pan"; readonly language: "Panjabi; Punjabi"; }, { readonly set1: "pi"; readonly set2: "pli"; readonly language: "Pali"; }, { readonly set1: "pl"; readonly set2: "pol"; readonly language: "Polish"; }, { readonly set1: "ps"; readonly set2: "pus"; readonly language: "Pushto; Pashto"; }, { readonly set1: "pt"; readonly set2: "por"; readonly language: "Portuguese"; }, { readonly set1: "qu"; readonly set2: "que"; readonly language: "Quechua"; }, { readonly set1: "rm"; readonly set2: "roh"; readonly language: "Romansh"; }, { readonly set1: "rn"; readonly set2: "run"; readonly language: "Rundi"; }, { readonly set1: "ro"; readonly set2: "ron"; readonly language: "Romanian; Moldavian; Moldovan"; }, { readonly set1: "ru"; readonly set2: "rus"; readonly language: "Russian"; }, { readonly set1: "rw"; readonly set2: "kin"; readonly language: "Kinyarwanda"; }, { readonly set1: "sa"; readonly set2: "san"; readonly language: "Sanskrit"; }, { readonly set1: "sc"; readonly set2: "srd"; readonly language: "Sardinian"; }, { readonly set1: "sd"; readonly set2: "snd"; readonly language: "Sindhi"; }, { readonly set1: "se"; readonly set2: "sme"; readonly language: "Northern Sami"; }, { readonly set1: "sg"; readonly set2: "sag"; readonly language: "Sango"; }, { readonly set1: "si"; readonly set2: "sin"; readonly language: "Sinhala; Sinhalese"; }, { readonly set1: "sk"; readonly set2: "slk"; readonly language: "Slovak"; }, { readonly set1: "sl"; readonly set2: "slv"; readonly language: "Slovenian"; }, { readonly set1: "sm"; readonly set2: "smo"; readonly language: "Samoan"; }, { readonly set1: "sn"; readonly set2: "sna"; readonly language: "Shona"; }, { readonly set1: "so"; readonly set2: "som"; readonly language: "Somali"; }, { readonly set1: "sq"; readonly set2: "sqi"; readonly language: "Albanian"; }, { readonly set1: "sr"; readonly set2: "srp"; readonly language: "Serbian"; }, { readonly set1: "ss"; readonly set2: "ssw"; readonly language: "Swati"; }, { readonly set1: "st"; readonly set2: "sot"; readonly language: "Sotho, Southern"; }, { readonly set1: "su"; readonly set2: "sun"; readonly language: "Sundanese"; }, { readonly set1: "sv"; readonly set2: "swe"; readonly language: "Swedish"; }, { readonly set1: "sw"; readonly set2: "swa"; readonly language: "Swahili"; }, { readonly set1: "ta"; readonly set2: "tam"; readonly language: "Tamil"; }, { readonly set1: "te"; readonly set2: "tel"; readonly language: "Telugu"; }, { readonly set1: "tg"; readonly set2: "tgk"; readonly language: "Tajik"; }, { readonly set1: "th"; readonly set2: "tha"; readonly language: "Thai"; }, { readonly set1: "ti"; readonly set2: "tir"; readonly language: "Tigrinya"; }, { readonly set1: "tk"; readonly set2: "tuk"; readonly language: "Turkmen"; }, { readonly set1: "tl"; readonly set2: "tgl"; readonly language: "Tagalog"; }, { readonly set1: "tn"; readonly set2: "tsn"; readonly language: "Tswana"; }, { readonly set1: "to"; readonly set2: "ton"; readonly language: "Tonga (Tonga Islands)"; }, { readonly set1: "tr"; readonly set2: "tur"; readonly language: "Turkish"; }, { readonly set1: "ts"; readonly set2: "tso"; readonly language: "Tsonga"; }, { readonly set1: "tt"; readonly set2: "tat"; readonly language: "Tatar"; }, { readonly set1: "tw"; readonly set2: "twi"; readonly language: "Twi"; }, { readonly set1: "ty"; readonly set2: "tah"; readonly language: "Tahitian"; }, { readonly set1: "ug"; readonly set2: "uig"; readonly language: "Uighur; Uyghur"; }, { readonly set1: "uk"; readonly set2: "ukr"; readonly language: "Ukrainian"; }, { readonly set1: "ur"; readonly set2: "urd"; readonly language: "Urdu"; }, { readonly set1: "uz"; readonly set2: "uzb"; readonly language: "Uzbek"; }, { readonly set1: "ve"; readonly set2: "ven"; readonly language: "Venda"; }, { readonly set1: "vi"; readonly set2: "vie"; readonly language: "Vietnamese"; }, { readonly set1: "vo"; readonly set2: "vol"; readonly language: "Volapük"; }, { readonly set1: "wa"; readonly set2: "wln"; readonly language: "Walloon"; }, { readonly set1: "wo"; readonly set2: "wol"; readonly language: "Wolof"; }, { readonly set1: "xh"; readonly set2: "xho"; readonly language: "Xhosa"; }, { readonly set1: "yi"; readonly set2: "yid"; readonly language: "Yiddish"; }, { readonly set1: "yo"; readonly set2: "yor"; readonly language: "Yoruba"; }, { readonly set1: "za"; readonly set2: "zha"; readonly language: "Zhuang; Chuang"; }, { readonly set1: "zh"; readonly set2: "zho"; readonly language: "Chinese"; }, { readonly set1: "zu"; readonly set2: "zul"; readonly language: "Zulu"; }]; //#endregion //#region ../constants/src/HTML.d.ts /** * An array of all valid HTML tags that have both opening and closing tags. */ declare const HTML_BLOCK_TAGS: readonly ["a", "abbr", "address", "article", "aside", "b", "bdi", "bdo", "blockquote", "body", "button", "canvas", "caption", "cite", "code", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "html", "i", "iframe", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "menu", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "span", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video"]; /** * An array of all valid HTML tags that are self-closing (do not have closing tags). */ declare const HTML_ATOMIC_TAGS: readonly ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]; //#endregion //#region ../constants/src/Http.d.ts /** * A constant array containing a comprehensive list of common MIME (Multipurpose Internet Mail Extensions) types. * This array is marked as `const` to enable TypeScript to infer literal types for each element. * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types */ declare const MIME_TYPES: readonly ["application/json", "application/xml", "application/javascript", "application/pdf", "application/ld+json", "application/octet-stream", "application/x-www-form-urlencoded", "application/vnd.api+json", "application/msword", "application/grpc", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "text/plain", "text/html", "text/css", "text/csv", "text/javascript", "text/markdown", "image/jpeg", "image/png", "image/gif", "image/bmp", "image/webp", "image/svg+xml", "image/tiff", "audio/mpeg", "audio/ogg", "audio/wav", "audio/webm", "audio/flac", "video/mp4", "video/mpeg", "video/ogg", "video/webm", "video/quicktime", "multipart/form-data", "multipart/mixed", "multipart/alternative", "multipart/related", "font/woff", "font/woff2", "font/ttf", "font/otf", "application/rss+xml", "application/atom+xml", "application/x-pkcs12", "application/x-shockwave-flash", "application/x-www-form-urlencoded", "application/x-font-ttf", "application/x-font-opentype", "application/x-font-woff", "application/x-font-woff2", "application/vnd.rar", "application/zip", "application/x-7z-compressed"]; //#endregion //#region ../constants/src/Images.d.ts declare const IMAGE_FORMAT_LOOKUP: [{ readonly ext: "jpg"; readonly webFormat: true; readonly other_ext: ["jpeg"]; }, { readonly ext: "png"; readonly webFormat: true; readonly other_ext: []; }, { readonly ext: "gif"; readonly webFormat: true; readonly other_ext: []; }, { readonly ext: "heif"; readonly webFormat: true; readonly other_ext: []; }, { readonly ext: "svg"; readonly webFormat: true; readonly other_ext: []; }, { readonly ext: "raw"; readonly webFormat: false; readonly other_ext: []; }, { readonly ext: "dng"; readonly webFormat: false; readonly other_ext: []; }, { readonly ext: "avif"; readonly webFormat: true; readonly other_ext: []; }, { readonly ext: "webp"; readonly webFormat: true; readonly other_ext: []; }, { readonly ext: "tiff"; readonly webFormat: false; readonly other_ext: ["tif"]; }]; //#endregion //#region ../constants/src/Interpolation.d.ts /** * Static text blocks which can be used to interpolate into dynamic * string literal sections. */ declare const INTERPOLATION_BLOCKS: readonly ["{{string}}", "{{number}}", "{{boolean}}"]; //#endregion //#region ../constants/src/ISO3166.d.ts /** * All country codes (name, alpha-2, country-code) */ declare const ISO3166_1: readonly [{ readonly name: "Afghanistan"; readonly alpha2: "AF"; readonly countryCode: "004"; readonly alpha3: "AFG"; }, { readonly name: "Albania"; readonly alpha2: "AL"; readonly countryCode: "008"; readonly alpha3: "ALB"; }, { readonly name: "Algeria"; readonly alpha2: "DZ"; readonly countryCode: "012"; readonly alpha3: "DZA"; }, { readonly name: "Andorra"; readonly alpha2: "AD"; readonly countryCode: "020"; readonly alpha3: "AND"; }, { readonly name: "Angola"; readonly alpha2: "AO"; readonly countryCode: "024"; readonly alpha3: "AGO"; }, { readonly name: "Argentina"; readonly alpha2: "AR"; readonly countryCode: "032"; readonly alpha3: "ARG"; }, { readonly name: "Australia"; readonly alpha2: "AU"; readonly countryCode: "036"; readonly alpha3: "AUS"; }, { readonly name: "Austria"; readonly alpha2: "AT"; readonly countryCode: "040"; readonly alpha3: "AUT"; }, { readonly name: "Azerbaijan"; readonly alpha2: "AZ"; readonly countryCode: "031"; readonly alpha3: "AZE"; }, { readonly name: "Bahamas"; readonly alpha2: "BS"; readonly countryCode: "044"; readonly alpha3: "BHS"; }, { readonly name: "Bangladesh"; readonly alpha2: "BD"; readonly countryCode: "050"; readonly alpha3: "BGD"; }, { readonly name: "Belgium"; readonly alpha2: "BE"; readonly countryCode: "056"; readonly alpha3: "BEL"; }, { readonly name: "Belize"; readonly alpha2: "BZ"; readonly countryCode: "084"; readonly alpha3: "BLZ"; }, { readonly name: "Benin"; readonly alpha2: "BJ"; readonly countryCode: "204"; readonly alpha3: "BEN"; }, { readonly name: "Bhutan"; readonly alpha2: "BT"; readonly countryCode: "064"; readonly alpha3: "BTN"; }, { readonly name: "Bolivia"; readonly alpha2: "BO"; readonly countryCode: "068"; readonly alpha3: "BOL"; }, { readonly name: "Bosnia and Herzegovina"; readonly alpha2: "BA"; readonly countryCode: "070"; readonly alpha3: "BIH"; }, { readonly name: "Botswana"; readonly alpha2: "BW"; readonly countryCode: "072"; readonly alpha3: "BWA"; }, { readonly name: "Brazil"; readonly alpha2: "BR"; readonly countryCode: "076"; readonly alpha3: "BRA"; }, { readonly name: "Brunei Darussalam"; readonly alpha2: "BN"; readonly countryCode: "096"; readonly alpha3: "BRN"; }, { readonly name: "Bulgaria"; readonly alpha2: "BG"; readonly countryCode: "100"; readonly alpha3: "BGR"; }, { readonly name: "Burkina Faso"; readonly alpha2: "BF"; readonly countryCode: "854"; readonly alpha3: "BFA"; }, { readonly name: "Burundi"; readonly alpha2: "BI"; readonly countryCode: "108"; readonly alpha3: "BDI"; }, { readonly name: "Cambodia"; readonly alpha2: "KH"; readonly countryCode: "116"; readonly alpha3: "KHM"; }, { readonly name: "Cameroon"; readonly alpha2: "CM"; readonly countryCode: "120"; readonly alpha3: "CMR"; }, { readonly name: "Canada"; readonly alpha2: "CA"; readonly countryCode: "124"; readonly alpha3: "CAN"; }, { readonly name: "Afghanistan"; readonly alpha2: "AF"; readonly countryCode: "004"; readonly alpha3: "AFG"; }, { readonly name: "Albania"; readonly alpha2: "AL"; readonly countryCode: "008"; readonly alpha3: "ALB"; }, { readonly name: "Algeria"; readonly alpha2: "DZ"; readonly countryCode: "012"; readonly alpha3: "DZA"; }, { readonly name: "Andorra"; readonly alpha2: "AD"; readonly countryCode: "020"; readonly alpha3: "AND"; }, { readonly name: "Angola"; readonly alpha2: "AO"; readonly countryCode: "024"; readonly alpha3: "AGO"; }, { readonly name: "Argentina"; readonly alpha2: "AR"; readonly countryCode: "032"; readonly alpha3: "ARG"; }, { readonly name: "Australia"; readonly alpha2: "AU"; readonly countryCode: "036"; readonly alpha3: "AUS"; }, { readonly name: "Austria"; readonly alpha2: "AT"; readonly countryCode: "040"; readonly alpha3: "AUT"; }, { readonly name: "Azerbaijan"; readonly alpha2: "AZ"; readonly countryCode: "031"; readonly alpha3: "AZE"; }, { readonly name: "Bahamas"; readonly alpha2: "BS"; readonly countryCode: "044"; readonly alpha3: "BHS"; }, { readonly name: "Bangladesh"; readonly alpha2: "BD"; readonly countryCode: "050"; readonly alpha3: "BGD"; }, { readonly name: "Belgium"; readonly alpha2: "BE"; readonly countryCode: "056"; readonly alpha3: "BEL"; }, { readonly name: "Belize"; readonly alpha2: "BZ"; readonly countryCode: "084"; readonly alpha3: "BLZ"; }, { readonly name: "Benin"; readonly alpha2: "BJ"; readonly countryCode: "204"; readonly alpha3: "BEN"; }, { readonly name: "Bhutan"; readonly alpha2: "BT"; readonly countryCode: "064"; readonly alpha3: "BTN"; }, { readonly name: "Bolivia"; readonly alpha2: "BO"; readonly countryCode: "068"; readonly alpha3: "BOL"; }, { readonly name: "Bosnia and Herzegovina"; readonly alpha2: "BA"; readonly countryCode: "070"; readonly alpha3: "BIH"; }, { readonly name: "Botswana"; readonly alpha2: "BW"; readonly countryCode: "072"; readonly alpha3: "BWA"; }, { readonly name: "Brazil"; readonly alpha2: "BR"; readonly countryCode: "076"; readonly alpha3: "BRA"; }, { readonly name: "Brunei Darussalam"; readonly alpha2: "BN"; readonly countryCode: "096"; readonly alpha3: "BRN"; }, { readonly name: "Bulgaria"; readonly alpha2: "BG"; readonly countryCode: "100"; readonly alpha3: "BGR"; }, { readonly name: "Burkina Faso"; readonly alpha2: "BF"; readonly countryCode: "854"; readonly alpha3: "BFA"; }, { readonly name: "Burundi"; readonly alpha2: "BI"; readonly countryCode: "108"; readonly alpha3: "BDI"; }, { readonly name: "Cambodia"; readonly alpha2: "KH"; readonly countryCode: "116"; readonly alpha3: "KHM"; }, { readonly name: "Cameroon"; readonly alpha2: "CM"; readonly countryCode: "120"; readonly alpha3: "CMR"; }, { readonly name: "Canada"; readonly alpha2: "CA"; readonly countryCode: "124"; readonly alpha3: "CAN"; }, { readonly name: "Maldives"; readonly alpha2: "MV"; readonly countryCode: "462"; readonly alpha3: "MDV"; }, { readonly name: "Mali"; readonly alpha2: "ML"; readonly countryCode: "466"; readonly alpha3: "MLI"; }, { readonly name: "Malta"; readonly alpha2: "MT"; readonly countryCode: "470"; readonly alpha3: "MLT"; }, { readonly name: "Marshall Islands"; readonly alpha2: "MH"; readonly countryCode: "584"; readonly alpha3: "MHL"; }, { readonly name: "Mauritania"; readonly alpha2: "MR"; readonly countryCode: "478"; readonly alpha3: "MRT"; }, { readonly name: "Mauritius"; readonly alpha2: "MU"; readonly countryCode: "480"; readonly alpha3: "MUS"; }, { readonly name: "Mexico"; readonly alpha2: "MX"; readonly countryCode: "484"; readonly alpha3: "MEX"; }, { readonly name: "Micronesia (Federated States of)"; readonly alpha2: "FM"; readonly countryCode: "583"; readonly alpha3: "FSM"; }, { readonly name: "Moldova (Republic of)"; readonly alpha2: "MD"; readonly countryCode: "498"; readonly alpha3: "MDA"; }, { readonly name: "Monaco"; readonly alpha2: "MC"; readonly countryCode: "492"; readonly alpha3: "MCO"; }, { readonly name: "Mongolia"; readonly alpha2: "MN"; readonly countryCode: "496"; readonly alpha3: "MNG"; }, { readonly name: "Montenegro"; readonly alpha2: "ME"; readonly countryCode: "499"; readonly alpha3: "MNE"; }, { readonly name: "Morocco"; readonly alpha2: "MA"; readonly countryCode: "504"; readonly alpha3: "MAR"; }, { readonly name: "Mozambique"; readonly alpha2: "MZ"; readonly countryCode: "508"; readonly alpha3: "MOZ"; }, { readonly name: "Myanmar"; readonly alpha2: "MM"; readonly countryCode: "104"; readonly alpha3: "MMR"; }, { readonly name: "Namibia"; readonly alpha2: "NA"; readonly countryCode: "516"; readonly alpha3: "NAM"; }, { readonly name: "Nauru"; readonly alpha2: "NR"; readonly countryCode: "520"; readonly alpha3: "NRU"; }, { readonly name: "Nepal"; readonly alpha2: "NP"; readonly countryCode: "524"; readonly alpha3: "NPL"; }, { readonly name: "Netherlands"; readonly alpha2: "NL"; readonly countryCode: "528"; readonly alpha3: "NLD"; }, { readonly name: "New Zealand"; readonly alpha2: "NZ"; readonly countryCode: "554"; readonly alpha3: "NZL"; }, { readonly name: "Nicaragua"; readonly alpha2: "NI"; readonly countryCode: "558"; readonly alpha3: "NIC"; }, { readonly name: "Niger"; readonly alpha2: "NE"; readonly countryCode: "562"; readonly alpha3: "NER"; }, { readonly name: "Nigeria"; readonly alpha2: "NG"; readonly countryCode: "566"; readonly alpha3: "NGA"; }, { readonly name: "North Macedonia"; readonly alpha2: "MK"; readonly countryCode: "807"; readonly alpha3: "MKD"; }, { readonly name: "Norway"; readonly alpha2: "NO"; readonly countryCode: "578"; readonly alpha3: "NOR"; }, { readonly name: "Oman"; readonly alpha2: "OM"; readonly countryCode: "512"; readonly alpha3: "OMN"; }, { readonly name: "Pakistan"; readonly alpha2: "PK"; readonly countryCode: "586"; readonly alpha3: "PAK"; }, { readonly name: "Palau"; readonly alpha2: "PW"; readonly countryCode: "585"; readonly alpha3: "PLW"; }, { readonly name: "Panama"; readonly alpha2: "PA"; readonly countryCode: "591"; readonly alpha3: "PAN"; }, { readonly name: "Papua New Guinea"; readonly alpha2: "PG"; readonly countryCode: "598"; readonly alpha3: "PNG"; }, { readonly name: "Paraguay"; readonly alpha2: "PY"; readonly countryCode: "600"; readonly alpha3: "PRY"; }, { readonly name: "Peru"; readonly alpha2: "PE"; readonly countryCode: "604"; readonly alpha3: "PER"; }, { readonly name: "Philippines"; readonly alpha2: "PH"; readonly countryCode: "608"; readonly alpha3: "PHL"; }, { readonly name: "Poland"; readonly alpha2: "PL"; readonly countryCode: "616"; readonly alpha3: "POL"; }, { readonly name: "Portugal"; readonly alpha2: "PT"; readonly countryCode: "620"; readonly alpha3: "PRT"; }, { readonly name: "Qatar"; readonly alpha2: "QA"; readonly countryCode: "634"; readonly alpha3: "QAT"; }, { readonly name: "Romania"; readonly alpha2: "RO"; readonly countryCode: "642"; readonly alpha3: "ROU"; }, { readonly name: "Russian Federation"; readonly alpha2: "RU"; readonly countryCode: "643"; readonly alpha3: "RUS"; }, { readonly name: "Rwanda"; readonly alpha2: "RW"; readonly countryCode: "646"; readonly alpha3: "RWA"; }, { readonly name: "Saint Kitts and Nevis"; readonly alpha2: "KN"; readonly countryCode: "659"; readonly alpha3: "KNA"; }, { readonly name: "Saint Lucia"; readonly alpha2: "LC"; readonly countryCode: "662"; readonly alpha3: "LCA"; }, { readonly name: "Saint Vincent and the Grenadines"; readonly alpha2: "VC"; readonly countryCode: "670"; readonly alpha3: "VCT"; }, { readonly name: "Samoa"; readonly alpha2: "WS"; readonly countryCode: "882"; readonly alpha3: "WSM"; }, { readonly name: "San Marino"; readonly alpha2: "SM"; readonly countryCode: "674"; readonly alpha3: "SMR"; }, { readonly name: "Sao Tome and Principe"; readonly alpha2: "ST"; readonly countryCode: "678"; readonly alpha3: "STP"; }, { readonly name: "Saudi Arabia"; readonly alpha2: "SA"; readonly countryCode: "682"; readonly alpha3: "SAU"; }, { readonly name: "Senegal"; readonly alpha2: "SN"; readonly countryCode: "686"; readonly alpha3: "SEN"; }, { readonly name: "Serbia"; readonly alpha2: "RS"; readonly countryCode: "688"; readonly alpha3: "SRB"; }, { readonly name: "Seychelles"; readonly alpha2: "SC"; readonly countryCode: "690"; readonly alpha3: "SYC"; }, { readonly name: "Sierra Leone"; readonly alpha2: "SL"; readonly countryCode: "694"; readonly alpha3: "SLE"; }, { readonly name: "Singapore"; readonly alpha2: "SG"; readonly countryCode: "702"; readonly alpha3: "SGP"; }, { readonly name: "Slovakia"; readonly alpha2: "SK"; readonly countryCode: "703"; readonly alpha3: "SVK"; }, { readonly name: "Slovenia"; readonly alpha2: "SI"; readonly countryCode: "705"; readonly alpha3: "SVN"; }, { readonly name: "Solomon Islands"; readonly alpha2: "SB"; readonly countryCode: "090"; readonly alpha3: "SLB"; }, { readonly name: "Somalia"; readonly alpha2: "SO"; readonly countryCode: "706"; readonly alpha3: "SOM"; }, { readonly name: "South Africa"; readonly alpha2: "ZA"; readonly countryCode: "710"; readonly alpha3: "ZAF"; }, { readonly name: "South Sudan"; readonly alpha2: "SS"; readonly countryCode: "728"; readonly alpha3: "SSD"; }, { readonly name: "Spain"; readonly alpha2: "ES"; readonly countryCode: "724"; readonly alpha3: "ESP"; }, { readonly name: "Sri Lanka"; readonly alpha2: "LK"; readonly countryCode: "144"; readonly alpha3: "LKA"; }, { readonly name: "Sudan"; readonly alpha2: "SD"; readonly countryCode: "729"; readonly alpha3: "SDN"; }, { readonly name: "Suriname"; readonly alpha2: "SR"; readonly countryCode: "740"; readonly alpha3: "SUR"; }, { readonly name: "Sweden"; readonly alpha2: "SE"; readonly countryCode: "752"; readonly alpha3: "SWE"; }, { readonly name: "Switzerland"; readonly alpha2: "CH"; readonly countryCode: "756"; readonly alpha3: "CHE"; }, { readonly name: "Syrian Arab Republic"; readonly alpha2: "SY"; readonly countryCode: "760"; readonly alpha3: "SYR"; }, { readonly name: "Taiwan"; readonly alpha2: "TW"; readonly countryCode: "158"; readonly alpha3: "TWN"; }, { readonly name: "Tajikistan"; readonly alpha2: "TJ"; readonly countryCode: "762"; readonly alpha3: "TJK"; }, { readonly name: "Tanzania"; readonly alpha2: "TZ"; readonly countryCode: "834"; readonly alpha3: "TZA"; }, { readonly name: "Thailand"; readonly alpha2: "TH"; readonly countryCode: "764"; readonly alpha3: "THA"; }, { readonly name: "Timor-Leste"; readonly alpha2: "TL"; readonly countryCode: "626"; readonly alpha3: "TLS"; }, { readonly name: "Togo"; readonly alpha2: "TG"; readonly countryCode: "768"; readonly alpha3: "TGO"; }, { readonly name: "Tonga"; readonly alpha2: "TO"; readonly countryCode: "776"; readonly alpha3: "TON"; }, { readonly name: "Tonga"; readonly alpha2: "TO"; readonly countryCode: "776"; readonly alpha3: "TON"; }, { readonly name: "Trinidad and Tobago"; readonly alpha2: "TT"; readonly countryCode: "780"; readonly alpha3: "TTO"; }, { readonly name: "Tunisia"; readonly alpha2: "TN"; readonly countryCode: "788"; readonly alpha3: "TUN"; }, { readonly name: "Turkey"; readonly alpha2: "TR"; readonly countryCode: "792"; readonly alpha3: "TUR"; }, { readonly name: "Turkmenistan"; readonly alpha2: "TM"; readonly countryCode: "795"; readonly alpha3: "TKM"; }, { readonly name: "Tuvalu"; readonly alpha2: "TV"; readonly countryCode: "798"; readonly alpha3: "TUV"; }, { readonly name: "Uganda"; readonly alpha2: "UG"; readonly countryCode: "800"; readonly alpha3: "UGA"; }, { readonly name: "Ukraine"; readonly alpha2: "UA"; readonly countryCode: "804"; readonly alpha3: "UKR"; }, { readonly name: "United Arab Emirates"; readonly alpha2: "AE"; readonly countryCode: "784"; readonly alpha3: "ARE"; }, { readonly name: "United Kingdom"; readonly alpha2: "GB"; readonly countryCode: "826"; readonly alpha3: "GBR"; }, { readonly name: "United States of America"; readonly alpha2: "US"; readonly countryCode: "840"; readonly alpha3: "USA"; }, { readonly name: "Uruguay"; readonly alpha2: "UY"; readonly countryCode: "858"; readonly alpha3: "URY"; }, { readonly name: "Uzbekistan"; readonly alpha2: "UZ"; readonly countryCode: "860"; readonly alpha3: "UZB"; }, { readonly name: "Vanuatu"; readonly alpha2: "VU"; readonly countryCode: "548"; readonly alpha3: "VUT"; }, { readonly name: "Venezuela"; readonly alpha2: "VE"; readonly countryCode: "862"; readonly alpha3: "VEN"; }, { readonly name: "Viet Nam"; readonly alpha2: "VN"; readonly countryCode: "704"; readonly alpha3: "VNM"; }, { readonly name: "Yemen"; readonly alpha2: "YE"; readonly countryCode: "887"; readonly alpha3: "YEM"; }, { readonly name: "Zambia"; readonly alpha2: "ZM"; readonly countryCode: "894"; readonly alpha3: "ZMB"; }, { readonly name: "Zimbabwe"; readonly alpha2: "ZW"; readonly countryCode: "716"; readonly alpha3: "ZWE"; }]; //#endregion //#region ../constants/src/Marked.d.ts declare const MARKED: Constant<"Marked", unknown>; /** * **Marked** * * A constant that indicates that an item has been marked for * some ongoing operation. */ type Marked$2 = typeof MARKED; //#endregion //#region ../constants/src/Metrics.d.ts declare const DISTANCE_METRICS_LOOKUP: readonly [{ readonly abbrev: "km"; readonly name: "kilometer"; }, { readonly abbrev: "mi"; readonly name: "mile"; }, { readonly abbrev: "mm"; readonly name: "millimeter"; }, { readonly abbrev: "cm"; readonly name: "centimeter"; }, { readonly abbrev: "yd"; readonly name: "yard"; }, { readonly abbrev: "ft"; readonly name: "foot"; }, { readonly abbrev: "in"; readonly name: "inch"; }, { readonly abbrev: "m"; readonly name: "meter"; }, { readonly abbrev: "nm"; readonly name: "nautical mile"; }, { readonly abbrev: "nmi"; readonly name: "nanometer"; }, { readonly abbrev: "µm"; readonly name: "micrometer"; }, { readonly abbrev: "dm"; readonly name: "decimeter"; }, { readonly abbrev: "AU"; readonly name: "astronomical unit"; }, { readonly abbrev: "ly"; readonly name: "light year"; }, { readonly abbrev: "pc"; readonly name: "parsec"; }]; declare const MASS_METRICS_LOOKUP: readonly [{ readonly abbrev: "g"; readonly name: "gram"; }, { readonly abbrev: "kg"; readonly name: "kilogram"; }, { readonly abbrev: "mg"; readonly name: "milligram"; }, { readonly abbrev: "µg"; readonly name: "microgram"; }, { readonly abbrev: "t"; readonly name: "tonne"; }, { readonly abbrev: "lb"; readonly name: "pound"; }, { readonly abbrev: "oz"; readonly name: "ounce"; }, { readonly abbrev: "st"; readonly name: "stone"; }, { readonly abbrev: "ct"; readonly name: "carat"; }, { readonly abbrev: "Mt"; readonly name: "megatonne"; }, { readonly abbrev: "gt"; readonly name: "gigatonne"; }, { readonly abbrev: "slug"; readonly name: "slug"; }, { readonly abbrev: "dr"; readonly name: "dram"; }, { readonly abbrev: "gr"; readonly name: "grain"; }, { readonly abbrev: "q"; readonly name: "quintal"; }]; declare const SPEED_METRICS_LOOKUP: readonly [{ readonly abbrev: "m/s"; readonly name: "meters per second"; }, { readonly abbrev: "km/h"; readonly name: "kilometers per hour"; }, { readonly abbrev: "mph"; readonly name: "miles per hour"; }, { readonly abbrev: "kn"; readonly name: "knot"; }, { readonly abbrev: "ft/s"; readonly name: "feet per second"; }, { readonly abbrev: "c"; readonly name: "speed of light"; }, { readonly abbrev: "mach"; readonly name: "mach"; }, { readonly abbrev: "cm/s"; readonly name: "centimeters per second"; }, { readonly abbrev: "in/s"; readonly name: "inches per second"; }, { readonly abbrev: "ly/y"; readonly name: "light years per year"; }]; declare const ACCELERATION_METRICS_LOOKUP: readonly [{ readonly abbrev: "m/s²"; readonly name: "meters per second squared"; }, { readonly abbrev: "ft/s²"; readonly name: "feet per second squared"; }, { readonly abbrev: "g"; readonly name: "g-force"; }, { readonly abbrev: "Gal"; readonly name: "galileo"; }, { readonly abbrev: "cm/s²"; readonly name: "centimeters per second squared"; }, { readonly abbrev: "km/h²"; readonly name: "kilometers per hour squared"; }, { readonly abbrev: "in/s²"; readonly name: "inches per second squared"; }, { readonly abbrev: "mi/h²"; readonly name: "miles per hour squared"; }, { readonly abbrev: "kn/s²"; readonly name: "knots per second squared"; }]; declare const VOLUME_METRICS_LOOKUP: readonly [{ readonly abbrev: "L"; readonly name: "liter"; }, { readonly abbrev: "dL"; readonly name: "deciliter"; }, { readonly abbrev: "mL"; readonly name: "milliliter"; }, { readonly abbrev: "µL"; readonly name: "microliter"; }, { readonly abbrev: "cm³"; readonly name: "cubic centimeter"; }, { readonly abbrev: "m³"; readonly name: "cubic meter"; }, { readonly abbrev: "ft³"; readonly name: "cubic foot"; }, { readonly abbrev: "in³"; readonly name: "cubic inch"; }, { readonly abbrev: "gallon"; readonly name: "gallon"; }, { readonly abbrev: "qt"; readonly name: "quart"; }, { readonly abbrev: "pt"; readonly name: "pint"; }, { readonly abbrev: "fl oz"; readonly name: "fluid ounce"; }, { readonly abbrev: "barrel"; readonly name: "barrel"; }, { readonly abbrev: "tbsp"; readonly name: "tablespoon"; }, { readonly abbrev: "tsp"; readonly name: "teaspoon"; }]; declare const TEMPERATURE_METRICS_LOOKUP: readonly [{ readonly abbrev: "°C"; readonly name: "celsius"; }, { readonly abbrev: "°F"; readonly name: "fahrenheit"; }, { readonly abbrev: "K"; readonly name: "kelvin"; }]; declare const PRESSURE_METRICS_LOOKUP: readonly [{ readonly abbrev: "Pa"; readonly name: "pascal"; }, { readonly abbrev: "bar"; readonly name: "bar"; }, { readonly abbrev: "atm"; readonly name: "atmosphere"; }, { readonly abbrev: "mmHg"; readonly name: "millimeters of mercury"; }, { readonly abbrev: "psi"; readonly name: "pounds per square inch"; }]; declare const ENERGY_METRICS_LOOKUP: readonly [{ readonly abbrev: "J"; readonly name: "joule"; }, { readonly abbrev: "cal"; readonly name: "calorie"; }, { readonly abbrev: "kcal"; readonly name: "kilocalorie"; }, { readonly abbrev: "kWh"; readonly name: "kilowatt-hour"; }, { readonly abbrev: "BTU"; readonly name: "british thermal unit"; }, { readonly abbrev: "eV"; readonly name: "electronvolt"; }]; declare const TIME_METRICS_LOOKUP: readonly [{ readonly abbrev: "s"; readonly name: "second"; }, { readonly abbrev: "m"; readonly name: "minute"; }, { readonly abbrev: "h"; readonly name: "hour"; }, { readonly abbrev: "day"; readonly name: "day"; }, { readonly abbrev: "week"; readonly name: "week"; }, { readonly abbrev: "mo"; readonly name: "month"; }, { readonly abbrev: "ms"; readonly name: "millisecond"; }, { readonly abbrev: "µs"; readonly name: "microsecond"; }, { readonly abbrev: "ns"; readonly name: "nanosecond"; }]; declare const POWER_METRICS_LOOKUP: readonly [{ readonly abbrev: "W"; readonly name: "Watt"; }, { readonly abbrev: "kW"; readonly name: "kilowatt"; }, { readonly abbrev: "MW"; readonly name: "megawatt"; }, { readonly abbrev: "hp"; readonly name: "horsepower"; }, { readonly abbrev: "GW"; readonly name: "gigawatt"; }]; declare const FREQUENCY_METRICS_LOOKUP: readonly [{ readonly abbrev: "Hz"; readonly name: "hertz"; }, { readonly abbrev: "kHz"; readonly name: "kilohertz"; }, { readonly abbrev: "MHz"; readonly name: "megahertz"; }, { readonly abbrev: "GHz"; readonly name: "gigahertz"; }, { readonly abbrev: "THz"; readonly name: "terahertz"; }]; declare const VOLTAGE_METRICS_LOOKUP: readonly [{ readonly abbrev: "V"; readonly name: "volt"; }, { readonly abbrev: "kV"; readonly name: "kilovolt"; }, { readonly abbrev: "mV"; readonly name: "millivolt"; }, { readonly abbrev: "µV"; readonly name: "microvolt"; }]; declare const CURRENT_METRICS_LOOKUP: readonly [{ readonly abbrev: "A"; readonly name: "ampere"; }, { readonly abbrev: "mA"; readonly name: "milliampere"; }, { readonly abbrev: "µA"; readonly name: "microampere"; }, { readonly abbrev: "kA"; readonly name: "kiloampere"; }]; declare const RESISTANCE_METRICS_LOOKUP: readonly [{ readonly abbrev: "Ω"; readonly name: "ohm"; }, { readonly abbrev: "kΩ"; readonly name: "kiloohm"; }, { readonly abbrev: "MΩ"; readonly name: "megaohm"; }]; declare const LUMINOSITY_METRICS_LOOKUP: readonly [{ readonly abbrev: "cd"; readonly name: "candela"; }, { readonly abbrev: "lm"; readonly name: "lumen"; }, { readonly abbrev: "lx"; readonly name: "lux"; }]; declare const AREA_METRICS_LOOKUP: readonly [{ readonly abbrev: "m²"; readonly name: "square meter"; }, { readonly abbrev: "cm²"; readonly name: "square centimeter"; }, { readonly abbrev: "mm²"; readonly name: "square millimeter"; }, { readonly abbrev: "km²"; readonly name: "square kilometer"; }, { readonly abbrev: "ft²"; readonly name: "square foot"; }, { readonly abbrev: "in²"; readonly name: "square inch"; }, { readonly abbrev: "acre"; readonly name: "acre"; }, { readonly abbrev: "ha"; readonly name: "hectare"; }]; //#endregion //#region ../constants/src/Nesting.d.ts /** * the named nested configuration defined in this repo */ declare const KNOWN_NESTING_CONFIGURATIONS: ["brackets", "quotes", "brackets-and-quotes", "shallow-brackets", "shallow-brackets-and-quotes", "shallow-quotes"]; /** * A paired bracketing strategy which matches on * bracket characters: * * - parenthesis: `(` -> `)` * - square brackets: `[` -> `]` * - angle brackets: `<` -> `>` * - and curlies: `{` -> `}` */ declare const BRACKET_NESTING: { "{": "}"; "[": "]"; "<": ">"; "(": ")"; }; /** * A paired bracketing strategy which includes the three * main quotation symbols: * * - single quote (**'**), * - double quote (**"**), * - and backtick (**`**) */ declare const QUOTE_NESTING: { "\"": "\""; "'": "'"; "`": "`"; }; /** * A paired bracketing strategy which includes: * * - all bracket characters * - all quote characters */ declare const BRACKET_AND_QUOTE_NESTING: { "\"": "\""; "'": "'"; "`": "`"; "{": "}"; "[": "]"; "<": ">"; "(": ")"; }; /** * **Shallow Bracket Nesting** * * A hierarchical nesting configuration where bracket characters * are recognized at level 0, but inside brackets no further * nesting is recognized (empty config `{}`). * * This prevents "unbalanced" errors in utilities that only * care about the root level. */ declare const SHALLOW_BRACKET_NESTING: { "(": { exit: ")"; children: {}; }; "[": { exit: "]"; children: {}; }; "{": { exit: "}"; children: {}; }; "<": { exit: ">"; children: {}; }; }; /** * **Shallow Quote Nesting** * * A hierarchical nesting configuration where quote characters * are recognized at level 0, but inside quotes no further * nesting is recognized (empty config `{}`). * * This allows treating quoted content as literals, preventing * split characters inside quotes from being recognized. */ declare const SHALLOW_QUOTE_NESTING: { "\"": { exit: "\""; children: {}; }; "'": { exit: "'"; children: {}; }; "`": { exit: "`"; children: {}; }; }; /** * **Shallow Bracket and Quote Nesting** * * Combines shallow bracket and quote nesting strategies. * Both brackets and quotes are recognized at level 0, but * inside either, no further nesting is recognized. */ declare const SHALLOW_BRACKET_AND_QUOTE_NESTING: { "\"": { exit: "\""; children: {}; }; "'": { exit: "'"; children: {}; }; "`": { exit: "`"; children: {}; }; "(": { exit: ")"; children: {}; }; "[": { exit: "]"; children: {}; }; "{": { exit: "}"; children: {}; }; "<": { exit: ">"; children: {}; }; }; //#endregion //#region ../constants/src/NetworkConstants.d.ts declare const IPv6: { readonly Loopback: "::1/128"; readonly Multicast: "ff00::/8"; readonly IPv4MappedAddresses: "::FFFF:0:0/96"; readonly Unicast: "fe80::/10"; readonly DocumentationAddresses: "2001:db8::/32"; }; declare const NETWORK_PROTOCOL: readonly ["http", "ftp", "ws", "dns", "telnet", "imap", "pop3", "smtp", "https", "sftp", "wss", "sdns", "ssh"]; declare const PROTOCOL_DEFAULT_PORTS: { readonly http: 80; readonly https: 443; readonly ws: 80; readonly wss: 443; readonly ssh: 22; readonly telnet: 23; readonly dns: 53; readonly sdns: 853; readonly smtp: 25; readonly imap: 142; readonly pop3: 110; readonly ftp: 21; readonly sftp: 22; }; /** * **TLD** * * Top level domains in DNS. This is not a comprehensive list but * takes the core ones and adds in some popular choices. */ declare const TOP_LEVEL_DOMAINS: readonly ["com", "org", "net", "int", "edu", "gov", "io", "mil", "arpa", "academy", "agency", "analytics", "app", "art", "bet", "beer", "book", "coffee", "dot", "doctor", "dog", "family", "game", "guide", "guru", "info", "inc", "news", "new", "ninja", "now", "online", "page", "photos", "place", "pub", "room", "show", "technology", "tel", "tech", "team", "talk", "travel", "website", "work", "works", "wow", "uk", "us", "fr", "de", "eu", "london"]; //#endregion //#region ../constants/src/News.d.ts declare const US_NEWS: readonly [{ readonly company: "New York Times"; readonly baseUrls: readonly ["www.nytimes.com"]; }, { readonly company: "CNN"; readonly baseUrls: readonly ["www.cnn.com"]; }, { readonly company: "Fox News"; readonly baseUrls: readonly ["www.foxnews.com"]; }, { readonly company: "NBC News"; readonly baseUrls: readonly ["www.nbcnews.com", "www.msnbc.com"]; }, { readonly company: "ABC News"; readonly baseUrls: readonly ["abcnews.go.com"]; }, { readonly company: "The Washington Post"; readonly baseUrls: readonly ["www.washingtonpost.com"]; }, { readonly company: "USA Today"; readonly baseUrls: readonly ["www.usatoday.com"]; }, { readonly company: "Bloomberg"; readonly baseUrls: readonly ["www.bloomberg.com"]; }, { readonly company: "NPR"; readonly baseUrls: readonly ["www.npr.org"]; }, { readonly company: "CBS News"; readonly baseUrls: readonly ["www.cbsnews.com"]; }, { readonly company: "The Wall Street Journal"; readonly baseUrls: readonly ["www.wsj.com"]; }, { readonly company: "Associated Press (AP)"; readonly baseUrls: readonly ["www.apnews.com", "www.ap.org"]; }, { readonly company: "Reuters"; readonly baseUrls: readonly ["www.reuters.com"]; }, { readonly company: "Newsweek"; readonly baseUrls: readonly ["www.newsweek.com"]; }, { readonly company: "Politico"; readonly baseUrls: readonly ["www.politico.com"]; }, { readonly company: "The Atlantic"; readonly baseUrls: readonly ["www.theatlantic.com"]; }, { readonly company: "Nexstar Media Group"; readonly baseUrls: readonly ["www.nexstar.tv"]; }, { readonly company: "PBS News"; readonly baseUrls: readonly ["www.pbs.org"]; }, { readonly company: "HuffPost"; readonly baseUrls: readonly ["www.huffpost.com"]; }, { readonly company: "The Boston Globe"; readonly baseUrls: readonly ["www.bostonglobe.com"]; }]; declare const UK_NEWS: readonly [{ readonly company: "BBC"; readonly baseUrls: readonly ["www.bbc.co.uk", "www.bbc.com"]; }, { readonly company: "The Guardian"; readonly baseUrls: readonly ["www.theguardian.com/uk"]; }, { readonly company: "The Daily Mail"; readonly baseUrls: readonly ["www.dailymail.co.uk"]; }, { readonly company: "The Sun"; readonly baseUrls: readonly ["www.thesun.co.uk"]; }, { readonly company: "The Times"; readonly baseUrls: readonly ["www.thetimes.co.uk"]; }, { readonly company: "Sky News"; readonly baseUrls: readonly ["news.sky.com"]; }, { readonly company: "The Telegraph"; readonly baseUrls: readonly ["www.telegraph.co.uk"]; }, { readonly company: "ITV News"; readonly baseUrls: readonly ["www.itv.com/news"]; }, { readonly company: "Financial Times"; readonly baseUrls: readonly ["www.ft.com"]; }, { readonly company: "Metro"; readonly baseUrls: readonly ["www.metro.co.uk"]; }, { readonly company: "The Independent"; readonly baseUrls: readonly ["www.independent.co.uk"]; }, { readonly company: "Evening Standard"; readonly baseUrls: readonly ["www.standard.co.uk"]; }, { readonly company: "Daily Mirror"; readonly baseUrls: readonly ["www.mirror.co.uk"]; }, { readonly company: "Channel 4 News"; readonly baseUrls: readonly ["www.channel4.com/news"]; }, { readonly company: "LBC"; readonly baseUrls: readonly ["www.lbc.co.uk"]; }, { readonly company: "Daily Express"; readonly baseUrls: readonly ["www.express.co.uk"]; }, { readonly company: "Birmingham Mail"; readonly baseUrls: readonly ["www.birminghammail.co.uk"]; }, { readonly company: "Manchester Evening News"; readonly baseUrls: readonly ["www.manchestereveningnews.co.uk"]; }, { readonly company: "The Scotsman"; readonly baseUrls: readonly ["www.scotsman.com"]; }, { readonly company: "Daily Record"; readonly baseUrls: readonly ["www.dailyrecord.co.uk"]; }]; declare const GERMAN_NEWS: readonly [{ readonly company: "BILD"; readonly baseUrls: readonly ["www.bild.de"]; }, { readonly company: "Die Zeit"; readonly baseUrls: readonly ["www.zeit.de"]; }, { readonly company: "Frankfurter Allgemeine Zeitung"; readonly baseUrls: readonly ["www.faz.net"]; }, { readonly company: "Süddeutsche Zeitung"; readonly baseUrls: readonly ["www.sueddeutsche.de"]; }, { readonly company: "Der Spiegel"; readonly baseUrls: readonly ["www.spiegel.de"]; }, { readonly company: "Die Welt"; readonly baseUrls: readonly ["www.welt.de"]; }, { readonly company: "Tagesschau"; readonly baseUrls: readonly ["www.tagesschau.de"]; }, { readonly company: "t-online"; readonly baseUrls: readonly ["www.t-online.de"]; }, { readonly company: "n-tv"; readonly baseUrls: readonly ["www.n-tv.de"]; }, { readonly company: "Handelsblatt"; readonly baseUrls: readonly ["www.handelsblatt.com"]; }, { readonly company: "Focus Online"; readonly baseUrls: readonly ["www.focus.de"]; }, { readonly company: "Frankfurter Rundschau"; readonly baseUrls: readonly ["www.fr.de", "www.fr-online.de"]; }, { readonly company: "taz - die tageszeitung"; readonly baseUrls: readonly ["www.taz.de"]; }, { readonly company: "Der Tagesspiegel"; readonly baseUrls: readonly ["www.tagesspiegel.de"]; }, { readonly company: "Rheinische Post"; readonly baseUrls: readonly ["www.rp-online.de"]; }, { readonly company: "Express"; readonly baseUrls: readonly ["www.express.de"]; }, { readonly company: "Münchner Merkur"; readonly baseUrls: readonly ["www.merkur.de"]; }, { readonly company: "Stuttgarter Zeitung"; readonly baseUrls: readonly ["www.stuttgarter-zeitung.de"]; }, { readonly company: "Hamburger Abendblatt"; readonly baseUrls: readonly ["www.abendblatt.de"]; }, { readonly company: "Deutsche Welle"; readonly baseUrls: readonly ["www.dw.com"]; }]; declare const FRENCH_NEWS: readonly [{ readonly company: "Le Figaro"; readonly baseUrls: readonly ["www.lefigaro.fr"]; }, { readonly company: "Le Monde"; readonly baseUrls: readonly ["www.lemonde.fr"]; }, { readonly company: "France 24"; readonly baseUrls: readonly ["www.france24.com"]; }, { readonly company: "Libération"; readonly baseUrls: readonly ["www.liberation.fr"]; }, { readonly company: "Les Echos"; readonly baseUrls: readonly ["www.lesechos.fr"]; }, { readonly company: "Ouest-France"; readonly baseUrls: readonly ["www.ouest-france.fr"]; }, { readonly company: "Le Parisien"; readonly baseUrls: readonly ["www.leparisien.fr"]; }, { readonly company: "Mediapart"; readonly baseUrls: readonly ["www.mediapart.fr"]; }, { readonly company: "L'Express"; readonly baseUrls: readonly ["www.lexpress.fr"]; }, { readonly company: "La Croix"; readonly baseUrls: readonly ["www.la-croix.com"]; }, { readonly company: "20 Minutes"; readonly baseUrls: readonly ["www.20minutes.fr"]; }, { readonly company: "Courrier International"; readonly baseUrls: readonly ["www.courrierinternational.com"]; }, { readonly company: "Le Point"; readonly baseUrls: readonly ["www.lepoint.fr"]; }, { readonly company: "Marianne"; readonly baseUrls: readonly ["www.marianne.net"]; }, { readonly company: "BFM TV"; readonly baseUrls: readonly ["www.bfmtv.com"]; }, { readonly company: "RTL France"; readonly baseUrls: readonly ["www.rtl.fr"]; }, { readonly company: "Charlie Hebdo"; readonly baseUrls: readonly ["www.charliehebdo.fr"]; }, { readonly company: "Challenges"; readonly baseUrls: readonly ["www.challenges.fr"]; }, { readonly company: "Télérama"; readonly baseUrls: readonly ["www.telerama.fr"]; }, { readonly company: "L'Obs"; readonly baseUrls: readonly ["www.nouvelobs.com"]; }]; declare const CANADIAN_NEWS: readonly [{ readonly company: "CBC News"; readonly baseUrls: readonly ["www.cbc.ca"]; }, { readonly company: "CTV News"; readonly baseUrls: readonly ["www.ctvnews.ca"]; }, { readonly company: "The Globe and Mail"; readonly baseUrls: readonly ["www.theglobeandmail.com"]; }, { readonly company: "Global News"; readonly baseUrls: readonly ["www.globalnews.ca"]; }, { readonly company: "Toronto Star"; readonly baseUrls: readonly ["www.thestar.com"]; }, { readonly company: "National Post"; readonly baseUrls: readonly ["www.nationalpost.com"]; }, { readonly company: "La Presse"; readonly baseUrls: readonly ["www.lapresse.ca"]; }, { readonly company: "Radio-Canada"; readonly baseUrls: readonly ["ici.radio-canada.ca"]; }, { readonly company: "The Canadian Press"; readonly baseUrls: readonly ["www.thecanadianpress.com"]; }, { readonly company: "Financial Post"; readonly baseUrls: readonly ["financialpost.com"]; }, { readonly company: "The Weather Network"; readonly baseUrls: readonly ["www.theweathernetwork.com"]; }, { readonly company: "Le Devoir"; readonly baseUrls: readonly ["www.ledevoir.com"]; }, { readonly company: "TVA Nouvelles"; readonly baseUrls: readonly ["www.tvanouvelles.ca"]; }, { readonly company: "Journal de Montréal"; readonly baseUrls: readonly ["www.journaldemontreal.com"]; }, { readonly company: "CityNews"; readonly baseUrls: readonly ["www.citynews.ca"]; }, { readonly company: "BNN Bloomberg"; readonly baseUrls: readonly ["www.bnnbloomberg.ca"]; }, { readonly company: "The Hamilton Spectator"; readonly baseUrls: readonly ["www.thespec.com"]; }, { readonly company: "Ottawa Citizen"; readonly baseUrls: readonly ["ottawacitizen.com"]; }, { readonly company: "Windsor Star"; readonly baseUrls: readonly ["windsorstar.com"]; }, { readonly company: "Edmonton Journal"; readonly baseUrls: readonly ["edmontonjournal.com"]; }]; declare const DUTCH_NEWS: readonly [{ readonly company: "Algemeen Dagblad (AD)"; readonly baseUrls: readonly ["www.ad.nl"]; }, { readonly company: "NOS"; readonly baseUrls: readonly ["www.nos.nl"]; }, { readonly company: "De Telegraaf"; readonly baseUrls: readonly ["www.telegraaf.nl"]; }, { readonly company: "NU.nl"; readonly baseUrls: readonly ["www.nu.nl"]; }, { readonly company: "Volkskrant"; readonly baseUrls: readonly ["www.volkskrant.nl"]; }, { readonly company: "NRC Handelsblad"; readonly baseUrls: readonly ["www.nrc.nl"]; }, { readonly company: "Trouw"; readonly baseUrls: readonly ["www.trouw.nl"]; }, { readonly company: "Het Parool"; readonly baseUrls: readonly ["www.parool.nl"]; }, { readonly company: "RTL Nieuws"; readonly baseUrls: readonly ["www.rtlnieuws.nl"]; }, { readonly company: "BNR Nieuwsradio"; readonly baseUrls: readonly ["www.bnr.nl"]; }, { readonly company: "Emerce"; readonly baseUrls: readonly ["www.emerce.nl"]; }, { readonly company: "VPRO"; readonly baseUrls: readonly ["www.vpro.nl"]; }, { readonly company: "De Gelderlander"; readonly baseUrls: readonly ["www.gelderlander.nl"]; }, { readonly company: "Friesch Dagblad"; readonly baseUrls: readonly ["www.frieschdagblad.nl"]; }, { readonly company: "De Stentor"; readonly baseUrls: readonly ["www.destentor.nl"]; }, { readonly company: "Metro Nieuws"; readonly baseUrls: readonly ["www.metronieuws.nl"]; }, { readonly company: "ANP"; readonly baseUrls: readonly ["www.anp.nl"]; }, { readonly company: "Dagblad van het Noorden"; readonly baseUrls: readonly ["www.dvhn.nl"]; }, { readonly company: "Reformatorisch Dagblad"; readonly baseUrls: readonly ["www.rd.nl"]; }, { readonly company: "Financieele Dagblad"; readonly baseUrls: readonly ["www.fd.nl"]; }]; declare const ITALIAN_NEWS: readonly [{ readonly company: "ANSA"; readonly baseUrls: readonly ["www.ansa.it", "www.ansamed.info"]; }, { readonly company: "Corriere della Sera"; readonly baseUrls: readonly ["www.corriere.it"]; }, { readonly company: "la Repubblica"; readonly baseUrls: readonly ["www.repubblica.it"]; }, { readonly company: "Il Sole 24 Ore"; readonly baseUrls: readonly ["www.ilsole24ore.com"]; }, { readonly company: "La Stampa"; readonly baseUrls: readonly ["www.lastampa.it"]; }, { readonly company: "Il Messaggero"; readonly baseUrls: readonly ["www.ilmessaggero.it"]; }, { readonly company: "Il Giornale"; readonly baseUrls: readonly ["www.ilgiornale.it"]; }, { readonly company: "Avvenire"; readonly baseUrls: readonly ["www.avvenire.it"]; }, { readonly company: "Il Fatto Quotidiano"; readonly baseUrls: readonly ["www.ilfattoquotidiano.it"]; }, { readonly company: "La Nazione"; readonly baseUrls: readonly ["www.lanazione.it"]; }, { readonly company: "TgCom24"; readonly baseUrls: readonly ["www.tgcom24.mediaset.it"]; }, { readonly company: "Sky TG24"; readonly baseUrls: readonly ["tg24.sky.it"]; }, { readonly company: "Rai News"; readonly baseUrls: readonly ["www.rainews.it"]; }, { readonly company: "Gazzetta dello Sport"; readonly baseUrls: readonly ["www.gazzetta.it"]; }, { readonly company: "Il Resto del Carlino"; readonly baseUrls: readonly ["www.ilrestodelcarlino.it"]; }, { readonly company: "Il Mattino"; readonly baseUrls: readonly ["www.ilmattino.it"]; }, { readonly company: "Il Secolo XIX"; readonly baseUrls: readonly ["www.ilsecoloxix.it"]; }, { readonly company: "Italia Oggi"; readonly baseUrls: readonly ["www.italiaoggi.it"]; }, { readonly company: "Libero"; readonly baseUrls: readonly ["www.liberoquotidiano.it"]; }, { readonly company: "Il Tirreno"; readonly baseUrls: readonly ["www.iltirreno.it"]; }]; declare const BELGIUM_NEWS: readonly [{ readonly company: "Het Laatste Nieuws (HLN)"; readonly baseUrls: readonly ["www.hln.be"]; }, { readonly company: "Nieuwsblad"; readonly baseUrls: readonly ["www.nieuwsblad.be"]; }, { readonly company: "RTBF"; readonly baseUrls: readonly ["www.rtbf.be"]; }, { readonly company: "Sudinfo"; readonly baseUrls: readonly ["www.sudinfo.be"]; }, { readonly company: "7sur7"; readonly baseUrls: readonly ["www.7sur7.be"]; }, { readonly company: "Le Soir"; readonly baseUrls: readonly ["www.lesoir.be"]; }, { readonly company: "De Standaard"; readonly baseUrls: readonly ["www.standaard.be"]; }, { readonly company: "VRT NWS"; readonly baseUrls: readonly ["www.vrt.be"]; }, { readonly company: "La Libre"; readonly baseUrls: readonly ["www.lalibre.be"]; }, { readonly company: "Gazet van Antwerpen"; readonly baseUrls: readonly ["www.gva.be"]; }, { readonly company: "Het Belang van Limburg"; readonly baseUrls: readonly ["www.hbvl.be"]; }, { readonly company: "De Morgen"; readonly baseUrls: readonly ["www.demorgen.be"]; }, { readonly company: "L'Avenir"; readonly baseUrls: readonly ["www.lavenir.net"]; }, { readonly company: "The Brussels Times"; readonly baseUrls: readonly ["www.brusselstimes.com"]; }, { readonly company: "Metro Belgique"; readonly baseUrls: readonly ["nl.metrotime.be"]; }, { readonly company: "Sudpresse"; readonly baseUrls: readonly ["www.sudpress.be"]; }, { readonly company: "Flamish Radio and TV Broadcasting Organization (VRT)"; readonly baseUrls: readonly ["www.vrt.be"]; }, { readonly company: "Knack"; readonly baseUrls: readonly ["www.knack.be"]; }, { readonly company: "De Tijd"; readonly baseUrls: readonly ["www.tijd.be"]; }, { readonly company: "BX1"; readonly baseUrls: readonly ["www.bx1.be"]; }]; declare const MEXICAN_NEWS: readonly [{ readonly company: "Televisa"; readonly baseUrls: readonly ["www.televisa.news"]; }, { readonly company: "El Universal"; readonly baseUrls: readonly ["www.eluniversal.com.mx"]; }, { readonly company: "Milenio"; readonly baseUrls: readonly ["www.milenio.com"]; }, { readonly company: "Excélsior"; readonly baseUrls: readonly ["www.excelsior.com.mx"]; }, { readonly company: "Reforma"; readonly baseUrls: readonly ["www.reforma.com"]; }, { readonly company: "La Jornada"; readonly baseUrls: readonly ["www.jornada.com.mx"]; }, { readonly company: "El Financiero"; readonly baseUrls: readonly ["www.elfinanciero.com.mx"]; }, { readonly company: "Proceso"; readonly baseUrls: readonly ["www.proceso.com.mx"]; }, { readonly company: "SDP Noticias"; readonly baseUrls: readonly ["www.sdpnoticias.com"]; }, { readonly company: "Diario de Yucatán"; readonly baseUrls: readonly ["www.yucatan.com.mx"]; }, { readonly company: "El Economista"; readonly baseUrls: readonly ["www.eleconomista.com.mx"]; }, { readonly company: "El Heraldo de México"; readonly baseUrls: readonly ["www.heraldodemexico.com.mx"]; }, { readonly company: "Noticieros Televisa"; readonly baseUrls: readonly ["noticieros.televisa.com"]; }, { readonly company: "Expansión"; readonly baseUrls: readonly ["expansion.mx"]; }, { readonly company: "La Razón"; readonly baseUrls: readonly ["www.razon.com.mx"]; }, { readonly company: "Noroeste"; readonly baseUrls: readonly ["www.noroeste.com.mx"]; }, { readonly company: "Uniradio Noticias"; readonly baseUrls: readonly ["www.uniradionoticias.com"]; }, { readonly company: "El Imparcial"; readonly baseUrls: readonly ["www.elimparcial.com"]; }, { readonly company: "Publimetro México"; readonly baseUrls: readonly ["www.publimetro.com.mx"]; }, { readonly company: "Notimex"; readonly baseUrls: readonly ["www.notimex.gob.mx"]; }]; declare const SPANISH_NEWS: readonly [{ readonly company: "El País"; readonly baseUrls: readonly ["www.elpais.com"]; }, { readonly company: "El Mundo"; readonly baseUrls: readonly ["www.elmundo.es"]; }, { readonly company: "ABC"; readonly baseUrls: readonly ["www.abc.es"]; }, { readonly company: "La Vanguardia"; readonly baseUrls: readonly ["www.lavanguardia.com"]; }, { readonly company: "El Confidencial"; readonly baseUrls: readonly ["www.elconfidencial.com"]; }, { readonly company: "La Razón"; readonly baseUrls: readonly ["www.larazon.es"]; }, { readonly company: "20 Minutos"; readonly baseUrls: readonly ["www.20minutos.es"]; }, { readonly company: "Agencia EFE"; readonly baseUrls: readonly ["www.efe.com"]; }, { readonly company: "Europa Press"; readonly baseUrls: readonly ["www.europapress.es"]; }, { readonly company: "Diario AS"; readonly baseUrls: readonly ["www.as.com"]; }, { readonly company: "Mundo Deportivo"; readonly baseUrls: readonly ["www.mundodeportivo.com"]; }, { readonly company: "El Periódico"; readonly baseUrls: readonly ["www.elperiodico.com"]; }, { readonly company: "Cinco Días"; readonly baseUrls: readonly ["www.cincodias.com"]; }, { readonly company: "Expansión"; readonly baseUrls: readonly ["www.expansion.com"]; }, { readonly company: "La Información"; readonly baseUrls: readonly ["www.lainformacion.com"]; }, { readonly company: "OK Diario"; readonly baseUrls: readonly ["www.okdiario.com"]; }, { readonly company: "Heraldo de Aragón"; readonly baseUrls: readonly ["www.heraldo.es"]; }, { readonly company: "Faro de Vigo"; readonly baseUrls: readonly ["www.farodevigo.es"]; }, { readonly company: "El Correo"; readonly baseUrls: readonly ["www.elcorreo.com"]; }, { readonly company: "Diario Sur"; readonly baseUrls: readonly ["www.diariosur.es"]; }]; declare const INDIAN_NEWS: readonly [{ readonly company: "The Times of India"; readonly baseUrls: readonly ["timesofindia.indiatimes.com"]; }, { readonly company: "The Hindu"; readonly baseUrls: readonly ["www.thehindu.com"]; }, { readonly company: "Hindustan Times"; readonly baseUrls: readonly ["www.hindustantimes.com"]; }, { readonly company: "NDTV"; readonly baseUrls: readonly ["www.ndtv.com"]; }, { readonly company: "India Today"; readonly baseUrls: readonly ["www.indiatoday.in"]; }, { readonly company: "Zee News"; readonly baseUrls: readonly ["zeenews.india.com"]; }, { readonly company: "Indian Express"; readonly baseUrls: readonly ["indianexpress.com"]; }, { readonly company: "The Economic Times"; readonly baseUrls: readonly ["economictimes.indiatimes.com"]; }, { readonly company: "Deccan Herald"; readonly baseUrls: readonly ["www.deccanherald.com"]; }, { readonly company: "DNA India"; readonly baseUrls: readonly ["www.dnaindia.com"]; }, { readonly company: "The Print"; readonly baseUrls: readonly ["theprint.in"]; }, { readonly company: "News18"; readonly baseUrls: readonly ["www.news18.com"]; }, { readonly company: "Scroll.in"; readonly baseUrls: readonly ["scroll.in"]; }, { readonly company: "Asian News International (ANI)"; readonly baseUrls: readonly ["www.aninews.in"]; }, { readonly company: "Outlook India"; readonly baseUrls: readonly ["www.outlookindia.com"]; }, { readonly company: "Business Standard"; readonly baseUrls: readonly ["www.business-standard.com"]; }, { readonly company: "Mint"; readonly baseUrls: readonly ["www.livemint.com"]; }, { readonly company: "OneIndia"; readonly baseUrls: readonly ["www.oneindia.com"]; }, { readonly company: "Quint"; readonly baseUrls: readonly ["www.thequint.com"]; }, { readonly company: "Free Press Journal"; readonly baseUrls: readonly ["www.freepressjournal.in"]; }]; declare const CHINESE_NEWS: readonly [{ readonly company: "Xinhua News Agency"; readonly baseUrls: readonly ["www.xinhuanet.com"]; }, { readonly company: "China Central Television (CCTV)"; readonly baseUrls: readonly ["www.cctv.com"]; }, { readonly company: "China Daily"; readonly baseUrls: readonly ["www.chinadaily.com.cn"]; }, { readonly company: "CGTN (China Global Television Network)"; readonly baseUrls: readonly ["www.cgtn.com"]; }, { readonly company: "People's Daily"; readonly baseUrls: readonly ["www.people.cn"]; }, { readonly company: "Global Times"; readonly baseUrls: readonly ["www.globaltimes.cn"]; }, { readonly company: "South China Morning Post"; readonly baseUrls: readonly ["www.scmp.com"]; }, { readonly company: "Shanghai Daily"; readonly baseUrls: readonly ["www.shanghaidaily.com"]; }, { readonly company: "China News Service"; readonly baseUrls: readonly ["www.ecns.cn"]; }, { readonly company: "Caixin"; readonly baseUrls: readonly ["www.caixinglobal.com"]; }, { readonly company: "The Paper"; readonly baseUrls: readonly ["www.thepaper.cn"]; }, { readonly company: "Yicai Global"; readonly baseUrls: readonly ["www.yicaiglobal.com"]; }, { readonly company: "Economic Daily"; readonly baseUrls: readonly ["www.ce.cn"]; }, { readonly company: "21st Century Business Herald"; readonly baseUrls: readonly ["www.21jingji.com"]; }, { readonly company: "Beijing Review"; readonly baseUrls: readonly ["www.bjreview.com"]; }, { readonly company: "China Economic Net"; readonly baseUrls: readonly ["www.ce.cn"]; }, { readonly company: "Tencent News"; readonly baseUrls: readonly ["news.qq.com"]; }, { readonly company: "Sina News"; readonly baseUrls: readonly ["news.sina.com.cn"]; }, { readonly company: "NetEase News"; readonly baseUrls: readonly ["news.163.com"]; }, { readonly company: "Phoenix TV"; readonly baseUrls: readonly ["www.ifeng.com"]; }]; /** news sites in Denmark */ declare const DANISH_NEWS: readonly [{ readonly company: "Politiken"; readonly baseUrls: readonly ["www.politiken.dk"]; }, { readonly company: "Berlingske"; readonly baseUrls: readonly ["www.berlingske.dk"]; }, { readonly company: "Jyllands-Posten"; readonly baseUrls: readonly ["jyllands-posten.dk"]; }, { readonly company: "Ekstra Bladet"; readonly baseUrls: readonly ["ekstrabladet.dk"]; }, { readonly company: "Information"; readonly baseUrls: readonly ["www.information.dk"]; }, { readonly company: "BT"; readonly baseUrls: readonly ["www.bt.dk"]; }, { readonly company: "Weekendavisen"; readonly baseUrls: readonly ["www.weekendavisen.dk"]; }, { readonly company: "Fyens Stiftstidende"; readonly baseUrls: readonly ["fyens.dk"]; }, { readonly company: "Kristeligt Dagblad"; readonly baseUrls: readonly ["www.kristeligt-dagblad.dk"]; }, { readonly company: "Copenhagen Post"; readonly baseUrls: readonly ["cphpost.dk"]; }, { readonly company: "Nordjyske Stiftstidende"; readonly baseUrls: readonly ["nordjyske.dk"]; }, { readonly company: "Århus Stiftstidende"; readonly baseUrls: readonly ["stiften.dk"]; }, { readonly company: "Dagbladet Børsen"; readonly baseUrls: readonly ["borsen.dk"]; }, { readonly company: "Lokalavisen"; readonly baseUrls: readonly ["lokalavisen.dk"]; }, { readonly company: "TV2 Nyheder"; readonly baseUrls: readonly ["tv2.dk"]; }, { readonly company: "DR Nyheder"; readonly baseUrls: readonly ["dr.dk"]; }, { readonly company: "Avisen Danmark"; readonly baseUrls: readonly ["avisen.dk"]; }, { readonly company: "Fagbladet 3F"; readonly baseUrls: readonly ["fagbladet3f.dk"]; }, { readonly company: "Herning Folkeblad"; readonly baseUrls: readonly ["herningfolkeblad.dk"]; }, { readonly company: "Midtjyllands Avis"; readonly baseUrls: readonly ["midtjyllandsavis.dk"]; }]; declare const SWISS_NEWS: readonly [{ readonly company: "Neue Zürcher Zeitung (NZZ)"; readonly baseUrls: readonly ["www.nzz.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Swissinfo"; readonly baseUrls: readonly ["www.swissinfo.ch"]; readonly type: readonly ["digital-first"]; }, { readonly company: "20 Minuten"; readonly baseUrls: readonly ["www.20min.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Blick"; readonly baseUrls: readonly ["www.blick.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Le Temps"; readonly baseUrls: readonly ["www.letemps.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Tages-Anzeiger"; readonly baseUrls: readonly ["www.tagesanzeiger.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "SRF News"; readonly baseUrls: readonly ["www.srf.ch"]; readonly type: readonly ["television", "radio", "digital"]; }, { readonly company: "Luzerner Zeitung"; readonly baseUrls: readonly ["www.luzernerzeitung.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "La Tribune de Genève"; readonly baseUrls: readonly ["www.tdg.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Aargauer Zeitung"; readonly baseUrls: readonly ["www.aargauerzeitung.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "24 Heures"; readonly baseUrls: readonly ["www.24heures.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Radio Télévision Suisse (RTS)"; readonly baseUrls: readonly ["www.rts.ch"]; readonly type: readonly ["television", "radio", "digital"]; }, { readonly company: "Der Bund"; readonly baseUrls: readonly ["www.derbund.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Schweizer Radio und Fernsehen (SRF)"; readonly baseUrls: readonly ["www.srf.ch"]; readonly type: readonly ["television", "radio", "digital"]; }, { readonly company: "Basler Zeitung"; readonly baseUrls: readonly ["www.bazonline.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Handelszeitung"; readonly baseUrls: readonly ["www.handelszeitung.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Watson"; readonly baseUrls: readonly ["www.watson.ch"]; readonly type: readonly ["digital-first"]; }, { readonly company: "Le Matin"; readonly baseUrls: readonly ["www.lematin.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "La Liberté"; readonly baseUrls: readonly ["www.laliberte.ch"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "The Swiss Times"; readonly baseUrls: readonly ["www.theswisstimes.ch"]; readonly type: readonly ["digital-first"]; }]; declare const AUSTRALIAN_NEWS: readonly [{ readonly company: "ABC News"; readonly baseUrls: readonly ["www.abc.net.au"]; readonly type: readonly ["television", "radio", "digital"]; }, { readonly company: "The Sydney Morning Herald"; readonly baseUrls: readonly ["www.smh.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "The Australian"; readonly baseUrls: readonly ["www.theaustralian.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Herald Sun"; readonly baseUrls: readonly ["www.heraldsun.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "9News"; readonly baseUrls: readonly ["www.9news.com.au"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "SBS News"; readonly baseUrls: readonly ["www.sbs.com.au"]; readonly type: readonly ["television", "digital", "multicultural"]; }, { readonly company: "The Age"; readonly baseUrls: readonly ["www.theage.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Sky News Australia"; readonly baseUrls: readonly ["www.skynews.com.au"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Australian Financial Review"; readonly baseUrls: readonly ["www.afr.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "news.com.au"; readonly baseUrls: readonly ["www.news.com.au"]; readonly type: readonly ["digital-first"]; }, { readonly company: "The Courier-Mail"; readonly baseUrls: readonly ["www.couriermail.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "7NEWS"; readonly baseUrls: readonly ["7news.com.au"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "The West Australian"; readonly baseUrls: readonly ["www.thewest.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Daily Telegraph"; readonly baseUrls: readonly ["www.dailytelegraph.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Guardian Australia"; readonly baseUrls: readonly ["www.theguardian.com/au"]; readonly type: readonly ["digital-first"]; }, { readonly company: "Crikey"; readonly baseUrls: readonly ["www.crikey.com.au"]; readonly type: readonly ["digital-first", "independent"]; }, { readonly company: "AAP (Australian Associated Press)"; readonly baseUrls: readonly ["www.aap.com.au"]; readonly type: readonly ["news agency", "digital"]; }, { readonly company: "NT News"; readonly baseUrls: readonly ["www.ntnews.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "The Canberra Times"; readonly baseUrls: readonly ["www.canberratimes.com.au"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Brisbane Times"; readonly baseUrls: readonly ["www.brisbanetimes.com.au"]; readonly type: readonly ["digital-first"]; }]; declare const JAPANESE_NEWS: readonly [{ readonly company: "The Asahi Shimbun"; readonly baseUrls: readonly ["www.asahi.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Yomiuri Shimbun"; readonly baseUrls: readonly ["www.yomiuri.co.jp"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Nikkei"; readonly baseUrls: readonly ["www.nikkei.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Mainichi Shimbun"; readonly baseUrls: readonly ["mainichi.jp"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Kyodo News"; readonly baseUrls: readonly ["www.kyodonews.jp"]; readonly type: readonly ["news agency", "digital"]; }, { readonly company: "Japan Times"; readonly baseUrls: readonly ["www.japantimes.co.jp"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "NHK"; readonly baseUrls: readonly ["www.nhk.or.jp"]; readonly type: readonly ["television", "radio", "digital"]; }, { readonly company: "Fuji News Network (FNN)"; readonly baseUrls: readonly ["www.fnn.jp"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Sankei Shimbun"; readonly baseUrls: readonly ["www.sankei.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Toyo Keizai"; readonly baseUrls: readonly ["www.toyokeizai.net"]; readonly type: readonly ["digital", "business magazine"]; }, { readonly company: "Hokkaido Shimbun"; readonly baseUrls: readonly ["www.hokkaido-np.co.jp"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Shizuoka Shimbun"; readonly baseUrls: readonly ["www.at-s.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Tokyo Shimbun"; readonly baseUrls: readonly ["www.tokyo-np.co.jp"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Yahoo Japan News"; readonly baseUrls: readonly ["news.yahoo.co.jp"]; readonly type: readonly ["digital-first"]; }, { readonly company: "TBS News"; readonly baseUrls: readonly ["news.tbs.co.jp"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Nippon TV News 24 Japan"; readonly baseUrls: readonly ["www.news24.jp"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Jiji Press"; readonly baseUrls: readonly ["www.jiji.com"]; readonly type: readonly ["news agency", "digital"]; }, { readonly company: "TV Asahi News"; readonly baseUrls: readonly ["news.tv-asahi.co.jp"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "WOWOW Prime News"; readonly baseUrls: readonly ["www.wowow.co.jp"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Kansai Telecasting Corporation (KTV)"; readonly baseUrls: readonly ["www.ktv.jp"]; readonly type: readonly ["television", "digital"]; }]; declare const SOUTH_KOREAN_NEWS: readonly [{ readonly company: "Yonhap News Agency"; readonly baseUrls: readonly ["www.yonhapnews.co.kr"]; readonly type: readonly ["news agency", "digital"]; }, { readonly company: "The Korea Herald"; readonly baseUrls: readonly ["www.koreaherald.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "The Korea Times"; readonly baseUrls: readonly ["www.koreatimes.co.kr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Chosun Ilbo"; readonly baseUrls: readonly ["www.chosun.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "JoongAng Ilbo"; readonly baseUrls: readonly ["www.joongang.co.kr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Dong-A Ilbo"; readonly baseUrls: readonly ["www.donga.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "MBC News"; readonly baseUrls: readonly ["www.imnews.imbc.com"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "SBS News"; readonly baseUrls: readonly ["news.sbs.co.kr"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "KBS News"; readonly baseUrls: readonly ["news.kbs.co.kr"]; readonly type: readonly ["television", "radio", "digital"]; }, { readonly company: "Hankyoreh"; readonly baseUrls: readonly ["english.hani.co.kr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Maeil Business Newspaper"; readonly baseUrls: readonly ["www.mk.co.kr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "MoneyToday"; readonly baseUrls: readonly ["www.mt.co.kr"]; readonly type: readonly ["digital-first", "business"]; }, { readonly company: "Seoul Shinmun"; readonly baseUrls: readonly ["www.seoul.co.kr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "OhmyNews"; readonly baseUrls: readonly ["www.ohmynews.com"]; readonly type: readonly ["digital-first"]; }, { readonly company: "News1 Korea"; readonly baseUrls: readonly ["www.news1.kr"]; readonly type: readonly ["news agency", "digital"]; }, { readonly company: "Asia Business Daily"; readonly baseUrls: readonly ["www.asiae.co.kr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Herald Business"; readonly baseUrls: readonly ["biz.heraldcorp.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "eDaily"; readonly baseUrls: readonly ["www.edaily.co.kr"]; readonly type: readonly ["digital-first", "business"]; }, { readonly company: "Seoul Economic Daily"; readonly baseUrls: readonly ["www.sedaily.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "JTBC News"; readonly baseUrls: readonly ["news.jtbc.co.kr"]; readonly type: readonly ["television", "digital"]; }]; declare const TURKISH_NEWS: readonly [{ readonly company: "Anadolu Agency (AA)"; readonly baseUrls: readonly ["www.aa.com.tr"]; readonly type: readonly ["news agency", "digital"]; }, { readonly company: "Hürriyet"; readonly baseUrls: readonly ["www.hurriyet.com.tr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Sabah"; readonly baseUrls: readonly ["www.sabah.com.tr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Milliyet"; readonly baseUrls: readonly ["www.milliyet.com.tr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "TRT World"; readonly baseUrls: readonly ["www.trtworld.com"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "CNN Türk"; readonly baseUrls: readonly ["www.cnnturk.com"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Sozcu"; readonly baseUrls: readonly ["www.sozcu.com.tr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Daily Sabah"; readonly baseUrls: readonly ["www.dailysabah.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Yeni Şafak"; readonly baseUrls: readonly ["www.yenisafak.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Habertürk"; readonly baseUrls: readonly ["www.haberturk.com"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "BirGün"; readonly baseUrls: readonly ["www.birgun.net"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Türkiye Gazetesi"; readonly baseUrls: readonly ["www.turkiyegazetesi.com.tr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Cumhuriyet"; readonly baseUrls: readonly ["www.cumhuriyet.com.tr"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Diken"; readonly baseUrls: readonly ["www.diken.com.tr"]; readonly type: readonly ["digital-first"]; }, { readonly company: "NTV"; readonly baseUrls: readonly ["www.ntv.com.tr"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Ensonhaber"; readonly baseUrls: readonly ["www.ensonhaber.com"]; readonly type: readonly ["digital-first"]; }, { readonly company: "T24"; readonly baseUrls: readonly ["www.t24.com.tr"]; readonly type: readonly ["digital-first"]; }, { readonly company: "Karar"; readonly baseUrls: readonly ["www.karar.com"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Gazete Duvar"; readonly baseUrls: readonly ["www.gazeteduvar.com.tr"]; readonly type: readonly ["digital-first"]; }, { readonly company: "Bloomberg HT"; readonly baseUrls: readonly ["www.bloomberght.com"]; readonly type: readonly ["television", "digital"]; }]; declare const NORWEGIAN_NEWS: readonly [{ readonly company: "Aftenposten"; readonly baseUrls: readonly ["www.aftenposten.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Verdens Gang (VG)"; readonly baseUrls: readonly ["www.vg.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Dagbladet"; readonly baseUrls: readonly ["www.dagbladet.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "NRK"; readonly baseUrls: readonly ["www.nrk.no"]; readonly type: readonly ["television", "radio", "digital"]; }, { readonly company: "Dagens Næringsliv"; readonly baseUrls: readonly ["www.dn.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Nettavisen"; readonly baseUrls: readonly ["www.nettavisen.no"]; readonly type: readonly ["digital-first"]; }, { readonly company: "Klassekampen"; readonly baseUrls: readonly ["www.klassekampen.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Morgenbladet"; readonly baseUrls: readonly ["www.morgenbladet.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "E24"; readonly baseUrls: readonly ["www.e24.no"]; readonly type: readonly ["digital-first", "business"]; }, { readonly company: "TV2"; readonly baseUrls: readonly ["www.tv2.no"]; readonly type: readonly ["television", "digital"]; }, { readonly company: "Bergens Tidende"; readonly baseUrls: readonly ["www.bt.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Adresseavisen"; readonly baseUrls: readonly ["www.adressa.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Stavanger Aftenblad"; readonly baseUrls: readonly ["www.aftenbladet.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Fædrelandsvennen"; readonly baseUrls: readonly ["www.fvn.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "ABC Nyheter"; readonly baseUrls: readonly ["www.abcnyheter.no"]; readonly type: readonly ["digital-first"]; }, { readonly company: "Romerikes Blad"; readonly baseUrls: readonly ["www.rb.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Sunnmørsposten"; readonly baseUrls: readonly ["www.smp.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Finansavisen"; readonly baseUrls: readonly ["www.finansavisen.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Nordlys"; readonly baseUrls: readonly ["www.nordlys.no"]; readonly type: readonly ["newspaper", "digital"]; }, { readonly company: "Hamar Arbeiderblad"; readonly baseUrls: readonly ["www.h-a.no"]; readonly type: readonly ["newspaper", "digital"]; }]; //#endregion //#region ../constants/src/NoDefaultValue.d.ts /** * A constant which indicates that a particular * type/property was not given a _default value_. */ declare const NO_DEFAULT_VALUE: Constant<"no-default-value", unknown>; /** * A unique symbol which indicates that a particular * type was not given a "default value". */ type NoDefaultValue = typeof NO_DEFAULT_VALUE; //#endregion //#region ../constants/src/NotApplicable.d.ts declare const NOT_APPLICABLE: unique symbol; /** * A unique symbol which indicates that a particular * type was "not applicable". */ type NotApplicable = [kind: "not-applicable", reason: Why, uniqueness: typeof NOT_APPLICABLE]; //#endregion //#region ../constants/src/NumericChar.d.ts /** * **NUMERIC_CHAR** * * A tuple containing all numeric characters. * * **Related:** `NumericChar` */ declare const NUMERIC_CHAR: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; declare const NON_ZERO_NUMERIC_CHAR: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]; /** * **HEXADECIMAL_CHAR** * * All numeric and alpha (upper and lower) characters used to represent * a **hexadecimal** number. */ declare const HEXADECIMAL_CHAR: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "A", "b", "B", "c", "C", "d", "D", "e", "E", "f", "F"]; //#endregion //#region ../constants/src/NumericDigit.d.ts /** * **NUMERIC_DIGIT** * * A tuple of all numeric digits. * * **Related:** `Digit` */ declare const NUMERIC_DIGIT: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; //#endregion //#region ../constants/src/Phone.d.ts declare const PHONE_FORMAT: readonly ["Dashed (e.g., 456-555-1212)", "Dotted (e.g., 456.555.1212)", "ParaSpaced (e.g., (456) 555 1212)", "ParaDashed (e.g., (456) 555-1212)"]; /** * **PHONE_COUNTRY_CODES** * * `[code, 3 letter country code, 2 letter country code]` */ declare const PHONE_COUNTRY_CODES: readonly [readonly ["886", "TWN", "TW"], readonly ["93", "AFG", "AF"], readonly ["355", "ALB", "AL"], readonly ["213", "DZA", "DZ"], readonly ["1-684", "ASM", "AS"], readonly ["376", "AND", "AD"], readonly ["244", "AGO", "AO"], readonly ["1-264", "AIA", "AI"], readonly ["672", "ATA", "AQ"], readonly ["1-268", "ATG", "AG"], readonly ["54", "ARG", "AR"], readonly ["374", "ARM", "AM"], readonly ["297", "ABW", "AW"], readonly ["61", "AUS", "AU"], readonly ["43", "AUT", "AT"], readonly ["994", "AZE", "AZ"], readonly ["1-242", "BHS", "BS"], readonly ["973", "BHR", "BH"], readonly ["880", "BGD", "BD"], readonly ["1-246", "BRB", "BB"], readonly ["375", "BLR", "BY"], readonly ["32", "BEL", "BE"], readonly ["501", "BLZ", "BZ"], readonly ["229", "BEN", "BJ"], readonly ["1-441", "BMU", "BM"], readonly ["975", "BTN", "BT"], readonly ["591", "BOL", "BO"], readonly ["599", "BES", "BQ"], readonly ["387", "BIH", "BA"], readonly ["267", "BWA", "BW"], readonly ["47", "BVT", "BV"], readonly ["55", "BRA", "BR"], readonly ["246", "IOT", "IO"], readonly ["1-284", "VGB", "VG"], readonly ["673", "BRN", "BN"], readonly ["359", "BGR", "BG"], readonly ["226", "BFA", "BF"], readonly ["257", "BDI", "BI"], readonly ["238", "CPV", "CV"], readonly ["855", "KHM", "KH"], readonly ["237", "CMR", "CM"], readonly ["1", "CAN", "CA"], readonly ["1-345", "CYM", "KY"], readonly ["236", "CAF", "CF"], readonly ["235", "TCD", "TD"], readonly ["56", "CHL", "CL"], readonly ["86", "CHN", "CN"], readonly ["852", "HKG", "HK"], readonly ["853", "MAC", "MO"], readonly ["61", "CXR", "CX"], readonly ["61", "CCK", "CC"], readonly ["57", "COL", "CO"], readonly ["269", "COM", "KM"], readonly ["242", "COG", "CG"], readonly ["682", "COK", "CK"], readonly ["506", "CRI", "CR"], readonly ["385", "HRV", "HR"], readonly ["53", "CUB", "CU"], readonly ["599", "CUW", "CW"], readonly ["357", "CYP", "CY"], readonly ["420", "CZE", "CZ"], readonly ["225", "CIV", "CI"], readonly ["850", "PRK", "KP"], readonly ["243", "COD", "CD"], readonly ["45", "DNK", "DK"], readonly ["253", "DJI", "DJ"], readonly ["1-767", "DMA", "DM"], readonly ["1-809", "DOM", "DO"], readonly ["1-829", "DOM", "DO"], readonly ["1-849", "DOM", "DO"], readonly ["593", "ECU", "EC"], readonly ["20", "EGY", "EG"], readonly ["503", "SLV", "SV"], readonly ["240", "GNQ", "GQ"], readonly ["291", "ERI", "ER"], readonly ["372", "EST", "EE"], readonly ["268", "SWZ", "SZ"], readonly ["251", "ETH", "ET"], readonly ["500", "FLK", "FK"], readonly ["298", "FRO", "FO"], readonly ["679", "FJI", "FJ"], readonly ["358", "FIN", "FI"], readonly ["33", "FRA", "FR"], readonly ["594", "GUF", "GF"], readonly ["689", "PYF", "PF"], readonly ["262", "ATF", "TF"], readonly ["241", "GAB", "GA"], readonly ["220", "GMB", "GM"], readonly ["995", "GEO", "GE"], readonly ["49", "DEU", "DE"], readonly ["233", "GHA", "GH"], readonly ["350", "GIB", "GI"], readonly ["30", "GRC", "GR"], readonly ["299", "GRL", "GL"], readonly ["1-473", "GRD", "GD"], readonly ["590", "GLP", "GP"], readonly ["1-671", "GUM", "GU"], readonly ["502", "GTM", "GT"], readonly ["44", "GGY", "GG"], readonly ["224", "GIN", "GN"], readonly ["245", "GNB", "GW"], readonly ["592", "GUY", "GY"], readonly ["509", "HTI", "HT"], readonly ["672", "HMD", "HM"], readonly ["39-06", "VAT", "VA"], readonly ["504", "HND", "HN"], readonly ["36", "HUN", "HU"], readonly ["354", "ISL", "IS"], readonly ["91", "IND", "IN"], readonly ["62", "IDN", "ID"], readonly ["98", "IRN", "IR"], readonly ["964", "IRQ", "IQ"], readonly ["353", "IRL", "IE"], readonly ["44", "IMN", "IM"], readonly ["972", "ISR", "IL"], readonly ["39", "ITA", "IT"], readonly ["1-876", "JAM", "JM"], readonly ["81", "JPN", "JP"], readonly ["44", "JEY", "JE"], readonly ["962", "JOR", "JO"], readonly ["7", "KAZ", "KZ"], readonly ["254", "KEN", "KE"], readonly ["686", "KIR", "KI"], readonly ["965", "KWT", "KW"], readonly ["996", "KGZ", "KG"], readonly ["856", "LAO", "LA"], readonly ["371", "LVA", "LV"], readonly ["961", "LBN", "LB"], readonly ["266", "LSO", "LS"], readonly ["231", "LBR", "LR"], readonly ["218", "LBY", "LY"], readonly ["423", "LIE", "LI"], readonly ["370", "LTU", "LT"], readonly ["352", "LUX", "LU"], readonly ["261", "MDG", "MG"], readonly ["265", "MWI", "MW"], readonly ["60", "MYS", "MY"], readonly ["960", "MDV", "MV"], readonly ["223", "MLI", "ML"], readonly ["356", "MLT", "MT"], readonly ["692", "MHL", "MH"], readonly ["596", "MTQ", "MQ"], readonly ["222", "MRT", "MR"], readonly ["230", "MUS", "MU"], readonly ["262", "MYT", "YT"], readonly ["52", "MEX", "MX"], readonly ["691", "FSM", "FM"], readonly ["377", "MCO", "MC"], readonly ["976", "MNG", "MN"], readonly ["382", "MNE", "ME"], readonly ["1-664", "MSR", "MS"], readonly ["212", "MAR", "MA"], readonly ["258", "MOZ", "MZ"], readonly ["95", "MMR", "MM"], readonly ["264", "NAM", "NA"], readonly ["674", "NRU", "NR"], readonly ["977", "NPL", "NP"], readonly ["31", "NLD", "NL"], readonly ["687", "NCL", "NC"], readonly ["64", "NZL", "NZ"], readonly ["505", "NIC", "NI"], readonly ["227", "NER", "NE"], readonly ["234", "NGA", "NG"], readonly ["683", "NIU", "NU"], readonly ["672", "NFK", "NF"], readonly ["1-670", "MNP", "MP"], readonly ["47", "NOR", "NO"], readonly ["968", "OMN", "OM"], readonly ["92", "PAK", "PK"], readonly ["680", "PLW", "PW"], readonly ["507", "PAN", "PA"], readonly ["675", "PNG", "PG"], readonly ["595", "PRY", "PY"], readonly ["51", "PER", "PE"], readonly ["63", "PHL", "PH"], readonly ["870", "PCN", "PN"], readonly ["48", "POL", "PL"], readonly ["351", "PRT", "PT"], readonly ["974", "QAT", "QA"], readonly ["82", "KOR", "KR"], readonly ["373", "MDA", "MD"], readonly ["40", "ROU", "RO"], readonly ["7", "RUS", "RU"], readonly ["250", "RWA", "RW"], readonly ["262", "REU", "RE"], readonly ["590", "BLM", "BL"], readonly ["290", "SHN", "SH"], readonly ["1-869", "KNA", "KN"], readonly ["1-758", "LCA", "LC"], readonly ["590", "MAF", "MF"], readonly ["508", "SPM", "PM"], readonly ["1-784", "VCT", "VC"], readonly ["685", "WSM", "WS"], readonly ["378", "SMR", "SM"], readonly ["239", "STP", "ST"], readonly ["966", "SAU", "SA"], readonly ["221", "SEN", "SN"], readonly ["381", "SRB", "RS"], readonly ["248", "SYC", "SC"], readonly ["232", "SLE", "SL"], readonly ["65", "SGP", "SG"], readonly ["1-721", "SXM", "SX"], readonly ["421", "SVK", "SK"], readonly ["386", "SVN", "SI"], readonly ["677", "SLB", "SB"], readonly ["252", "SOM", "SO"], readonly ["27", "ZAF", "ZA"], readonly ["500", "SGS", "GS"], readonly ["211", "SSD", "SS"], readonly ["34", "ESP", "ES"], readonly ["94", "LKA", "LK"], readonly ["970", "PSE", "PS"], readonly ["249", "SDN", "SD"], readonly ["597", "SUR", "SR"], readonly ["47", "SJM", "SJ"], readonly ["46", "SWE", "SE"], readonly ["41", "CHE", "CH"], readonly ["963", "SYR", "SY"], readonly ["992", "TJK", "TJ"], readonly ["66", "THA", "TH"], readonly ["389", "MKD", "MK"], readonly ["670", "TLS", "TL"], readonly ["228", "TGO", "TG"], readonly ["690", "TKL", "TK"], readonly ["676", "TON", "TO"], readonly ["1-868", "TTO", "TT"], readonly ["216", "TUN", "TN"], readonly ["90", "TUR", "TR"], readonly ["993", "TKM", "TM"], readonly ["1-649", "TCA", "TC"], readonly ["688", "TUV", "TV"], readonly ["256", "UGA", "UG"], readonly ["380", "UKR", "UA"], readonly ["971", "ARE", "AE"], readonly ["44", "GBR", "GB"], readonly ["255", "TZA", "TZ"], readonly ["1-340", "VIR", "VI"], readonly ["1", "USA", "US"], readonly ["598", "URY", "UY"], readonly ["998", "UZB", "UZ"], readonly ["678", "VUT", "VU"], readonly ["58", "VEN", "VE"], readonly ["84", "VNM", "VN"], readonly ["681", "WLF", "WF"], readonly ["212", "ESH", "EH"], readonly ["967", "YEM", "YE"], readonly ["260", "ZMB", "ZM"], readonly ["263", "ZWE", "ZW"], readonly ["358", "ALA", "AX"]]; //#endregion //#region ../constants/src/PluralExceptions.d.ts /** * **PLURAL_EXCEPTIONS** * * A lookup table that maps singular words to their _plural_ counterpart. */ declare const PLURAL_EXCEPTIONS: { readonly photo: "photos"; readonly piano: "pianos"; readonly halo: "halos"; readonly foot: "feet"; readonly man: "men"; readonly woman: "women"; readonly person: "people"; readonly mouse: "mice"; readonly series: "series"; readonly sheep: "sheep"; readonly money: "monies"; readonly deer: "deer"; readonly goose: "geese"; readonly child: "children"; readonly tooth: "teeth"; readonly ox: "oxen"; readonly basis: "bases"; readonly radius: "radii"; readonly syllabus: "syllabi"; readonly ice: "ice"; readonly fish: "fish"; readonly means: "means"; readonly phenomenon: "phenomena"; readonly criterion: "criteria"; readonly datum: "data"; readonly memorandum: "memoranda"; readonly bacterium: "bacteria"; readonly stratum: "strata"; readonly curriculum: "curricula"; readonly index: "indices"; readonly appendix: "appendices"; readonly vortex: "vortices"; readonly bison: "bison"; readonly axis: "axes"; readonly antenna: "antennas"; readonly cactus: "cacti"; readonly corpus: "corpora"; readonly beau: "beaux"; readonly die: "dice"; readonly ellipsis: "ellipses"; readonly erratum: "errata"; readonly focus: "foci"; readonly formula: "formulas"; readonly fungus: "fungi"; readonly genus: "genera"; readonly graffito: "graffiti"; readonly grouse: "grouses"; readonly half: "halves"; readonly hoof: "hooves"; readonly hypothesis: "hypothesis"; readonly larva: "larvae"; readonly libretto: "libretti"; readonly loaf: "loaves"; readonly locus: "loci"; readonly medium: "mediums"; readonly minutia: "minutiae"; readonly nucleus: "nuclei"; readonly oasis: "oases"; readonly opus: "opuses"; readonly ovum: "ova"; readonly parenthesis: "parentheses"; readonly phylum: "phyla"; readonly quiz: "quizzes"; readonly referendum: "referendums"; readonly self: "selves"; readonly species: "species"; readonly stimulus: "stimuli"; readonly swine: "swine"; readonly synopsis: "synopses"; readonly thesis: "theses"; readonly thief: "thieves"; readonly vertex: "vertexes"; readonly wife: "wives"; readonly wolf: "wolves"; }; //#endregion //#region ../constants/src/RepoConstants.d.ts /** * common sources for source code repositories */ declare const REPO_SOURCES: readonly ["github", "bitbucket", "gitlab", "codecommit", "local"]; /** * page types you'd expect to find in a source code repository. */ declare const REPO_PAGE_TYPES: readonly ["repo", "commits", "author", "org", "profile", "issues", "actions", "followers", "following", "docs", "unknown"]; declare const REPO_SOURCE_LOOKUP: { readonly github: readonly ["https://github.com", "https://github.io"]; readonly bitbucket: readonly ["https://bitbucket.org"]; readonly gitlab: readonly ["https://gitlab.com"]; readonly codecommit: readonly ["https://aws.amazon.com/codecommit/"]; readonly local: readonly []; }; declare const GITHUB_INSIGHT_CATEGORY_LOOKUP: { readonly pulse: "pulse"; readonly contributors: "graphs/contributors"; readonly community: "graphs/community"; readonly standards: "community"; readonly traffic: "graphs/traffic"; readonly commits: "graphs/commit-activity"; readonly code_frequency: "graphs/code-frequency"; readonly dependencies: "network/dependencies"; readonly dependents: "network/dependents"; readonly dependabot: "network/updates"; readonly network: "network"; readonly forks: "forks"; readonly people: "people"; }; //#endregion //#region ../constants/src/Retail.d.ts /** * Amazon's DNS entries (for retail business) */ declare const AMAZON_DNS: readonly ["www.amazon.com", "www.amazon.co.uk", "www.amazon.fr", "www.amazon.de", "www.amazon.it", "www.amazon.es"]; declare const WALMART_DNS: readonly ["www.walmart.com", "www.walmart.ca", "www.walmart.com.mx"]; declare const APPLE_DNS: readonly ["store.apple.com", "www.apple.com"]; declare const HOME_DEPOT_DNS: readonly ["www.homedepot.com", "www.homedepot.ca"]; declare const EBAY_DNS: readonly ["www.ebay.com", "www.ebay.co.uk", "www.ebay.fr", "www.ebay.de", "www.ebay.it"]; declare const TARGET_DNS: readonly ["www.target.com"]; declare const ETSY_DNS: readonly ["www.etsy.com"]; declare const COSTCO_DNS: readonly ["www.costco.com", "www.costco.co.uk", "www.costco.ca"]; declare const CHEWY_DNS: readonly ["www.chewy.com"]; declare const BEST_BUY_DNS: readonly ["www.bestbuy.com", "www.bestbuy.ca"]; declare const WAYFAIR_DNS: readonly ["www.wayfair.com", "www.wayfair.ca", "www.wayfair.co.uk"]; declare const NIKE_DNS: readonly ["www.nike.com"]; declare const MACYS_DNS: readonly ["www.macys.com"]; declare const LOWES_DNS: readonly ["www.lowes.com"]; declare const IKEA_DNS: readonly ["www.ikea.com"]; declare const DELL_DNS: readonly ["www.dell.com"]; /** DNS for H&M retailer */ declare const HM_DNS: readonly ["www2.hm.com"]; declare const ZARA_DNS: readonly ["www.zara.com"]; declare const KROGER_DNS: readonly ["www.kroger.com"]; declare const WALGREENS_DNS: readonly ["www.walgreens.com"]; declare const CVS_DNS: readonly ["www.cvs.com"]; declare const WHOLE_FOODS_DNS: readonly ["www.wholefoodsmarket.com", "www.wholefoodsmarket.co.uk"]; //#endregion //#region ../constants/src/SafeEncoding.d.ts declare const SAFE_ENCODING__QUOTES: { readonly "\"": "^"; readonly "'": "^"; readonly "`": "^"; }; declare const SAFE_ENCODING__WHITESPACE: { readonly " ": "^"; readonly "\t": "^"; readonly "\n": "^"; readonly "\r": "^"; }; declare const SAFE_ENCODING__BRACKETS: { readonly "[": "^"; readonly "]": "^"; readonly "(": "^"; readonly ")": "^"; readonly "{": "^"; readonly "}": "^"; }; //#endregion //#region ../constants/src/SimpleTokens.d.ts declare const SIMPLE_DICT_VALUES: readonly ["string", "number", "boolean", "unknown", "Opt", "Opt", "Opt", "Opt"]; declare const SIMPLE_SET_TYPES: readonly ["string", "number", "boolean", "unknown", "Opt", "Opt", "Opt", "Opt"]; declare const SIMPLE_SCALAR_TOKENS: readonly ["string", "number", `string(${string})`, `number(${number})` | `number(${number},${string})`, "boolean", "true", "false", "null", "undefined", "unknown", "any", "never"]; declare const SIMPLE_OPT_SCALAR_TOKENS: readonly ["Opt", "Opt", "Opt", "Opt", "Opt", "Opt", "Opt", "Opt", "Opt", `Opt` | `Opt`, `Opt"]; declare const SIMPLE_UNION_TOKENS: readonly [`union(${string})` | `union(${string},${string})`]; declare const SIMPLE_MAP_KEYS: readonly ["string", "number", "Dict", "Dict", "Dict", "Dict", "Dict", "Dict>", "Dict>", "Dict>"]; declare const SIMPLE_MAP_VALUES: readonly ["string", "number", "Dict", "Dict", "Dict", "Dict", "Dict", "Dict>", "Dict>", "Dict>", "boolean", "unknown", "undefined", "Dict", "Array", "Dict>", "Dict>", "Dict>", "Dict>"]; declare const SIMPLE_DICT_TOKENS: readonly ["Dict", "Dict", "Dict", "Dict", "Dict", "Dict>", "Dict>", "Dict>", "Dict>", `Dict<{${string}: string}>` | `Dict<{${string}: number}>` | `Dict<{${string}: boolean}>` | `Dict<{${string}: undefined}>` | `Dict<{${string}: true}>` | `Dict<{${string}: false}>` | `Dict<{${string}: unknown}>` | `Dict<{${string}: any}>` | `Dict<{${string}: null}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: string(${string})}>` | `Dict<{${string}: number(${number})}>` | `Dict<{${string}: number(${number},${string})}>` | `Dict<{${string}: never}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt}>` | `Dict<{${string}: Opt` | `Dict<{${string}: Opt`, `Dict<{${string}: string, ${string}: ${string}}` | `Dict<{${string}: number, ${string}: ${string}}` | `Dict<{${string}: boolean, ${string}: ${string}}` | `Dict<{${string}: undefined, ${string}: ${string}}` | `Dict<{${string}: true, ${string}: ${string}}` | `Dict<{${string}: false, ${string}: ${string}}` | `Dict<{${string}: unknown, ${string}: ${string}}` | `Dict<{${string}: any, ${string}: ${string}}` | `Dict<{${string}: null, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: string(${string}), ${string}: ${string}}` | `Dict<{${string}: number(${number}), ${string}: ${string}}` | `Dict<{${string}: number(${number},${string}), ${string}: ${string}}` | `Dict<{${string}: never, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt, ${string}: ${string}}` | `Dict<{${string}: Opt", `Array`, "Array", `Array` | `Array`, "Array", "Array", "Array", "Array", "Array"]; declare const SIMPLE_MAP_TOKENS: readonly ["Map", "Map" | "Map" | "Map" | "Map" | "Map" | "Map" | "Map>" | "Map>" | "Map>" | "Map>" | "Map>>" | "Map>>" | "Map>>" | "Map" | "Map>>" | "Map" | "Map" | "Map" | "Map" | "Map" | "Map" | "Map>" | "Map>" | "Map>" | "Map>" | "Map>>" | "Map>>" | "Map>>" | "Map" | "Map>>" | "Map" | "Map" | "Map" | "Map" | "Map" | "Map" | "Map>" | "Map>" | "Map>" | "Map>" | "Map>>" | "Map>>" | "Map>>" | "Map" | "Map>>" | "Map, string>" | "Map, number>" | "Map, boolean>" | "Map, undefined>" | "Map, unknown>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Array>" | "Map, Dict>>" | "Map, string>" | "Map, number>" | "Map, boolean>" | "Map, undefined>" | "Map, unknown>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Array>" | "Map, Dict>>" | "Map, string>" | "Map, number>" | "Map, boolean>" | "Map, undefined>" | "Map, unknown>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Array>" | "Map, Dict>>" | "Map, string>" | "Map, number>" | "Map, boolean>" | "Map, undefined>" | "Map, unknown>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Dict>>" | "Map, Array>" | "Map, Dict>>" | "Map>, string>" | "Map>, number>" | "Map>, boolean>" | "Map>, undefined>" | "Map>, unknown>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>>" | "Map>, Dict>>" | "Map>, Dict>>" | "Map>, Array>" | "Map>, Dict>>" | "Map>, string>" | "Map>, number>" | "Map>, boolean>" | "Map>, undefined>" | "Map>, unknown>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>>" | "Map>, Dict>>" | "Map>, Dict>>" | "Map>, Array>" | "Map>, Dict>>" | "Map>, string>" | "Map>, number>" | "Map>, boolean>" | "Map>, undefined>" | "Map>, unknown>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>" | "Map>, Dict>>" | "Map>, Dict>>" | "Map>, Dict>>" | "Map>, Array>" | "Map>, Dict>>", "WeakMap"]; declare const SIMPLE_SET_TOKENS: readonly ["Set", "Set" | "Set" | "Set" | "Set" | "Set>" | "Set>" | "Set>" | "Set>"]; //#endregion //#region ../constants/src/SingularNounEnding.d.ts /** * Singular nouns typically end in the characters represented by this array. * * **Related:** `SingularNounEnding` */ declare const SINGULAR_NOUN_ENDINGS: readonly ["s", "sh", "ch", "x", "z", "o"]; //#endregion //#region ../constants/src/Social.d.ts declare const SOCIAL_MEDIA: [{ readonly name: "Facebook"; readonly description: "Connect with friends, family, and communities worldwide on one of the largest social networks."; readonly baseUrls: ["https://www.facebook.com"]; readonly profileUrl: "https://www.facebook.com/:user_id"; readonly approximateUserSize: 3000000000; readonly tickerSymbol: "META"; }, { readonly name: "YouTube"; readonly description: "A platform for sharing and watching videos, connecting creators with audiences globally."; readonly baseUrls: ["https://www.youtube.com"]; readonly profileUrl: "https://www.youtube.com/user/:user_id"; readonly approximateUserSize: 2500000000; readonly tickerSymbol: "GOOGL"; }, { readonly name: "WhatsApp"; readonly description: "A secure messaging app for personal and business communication."; readonly baseUrls: ["https://www.whatsapp.com", "https://wa.me"]; readonly profileUrl: "https://wa.me/:user_id"; readonly approximateUserSize: 2000000000; readonly tickerSymbol: "META"; }, { readonly name: "Instagram"; readonly description: "Share photos and videos with friends and followers through posts, stories, and reels."; readonly baseUrls: ["https://www.instagram.com"]; readonly profileUrl: "https://www.instagram.com/:user_id"; readonly approximateUserSize: 2000000000; readonly tickerSymbol: "META"; }, { readonly name: "TikTok"; readonly description: "A short-form video platform known for its highly engaging content and viral trends."; readonly baseUrls: ["https://www.tiktok.com"]; readonly profileUrl: "https://www.tiktok.com/@:user_id"; readonly approximateUserSize: 1600000000; }, { readonly name: "WeChat"; readonly description: "China's popular messaging and lifestyle app, integrating social media and mobile payments."; readonly baseUrls: ["https://www.wechat.com"]; readonly profileUrl: "https://www.wechat.com/:user_id"; readonly approximateUserSize: 1300000000; }, { readonly name: "Facebook Messenger"; readonly description: "A messaging app used for personal and business interactions, seamlessly integrated with Facebook."; readonly baseUrls: ["https://www.messenger.com"]; readonly profileUrl: "https://www.messenger.com/t/:user_id"; readonly approximateUserSize: 1000000000; readonly tickerSymbol: "META"; }, { readonly name: "Telegram"; readonly description: "A messaging platform focused on privacy, with channels and group capabilities."; readonly baseUrls: ["https://www.telegram.org", "https://t.me"]; readonly profileUrl: "https://t.me/:user_id"; readonly approximateUserSize: 900000000; }, { readonly name: "Snapchat"; readonly description: "A multimedia app popular for its disappearing messages and creative filters."; readonly baseUrls: ["https://www.snapchat.com"]; readonly profileUrl: "https://www.snapchat.com/add/:user_id"; readonly approximateUserSize: 800000000; readonly tickerSymbol: "SNAP"; }, { readonly name: "Douyin"; readonly description: "The Chinese version of TikTok, with similar short-form video content tailored for China."; readonly baseUrls: ["https://www.douyin.com"]; readonly profileUrl: "https://www.douyin.com/user/:user_id"; readonly approximateUserSize: 750000000; }, { readonly name: "LinkedIn"; readonly description: "The largest professional networking platform, where users connect for career opportunities, insights, and business networking."; readonly baseUrls: ["https://www.linkedin.com"]; readonly profileUrl: "https://www.linkedin.com/in/:user_id"; readonly approximateUserSize: 930000000; readonly tickerSymbol: "MSFT"; }, { readonly name: "X (formerly Twitter)"; readonly description: "A platform for real-time updates, news sharing, and public discourse with a focus on brief, impactful posts."; readonly baseUrls: ["https://www.twitter.com", "https://x.com"]; readonly profileUrl: "https://twitter.com/:user_id"; readonly approximateUserSize: 540000000; }, { readonly name: "Pinterest"; readonly description: "A visually-driven platform for sharing ideas, DIY projects, fashion, and more."; readonly baseUrls: ["https://www.pinterest.com"]; readonly profileUrl: "https://www.pinterest.com/:user_id"; readonly approximateUserSize: 460000000; readonly tickerSymbol: "PINS"; }, { readonly name: "Reddit"; readonly description: "A community-driven platform organized into niche forums or 'subreddits' focused on various topics."; readonly baseUrls: ["https://www.reddit.com"]; readonly profileUrl: "https://www.reddit.com/user/:user_id"; readonly approximateUserSize: 430000000; }, { readonly name: "Clubhouse"; readonly description: "A voice-based social network where users engage in live audio conversations on various topics."; readonly baseUrls: ["https://www.clubhouse.com"]; readonly profileUrl: "https://www.clubhouse.com/:user_id"; readonly approximateUserSize: 10000000; }, { readonly name: "Discord"; readonly description: "Originally aimed at gamers, Discord is now widely used by various communities for group chat, video, and voice calls."; readonly baseUrls: ["https://www.discord.com", "https://discord.com"]; readonly profileUrl: "https://discord.com/users/:user_id"; readonly approximateUserSize: 300000000; }]; //#endregion //#region ../constants/src/Tailwind.d.ts declare const TW_HUE_NEUTRAL: { readonly slate: 262; readonly gray: 270; readonly zinc: 269; readonly neutral: 270; readonly stone: 273; }; declare const TW_HUE_VIBRANT: { readonly red: 24; readonly orange: 44; readonly amber: 79; readonly yellow: 100; readonly lime: 132; readonly green: 144; readonly emerald: 159; readonly teal: 182; readonly cyan: 192; readonly sky: 219; readonly blue: 240; readonly indigo: 268; readonly violet: 283; readonly purple: 294; readonly fuchsia: 319; readonly pink: 334; readonly rose: 15; }; /** * **TW_COLOR_HUE** * * The _hue_ values for [TailwindCSS](https://tailwindcss.com/docs/customizing-colors) * when moved into the **oklch** color space. */ declare const TW_HUE: { readonly black: 0; readonly white: 106.37411429114086; readonly red: 24; readonly orange: 44; readonly amber: 79; readonly yellow: 100; readonly lime: 132; readonly green: 144; readonly emerald: 159; readonly teal: 182; readonly cyan: 192; readonly sky: 219; readonly blue: 240; readonly indigo: 268; readonly violet: 283; readonly purple: 294; readonly fuchsia: 319; readonly pink: 334; readonly rose: 15; readonly slate: 262; readonly gray: 270; readonly zinc: 269; readonly neutral: 270; readonly stone: 273; }; declare const TW_LUMINOSITY: { readonly 50: 97.78; readonly 100: 93.56; readonly 200: 88.11; readonly 300: 82.67; readonly 400: 74.22; readonly 500: 64.78; readonly 600: 57.33; readonly 700: 46.89; readonly 800: 39.44; readonly 900: 32; readonly 950: 23.78; }; /** * **TW_CHROMA** * * The possible chroma values from Tailwind CSS when using * the **okhsl** color model. * * **Related:** `TW_CHROMA_50`, `TW_CHROMA_100`, ... */ declare const TW_CHROMA: { readonly 50: 0.0108; readonly 100: 0.0321; readonly 200: 0.0609; readonly 300: 0.0908; readonly 400: 0.1398; readonly 500: 0.1472; readonly 600: 0.1299; readonly 700: 0.1067; readonly 800: 0.0898; readonly 900: 0.0726; readonly 950: 0.054; }; /** * The list of "targets" where Tailwind color string references * can be applied to. These domains are prefixes to the color string * when used (e.g., `bg-green-500`) */ declare const TW_COLOR_TARGETS: readonly ["bg", "text", "border", "ring", "shadow", "border"]; declare const TW_MODIFIERS_CORE: readonly ["dark", "focus", "hover", "active", "visited", "disabled"]; declare const TW_MODIFIERS_ORDER: readonly ["first", "last", "odd", "even"]; declare const TW_MODIFIERS_RELN: readonly ["focus-within", "focus-visible", "checked", "peer-invalid", "peer-checked/{{string}}"]; /** * The list of page size prefixes which Tailwind provides for adjusting to * device size. These are the defaults and can be customized. */ declare const TW_MODIFIERS_SIZING: readonly ["sm", "md", "lg", "xl", "2xl"]; //#endregion //#region ../constants/src/Timezones.d.ts declare const IANA_TIMEZONES__AFRICA: readonly ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", "Africa/Bamako", "Africa/Bangui", "Africa/Banjul", "Africa/Bissau", "Africa/Blantyre", "Africa/Brazzaville", "Africa/Bujumbura", "Africa/Cairo", "Africa/Casablanca", "Africa/Ceuta", "Africa/Conakry", "Africa/Dakar", "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", "Africa/Freetown", "Africa/Gaborone", "Africa/Harare", "Africa/Johannesburg", "Africa/Juba", "Africa/Kampala", "Africa/Khartoum", "Africa/Kigali", "Africa/Kinshasa", "Africa/Lagos", "Africa/Libreville", "Africa/Lome", "Africa/Luanda", "Africa/Lubumbashi", "Africa/Lusaka", "Africa/Malabo", "Africa/Maputo", "Africa/Maseru", "Africa/Mbabane", "Africa/Mogadishu", "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", "Africa/Nouakchott", "Africa/Ouagadougou", "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek"]; declare const IANA_TIMEZONES__AMERICA: readonly ["America/Adak", "America/Anchorage", "America/Anguilla", "America/Antigua", "America/Araguaina", "America/Argentina/Buenos_Aires", "America/Argentina/Catamarca", "America/Argentina/Cordoba", "America/Argentina/Jujuy", "America/Argentina/La_Rioja", "America/Argentina/Mendoza", "America/Argentina/Rio_Gallegos", "America/Argentina/Salta", "America/Argentina/San_Juan", "America/Argentina/San_Luis", "America/Argentina/Tucuman", "America/Argentina/Ushuaia", "America/Aruba", "America/Asuncion", "America/Atikokan", "America/Atka", "America/Bahia", "America/Bahia_Banderas", "America/Barbados", "America/Belem", "America/Belize", "America/Blanc-Sablon", "America/Boa_Vista", "America/Bogota", "America/Boise", "America/Cambridge_Bay", "America/Campo_Grande", "America/Cancun", "America/Caracas", "America/Cayenne", "America/Cayman", "America/Chicago", "America/Chihuahua", "America/Creston", "America/Cuiaba", "America/Curacao", "America/Danmarkshavn", "America/Dawson", "America/Dawson_Creek", "America/Denver", "America/Detroit", "America/Dominica", "America/Edmonton", "America/Eirunepe", "America/El_Salvador", "America/Fort_Nelson", "America/Fortaleza", "America/Glace_Bay", "America/Godthab", "America/Goose_Bay", "America/Grand_Turk", "America/Grenada", "America/Guadeloupe", "America/Guatemala", "America/Guayaquil", "America/Guyana", "America/Halifax", "America/Havana", "America/Hermosillo", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Inuvik", "America/Iqaluit", "America/Jamaica", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Kralendijk", "America/La_Paz", "America/Lima", "America/Los_Angeles", "America/Lower_Princes", "America/Maceio", "America/Managua", "America/Manaus", "America/Marigot", "America/Martinique", "America/Matamoros", "America/Mazatlan", "America/Menominee", "America/Merida", "America/Metlakatla", "America/Mexico_City", "America/Miquelon", "America/Moncton", "America/Monterrey", "America/Montevideo", "America/Montserrat", "America/Nassau", "America/New_York", "America/Nipigon", "America/Nome", "America/Noronha", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Ojinaga", "America/Panama", "America/Pangnirtung", "America/Paramaribo", "America/Phoenix", "America/Port-au-Prince", "America/Port_of_Spain", "America/Porto_Velho", "America/Puerto_Rico", "America/Punta_Arenas", "America/Rainy_River", "America/Rankin_Inlet", "America/Recife", "America/Regina", "America/Resolute", "America/Rio_Branco", "America/Santarem", "America/Santiago", "America/Santo_Domingo", "America/Sao_Paulo", "America/Scoresbysund", "America/Sitka", "America/St_Barthelemy", "America/St_Johns", "America/St_Kitts", "America/St_Lucia", "America/St_Thomas", "America/St_Vincent", "America/Swift_Current", "America/Tegucigalpa", "America/Thule", "America/Thunder_Bay", "America/Tijuana", "America/Toronto", "America/Tortola", "America/Vancouver", "America/Whitehorse", "America/Winnipeg", "America/Yakutat", "America/Yellowknife"]; declare const IANA_TIMEZONES__ANTARCTICA: readonly ["Antarctica/Casey", "Antarctica/Davis", "Antarctica/DumontDUrville", "Antarctica/Macquarie", "Antarctica/Mawson", "Antarctica/McMurdo", "Antarctica/Palmer", "Antarctica/Rothera", "Antarctica/South_Pole", "Antarctica/Syowa", "Antarctica/Troll", "Antarctica/Vostok", "Arctic/Longyearbyen"]; declare const IANA_TIMEZONES__ASIA: readonly ["Asia/Almaty", "Asia/Amman", "Asia/Anadyr", "Asia/Aqtau", "Asia/Aqtobe", "Asia/Ashgabat", "Asia/Atyrau", "Asia/Baghdad", "Asia/Baku", "Asia/Bangkok", "Asia/Barnaul", "Asia/Beirut", "Asia/Bishkek", "Asia/Brunei", "Asia/Chita", "Asia/Choibalsan", "Asia/Colombo", "Asia/Damascus", "Asia/Dhaka", "Asia/Dili", "Asia/Dubai", "Asia/Dushanbe", "Asia/Famagusta", "Asia/Gaza", "Asia/Hebron", "Asia/Ho_Chi_Minh", "Asia/Hong_Kong", "Asia/Hovd", "Asia/Irkutsk", "Asia/Jakarta", "Asia/Jayapura", "Asia/Jerusalem", "Asia/Kabul", "Asia/Kamchatka", "Asia/Karachi", "Asia/Kathmandu", "Asia/Khandyga", "Asia/Kolkata", "Asia/Krasnoyarsk", "Asia/Kuala_Lumpur", "Asia/Kuching", "Asia/Kuwait", "Asia/Macau", "Asia/Magadan", "Asia/Makassar", "Asia/Manila", "Asia/Muscat", "Asia/Nicosia", "Asia/Novokuznetsk", "Asia/Novosibirsk", "Asia/Omsk", "Asia/Oral", "Asia/Phnom_Penh", "Asia/Pontianak", "Asia/Pyongyang", "Asia/Qatar", "Asia/Qostanay", "Asia/Qyzylorda", "Asia/Riyadh", "Asia/Sakhalin", "Asia/Samarkand", "Asia/Seoul", "Asia/Shanghai", "Asia/Singapore", "Asia/Srednekolymsk", "Asia/Taipei", "Asia/Tashkent", "Asia/Tbilisi", "Asia/Tehran", "Asia/Thimphu", "Asia/Tokyo", "Asia/Tomsk", "Asia/Ulaanbaatar", "Asia/Urumqi", "Asia/Ust-Nera", "Asia/Vientiane", "Asia/Vladivostok", "Asia/Yakutsk", "Asia/Yangon", "Asia/Yekaterinburg", "Asia/Yerevan"]; declare const IANA_TIMEZONES__EUROPE: readonly ["Europe/Amsterdam", "Europe/Andorra", "Europe/Astrakhan", "Europe/Athens", "Europe/Belgrade", "Europe/Berlin", "Europe/Brussels", "Europe/Bucharest", "Europe/Budapest", "Europe/Chisinau", "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", "Europe/Helsinki", "Europe/Isle_of_Man", "Europe/Istanbul", "Europe/Jersey", "Europe/Kaliningrad", "Europe/Kiev", "Europe/Kirov", "Europe/Lisbon", "Europe/Ljubljana", "Europe/London", "Europe/Luxembourg", "Europe/Madrid", "Europe/Malta", "Europe/Mariehamn", "Europe/Minsk", "Europe/Monaco", "Europe/Moscow", "Europe/Oslo", "Europe/Paris", "Europe/Podgorica", "Europe/Prague", "Europe/Riga", "Europe/Rome", "Europe/Samara", "Europe/San_Marino", "Europe/Sarajevo", "Europe/Simferopol", "Europe/Skopje", "Europe/Sofia", "Europe/Stockholm", "Europe/Tallinn", "Europe/Tirane", "Europe/Ulyanovsk", "Europe/Uzhgorod", "Europe/Vaduz", "Europe/Vatican", "Europe/Vienna", "Europe/Vilnius", "Europe/Volgograd", "Europe/Warsaw", "Europe/Zagreb", "Europe/Zaporozhye", "Europe/Zurich"]; declare const IANA_TIMEZONES__PACIFIC: readonly ["Pacific/Apia", "Pacific/Auckland", "Pacific/Bougainville", "Pacific/Chatham", "Pacific/Chuuk", "Pacific/Easter", "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", "Pacific/Funafuti", "Pacific/Galapagos", "Pacific/Gambier", "Pacific/Guadalcanal", "Pacific/Guam", "Pacific/Honolulu", "Pacific/Kiritimati", "Pacific/Kosrae", "Pacific/Kwajalein", "Pacific/Majuro", "Pacific/Marquesas", "Pacific/Midway", "Pacific/Nauru", "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Pago_Pago", "Pacific/Palau", "Pacific/Pitcairn", "Pacific/Pohnpei", "Pacific/Port_Moresby", "Pacific/Rarotonga", "Pacific/Saipan", "Pacific/Tahiti", "Pacific/Tarawa", "Pacific/Tongatapu", "Pacific/Wake", "Pacific/Wallis"]; declare const IANA_TIMEZONES: readonly ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", "Africa/Bamako", "Africa/Bangui", "Africa/Banjul", "Africa/Bissau", "Africa/Blantyre", "Africa/Brazzaville", "Africa/Bujumbura", "Africa/Cairo", "Africa/Casablanca", "Africa/Ceuta", "Africa/Conakry", "Africa/Dakar", "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", "Africa/Freetown", "Africa/Gaborone", "Africa/Harare", "Africa/Johannesburg", "Africa/Juba", "Africa/Kampala", "Africa/Khartoum", "Africa/Kigali", "Africa/Kinshasa", "Africa/Lagos", "Africa/Libreville", "Africa/Lome", "Africa/Luanda", "Africa/Lubumbashi", "Africa/Lusaka", "Africa/Malabo", "Africa/Maputo", "Africa/Maseru", "Africa/Mbabane", "Africa/Mogadishu", "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", "Africa/Nouakchott", "Africa/Ouagadougou", "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek", "America/Adak", "America/Anchorage", "America/Anguilla", "America/Antigua", "America/Araguaina", "America/Argentina/Buenos_Aires", "America/Argentina/Catamarca", "America/Argentina/Cordoba", "America/Argentina/Jujuy", "America/Argentina/La_Rioja", "America/Argentina/Mendoza", "America/Argentina/Rio_Gallegos", "America/Argentina/Salta", "America/Argentina/San_Juan", "America/Argentina/San_Luis", "America/Argentina/Tucuman", "America/Argentina/Ushuaia", "America/Aruba", "America/Asuncion", "America/Atikokan", "America/Atka", "America/Bahia", "America/Bahia_Banderas", "America/Barbados", "America/Belem", "America/Belize", "America/Blanc-Sablon", "America/Boa_Vista", "America/Bogota", "America/Boise", "America/Cambridge_Bay", "America/Campo_Grande", "America/Cancun", "America/Caracas", "America/Cayenne", "America/Cayman", "America/Chicago", "America/Chihuahua", "America/Creston", "America/Cuiaba", "America/Curacao", "America/Danmarkshavn", "America/Dawson", "America/Dawson_Creek", "America/Denver", "America/Detroit", "America/Dominica", "America/Edmonton", "America/Eirunepe", "America/El_Salvador", "America/Fort_Nelson", "America/Fortaleza", "America/Glace_Bay", "America/Godthab", "America/Goose_Bay", "America/Grand_Turk", "America/Grenada", "America/Guadeloupe", "America/Guatemala", "America/Guayaquil", "America/Guyana", "America/Halifax", "America/Havana", "America/Hermosillo", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Inuvik", "America/Iqaluit", "America/Jamaica", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Kralendijk", "America/La_Paz", "America/Lima", "America/Los_Angeles", "America/Lower_Princes", "America/Maceio", "America/Managua", "America/Manaus", "America/Marigot", "America/Martinique", "America/Matamoros", "America/Mazatlan", "America/Menominee", "America/Merida", "America/Metlakatla", "America/Mexico_City", "America/Miquelon", "America/Moncton", "America/Monterrey", "America/Montevideo", "America/Montserrat", "America/Nassau", "America/New_York", "America/Nipigon", "America/Nome", "America/Noronha", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Ojinaga", "America/Panama", "America/Pangnirtung", "America/Paramaribo", "America/Phoenix", "America/Port-au-Prince", "America/Port_of_Spain", "America/Porto_Velho", "America/Puerto_Rico", "America/Punta_Arenas", "America/Rainy_River", "America/Rankin_Inlet", "America/Recife", "America/Regina", "America/Resolute", "America/Rio_Branco", "America/Santarem", "America/Santiago", "America/Santo_Domingo", "America/Sao_Paulo", "America/Scoresbysund", "America/Sitka", "America/St_Barthelemy", "America/St_Johns", "America/St_Kitts", "America/St_Lucia", "America/St_Thomas", "America/St_Vincent", "America/Swift_Current", "America/Tegucigalpa", "America/Thule", "America/Thunder_Bay", "America/Tijuana", "America/Toronto", "America/Tortola", "America/Vancouver", "America/Whitehorse", "America/Winnipeg", "America/Yakutat", "America/Yellowknife", "Antarctica/Casey", "Antarctica/Davis", "Antarctica/DumontDUrville", "Antarctica/Macquarie", "Antarctica/Mawson", "Antarctica/McMurdo", "Antarctica/Palmer", "Antarctica/Rothera", "Antarctica/South_Pole", "Antarctica/Syowa", "Antarctica/Troll", "Antarctica/Vostok", "Arctic/Longyearbyen", "Asia/Almaty", "Asia/Amman", "Asia/Anadyr", "Asia/Aqtau", "Asia/Aqtobe", "Asia/Ashgabat", "Asia/Atyrau", "Asia/Baghdad", "Asia/Baku", "Asia/Bangkok", "Asia/Barnaul", "Asia/Beirut", "Asia/Bishkek", "Asia/Brunei", "Asia/Chita", "Asia/Choibalsan", "Asia/Colombo", "Asia/Damascus", "Asia/Dhaka", "Asia/Dili", "Asia/Dubai", "Asia/Dushanbe", "Asia/Famagusta", "Asia/Gaza", "Asia/Hebron", "Asia/Ho_Chi_Minh", "Asia/Hong_Kong", "Asia/Hovd", "Asia/Irkutsk", "Asia/Jakarta", "Asia/Jayapura", "Asia/Jerusalem", "Asia/Kabul", "Asia/Kamchatka", "Asia/Karachi", "Asia/Kathmandu", "Asia/Khandyga", "Asia/Kolkata", "Asia/Krasnoyarsk", "Asia/Kuala_Lumpur", "Asia/Kuching", "Asia/Kuwait", "Asia/Macau", "Asia/Magadan", "Asia/Makassar", "Asia/Manila", "Asia/Muscat", "Asia/Nicosia", "Asia/Novokuznetsk", "Asia/Novosibirsk", "Asia/Omsk", "Asia/Oral", "Asia/Phnom_Penh", "Asia/Pontianak", "Asia/Pyongyang", "Asia/Qatar", "Asia/Qostanay", "Asia/Qyzylorda", "Asia/Riyadh", "Asia/Sakhalin", "Asia/Samarkand", "Asia/Seoul", "Asia/Shanghai", "Asia/Singapore", "Asia/Srednekolymsk", "Asia/Taipei", "Asia/Tashkent", "Asia/Tbilisi", "Asia/Tehran", "Asia/Thimphu", "Asia/Tokyo", "Asia/Tomsk", "Asia/Ulaanbaatar", "Asia/Urumqi", "Asia/Ust-Nera", "Asia/Vientiane", "Asia/Vladivostok", "Asia/Yakutsk", "Asia/Yangon", "Asia/Yekaterinburg", "Asia/Yerevan", "Atlantic/Azores", "Atlantic/Bermuda", "Atlantic/Canary", "Atlantic/Cape_Verde", "Atlantic/Faroe", "Atlantic/Madeira", "Atlantic/Reykjavik", "Atlantic/South_Georgia", "Atlantic/St_Helena", "Atlantic/Stanley", "Australia/Adelaide", "Australia/Brisbane", "Australia/Broken_Hill", "Australia/Currie", "Australia/Darwin", "Australia/Eucla", "Australia/Hobart", "Australia/Lindeman", "Australia/Lord_Howe", "Australia/Melbourne", "Australia/Perth", "Australia/Sydney", "Europe/Amsterdam", "Europe/Andorra", "Europe/Astrakhan", "Europe/Athens", "Europe/Belgrade", "Europe/Berlin", "Europe/Brussels", "Europe/Bucharest", "Europe/Budapest", "Europe/Chisinau", "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", "Europe/Helsinki", "Europe/Isle_of_Man", "Europe/Istanbul", "Europe/Jersey", "Europe/Kaliningrad", "Europe/Kiev", "Europe/Kirov", "Europe/Lisbon", "Europe/Ljubljana", "Europe/London", "Europe/Luxembourg", "Europe/Madrid", "Europe/Malta", "Europe/Mariehamn", "Europe/Minsk", "Europe/Monaco", "Europe/Moscow", "Europe/Oslo", "Europe/Paris", "Europe/Podgorica", "Europe/Prague", "Europe/Riga", "Europe/Rome", "Europe/Samara", "Europe/San_Marino", "Europe/Sarajevo", "Europe/Simferopol", "Europe/Skopje", "Europe/Sofia", "Europe/Stockholm", "Europe/Tallinn", "Europe/Tirane", "Europe/Ulyanovsk", "Europe/Uzhgorod", "Europe/Vaduz", "Europe/Vatican", "Europe/Vienna", "Europe/Vilnius", "Europe/Volgograd", "Europe/Warsaw", "Europe/Zagreb", "Europe/Zaporozhye", "Europe/Zurich", "Indian/Antananarivo", "Indian/Chagos", "Indian/Christmas", "Indian/Cocos", "Indian/Comoro", "Indian/Kerguelen", "Indian/Mahe", "Indian/Maldives", "Indian/Mauritius", "Indian/Mayotte", "Indian/Reunion", "UTC", "Zulu", "Pacific/Apia", "Pacific/Auckland", "Pacific/Bougainville", "Pacific/Chatham", "Pacific/Chuuk", "Pacific/Easter", "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", "Pacific/Funafuti", "Pacific/Galapagos", "Pacific/Gambier", "Pacific/Guadalcanal", "Pacific/Guam", "Pacific/Honolulu", "Pacific/Kiritimati", "Pacific/Kosrae", "Pacific/Kwajalein", "Pacific/Majuro", "Pacific/Marquesas", "Pacific/Midway", "Pacific/Nauru", "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Pago_Pago", "Pacific/Palau", "Pacific/Pitcairn", "Pacific/Pohnpei", "Pacific/Port_Moresby", "Pacific/Rarotonga", "Pacific/Saipan", "Pacific/Tahiti", "Pacific/Tarawa", "Pacific/Tongatapu", "Pacific/Wake", "Pacific/Wallis"]; //#endregion //#region ../constants/src/TypeOf.d.ts /** * **TYPE_OF** * * The set of values which are possible results of the `typeof` command in Javascript. */ declare const TYPE_OF: readonly ["string", "number", "boolean", "undefined", "symbol", "bigint", "function", "object"]; //#endregion //#region ../constants/src/Types.d.ts declare const FALSY_TYPE_KINDS: readonly ["undefined", "null"]; declare const LITERAL_TYPE_KINDS: readonly ["true", "false", "stringLiteral", "numericLiteral"]; declare const WIDE_TYPE_KINDS: readonly ["string", "number", "boolean"]; declare const NARROW_CONTAINER_TYPE_KINDS: readonly ["object", "explicitFunctions", "fnType", "fnWithDict", "tuple", "union", "intersection", "arrayOf"]; declare const WIDE_CONTAINER_TYPE_KINDS: readonly ["anyArray", "anyObject", "unknownObject", "anyFunction", "emptyObject"]; //#endregion //#region ../constants/src/TypeTokens.d.ts /** * **Type Tokens** which have zero configuration elements. */ declare const TT_ATOMICS: readonly ["undefined", "null", "boolean", "true", "false"]; /** * **Type Tokens** which have a literal variant which represents * the _single_ configuration of this type which is available. */ declare const TT_SINGLETONS: readonly ["string", "number"]; declare const TT_SETS: readonly ["string-set", "numeric-set", "fn-set", "union-set"]; /** * **Type Tokens** which represent _functions_ (either the typical * variety or Generator functions). */ declare const TT_FUNCTIONS: readonly ["fn", "gen"]; /** * **Type Tokens** which _contain_ other **Type Tokens** to make up their * identity. */ declare const TT_CONTAINERS: readonly ["rec", "arr", "set", "map", "union", "obj", "tuple"]; declare const TT_START: "<<"; declare const TT_STOP: ">>"; declare const TT_DELIMITER: "::"; //#endregion //#region ../constants/src/TypeTokenVariants.d.ts declare const TYPE_TOKEN_REC_VARIANTS: readonly ["object-key", "string-key"]; declare const TYPE_TOKEN_REC_KEY_VARIANTS: readonly ["unknown", "any", "string", "number", "boolean", "truthy", "numberlike", "scalar", "object", "string|undefined", "number|undefined", "boolean|undefined", "object|undefined", "unknown[]", "any[]", "string[]", "number[]", "boolean[]"]; declare const TYPE_TOKEN_STRING_SET_VARIANTS: readonly ["endsWith::${string}", "startsWith::${string}", "contains::${string}", "civilianTime", "militaryTime", "ipv4Address", "ipv4Address::tight", "ipv4Address::loose", "ipv6Address", "ipv6Address::${string}", "numericString", "zipCode5", "zipCode5+4", "countryCode2", "countryCode3", "countryName", "capitalized", "url", "url::${string}", "isoDate", "isoDateTime", "usStateAbbrev", "usCitySuggestions", "metricCategory", "metric", "metric::${Metric}"]; declare const TYPE_TOKEN_UNION_SET_VARIANTS: string[]; //#endregion //#region src/api/http.d.ts /** * A union of all of MIME types. * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types */ type MimeTypes = typeof MIME_TYPES[number]; /** * A collection of common HTTP headers and their most common values. * Any header not listed in this mapped type will fall back to * the string type through the Record intersection. */ type HttpHeaders = { "Authorization"?: Suggest<"Bearer adfasdfasdfasfd">; /** * The "Accept" request HTTP header advertises which content types, * expressed as MIME types, the client is able to understand. * * @example "application/json" */ "Accept"?: Suggest<["application/json", "text/html", "text/plain", "text/xml", "application/xml", "image/jpeg", "image/avif", "image/png", "image/gif", "image/svg+xml", "multipart/form-data"]>; /** * The "Accept-Encoding" request HTTP header advertises which content * encoding and compression mechanisms the client is able to understand. * * @example "gzip" */ "Accept-Encoding"?: Suggest<["gzip", "compress", "deflate", "br"]>; /** * The "Accept-Language" request HTTP header advertises which languages * the client is able to understand. * * @example "en" */ "Accept-Language"?: Suggest<["en", "es", "fr", "de"]>; /** * The "Connection" header allows the sender to specify options that * are desired for that particular connection. * * @example "keep-alive" */ "Connection"?: Suggest<["keep-alive", "close"]>; /** * The "Content-Type" entity header is used to indicate the media type * of the resource. * * @example "application/json" */ "Content-Type"?: Suggest<["application/json", "text/html", "text/plain", "text/csv", "text/tsv", "application/csv", "text/markdown", "application/xml", "application/pdf", "video/mp4", "video/mpeg", "video/webm", "image/jpeg", "image/png", "image/gif", "image/svg+xml"]>; /** * The "Content-Encoding" entity header is used to compress the media-type. * When present, its value indicates what additional content encodings * have been applied to the entity body. * * @example "gzip" */ "Content-Encoding"?: Suggest<["gzip", "compress", "deflate", "br", "identity"]>; /** * The "Cache-Control" header holds directives (instructions) for caching * in both requests and responses. * * @example "no-cache" */ "Cache-Control"?: Suggest<["no-cache", "no-store", "max-age", "must-revalidate"]>; /** * The "Pragma" HTTP/1.0 general header is an implementation-specific * header that may have various effects along the request-response chain. * * @example "no-cache" */ "Pragma"?: Suggest<["no-cache"]>; /** * The "Transfer-Encoding" header specifies the form of encoding used * to safely transfer the payload body to the user. * * @example "chunked" */ "Transfer-Encoding"?: Suggest<["chunked", "compress", "deflate", "gzip"]>; } & Record; type HttpHeadingKeys = Suggest>; /** * A singular key/value representing a HTTP Header key/value. */ type HttpHeader = [heading: Suggest, value: Suggest]; /** * **HttpVerb** * * The available HTTP _verbs_. */ type HttpVerb = "GET" | "PUT" | "POST" | "PATCH" | "HEAD" | "CONNECT" | "OPTIONS" | "UPDATE" | "DELETE"; /** * HTTP verbs which _have_ -- or at least _can have_ -- a `body` property */ type HttpVerbsWithBody = "POST" | "PUT" | "DELETE" | "UPDATE"; /** * HTTP verbs which do **not** have a `body` property */ type HttpVerbsWithoutBody = Exclude; //#endregion //#region src/api/ObjectToApi.d.ts type Convert$13 = [] extends TKeys ? ExpandDictionary : Convert$13, TObj, TResult & Record, ]>() => T>>; /** * **ObjectToApi**`` * * Converts any object `TObj` to an object with: * * - the _same_ keys plus a done() function * - all the values of `T` -- which are not functions already -- * will be made into a function returning the value. * - the `TDef` property is the value _type_ to return; * use utilities like `shape()`, `union()` etc. to define */ type ObjectToApi = Keys$1 extends readonly (ObjectKey & keyof TObj)[] ? Convert$13, TObj, { __kind: "ObjectApi"; done: () => TDef; }> : never; /** * A callback signature for an object converted via `ObjectToApi` */ type ObjectApiCallback = ((api: ObjectToApi) => unknown); //#endregion //#region src/api/Rest.d.ts type RestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; //#endregion //#region src/api/SerializedData.d.ts type IsBinaryFormat = T extends string ? Or<[And<[StartsWith, Not>]>, Extends]> extends true ? true : false : false; type SerializedData, TData> = IsBinaryFormat extends true ? (string | Blob | ArrayBuffer) & { kind: "SerializedData"; format: TAs; data: TData; } : TAs extends "unknown/unknown" ? (string & { kind: "SerializedData"; data: TData; }) : (string & { kind: "SerializedData"; format: TAs; data: TData; }); //#endregion //#region src/assertions/AssertAssertionError.d.ts type Mapper$2 = As<{ any: AssertionError<`invalid-test/any-type`, `While testing for an Error condition, we instead got the 'any' type!`, { test: never; expected: Error; type: TType; subType: TSubType; op: "isError"; }>; unknown: AssertionError<`failed/isError`, `The test value MIGHT be an Error but currently the type is set as 'unknown' which masks whether at runtime this value would be an error.`, { test: never; expected: Error; type: TType; subType: TSubType; op: "isError"; }>; never: AssertionError<`failed/isError`, `The test value was 'never', not an error!`, { test: never; expected: Error; type: TType; subType: TSubType; op: "isError"; }>; }, AssertionMapper>; /** * **AssertAssertionError**`` * * Tests whether `TTest` is an `AssertionError`. * * - optionally also tests that the error `type` or `subType` is correct */ type AssertAssertionError = AssertValidation, Error> extends Error ? AssertValidation, Error> : TTest extends AssertionError ? TType extends string ? TSubType extends string ? TTest extends { classification: `${TType}/${TSubType}`; } ? true : false : TTest extends { classification: `${TType}/${string}`; } ? true : false : true : false; //#endregion //#region src/assertions/AssertContains.d.ts type Mapper$1 = As<{ any: AssertionError<`invalid-test/any-type`, `While testing for containment, we instead got the 'any' type!`, { test: never; expected: never; op: "contains"; }>; unknown: AssertionError<`failed/contains`, `The test value is 'unknown', which masks whether the value contains the expected element.`, { test: never; expected: never; op: "contains"; }>; never: AssertionError<`failed/contains`, `The test value was 'never', which cannot contain anything!`, { test: never; expected: never; op: "contains"; }>; }, AssertionMapper>; /** * **AssertContains** * * Tests whether a string, number, or array type in `TTest` _contains_ `TExpected` */ type AssertContains = AssertValidation extends { kind: "AssertionError"; } ? AssertValidation : [TTest] extends [string] ? Contains : [TTest] extends [number] ? Contains : [TTest] extends [readonly unknown[]] ? Contains : false; //#endregion //#region src/assertions/AssertEquals.d.ts /** * **AssertEqual**`` * * Type test assertion that `TTest` _equals_ `TExpected`. */ type AssertEqual = AssertValidation extends AssertionError ? AssertValidation : IsEqual; /** * **AssertEquals**`` * * Type test assertion that `TTest` _equals_ `TExpected`. * * **Note:** _alias to `AssertEqual`_ */ type AssertEquals = AssertEqual; //#endregion //#region src/assertions/AssertError.d.ts type Mapper = As<{ any: AssertionError<`invalid-test/any-type`, `While testing for an Error condition, we instead got the 'any' type!`, { test: never; expected: Error; type: TType; subType: TSubType; op: "isError"; }>; unknown: AssertionError<`failed/isError`, `The test value MIGHT be an Error but currently the type is set as 'unknown' which masks whether at runtime this value would be an error.`, { test: never; expected: Error; type: TType; subType: TSubType; op: "isError"; }>; never: AssertionError<`failed/isError`, `The test value was 'never', not an error!`, { test: never; expected: Error; type: TType; subType: TSubType; op: "isError"; }>; }, AssertionMapper>; /** * **AssertError**`` * * Tests whether `TTest` is an Error. * * - optionally also tests that the error `type` or `subType` is correct * - if `TType` contains a `/`, it will be split into type and subtype automatically */ type AssertError = TType extends `${infer Type}/${infer SubType}` ? TSubType extends string ? never : AssertValidation, Error> extends { kind: "AssertionError"; } ? AssertValidation, Error> : TTest extends Error ? And<[TTest extends { type: any; } ? [TTest["type"]] extends [Type] ? [Type] extends [TTest["type"]] ? true : false : false : false, TTest extends { subType: any; } ? [TTest["subType"]] extends [SubType] ? [SubType] extends [TTest["subType"]] ? true : false : false : false]> : false : AssertValidation, Error> extends { kind: "AssertionError"; } ? AssertValidation, Error> : TTest extends Error ? TType extends string ? TSubType extends string ? And<[TTest extends { type: any; } ? [TTest["type"]] extends [TType] ? [TType] extends [TTest["type"]] ? true : false : false : false, TTest extends { subType: any; } ? [TTest["subType"]] extends [TSubType] ? [TSubType] extends [TTest["subType"]] ? true : false : false : false]> : TTest extends { type: any; } ? [TTest["type"]] extends [TType] ? [TType] extends [TTest["type"]] ? true : false : false : false : true : false; //#endregion //#region src/assertions/AssertExtends.d.ts /** * **AssertExtends**`` * * Type test assertion that `TTest` _extends_ the type of `TBase`. */ type AssertExtends = AssertValidation extends Error ? AssertValidation : Extends; //#endregion //#region src/assertions/AssertFalse.d.ts /** * **AssertFalse**`` * * Type test assertion that `TTest` is `false`. */ type AssertFalse = AssertValidation extends Error ? AssertValidation : IsEqual; //#endregion //#region src/assertions/AssertionOp.d.ts /** * **AssertionOp** * * Comparison operation used in a given type test assertion. */ type AssertionOp = "equals" | "extends" | "hasSameKeys" | "hasSameValues" | "isError" | "contains" | "containsAll" | "doesNotExtend" | "doesNotEqual"; //#endregion //#region src/assertions/AssertNotEqual.d.ts /** * **AssertNotEqual**`` * * Type test assertion that `TTest` _does not equal_ `TExpected`. */ type AssertNotEqual = AssertValidation extends Error ? AssertValidation : Not>; //#endregion //#region src/assertions/AssertSameValues.d.ts /** * **AssertSameValues**`` * * Type test assertion that `TTest` is `false`. */ type AssertSameValues = AssertValidation extends Error ? AssertValidation : HasSameValues; //#endregion //#region src/assertions/AssertTrue.d.ts /** * **AssertTrue**`` * * Type test assertion that `TTest` is `true`. */ type AssertTrue = AssertValidation extends Error ? AssertValidation : IsEqual; //#endregion //#region src/assertions/AssertValidation.d.ts interface AssertionMapper { any: boolean | AssertionError; unknown: boolean | AssertionError; never: boolean | AssertionError; } type AssertValidation = TOp extends AssertionOp ? [IsAny] extends [true] ? AssertionError<`invalid-test/any-type`, `The test value passed in was of type 'any'! This is not allowed.`, { test: TTest; expected: TExpected; assertion: TOp; }> : [IsAny] extends [true] ? AssertionError<`invalid-test/any-type`, `The expected type passed into this test was 'any'! This is not allowed.`, { test: TTest; expected: TExpected; assertion: TOp; }> : undefined : TOp extends AssertionMapper ? [IsNever] extends [true] ? TOp["never"] : [IsAny] extends [true] ? TOp["any"] : [IsUnknown] extends [true] ? TOp["unknown"] : [IsAny] extends [true] ? AssertionError<`invalid-test/any-type`, `The expected type passed into this test was 'any'! This is not allowed.`, { test: TTest; expected: TExpected; assertion: TOp; }> : undefined : never; //#endregion //#region src/assertions/Expect.d.ts /** * **Expect**`` * * A type testing assertion which is expected to evaluate to `true`. * * - often used with the `Test` type utility (also from **inferred-types** * library) * - use with `Test` is preferred as it eliminates silent errors such when * tests evaluate to `never` or `any` and provides a meaningful error report * - but any assertion which is expected to result in `true` is a valid test * here */ type Expect = T; //#endregion //#region src/assertions/Test.d.ts /** ensure the expected type for error checking is valid */ type IsValidExpectedError = T extends Error | null | true | undefined | string ? true : false; type ExpectedErr = Err extends infer E extends { type: string; subType?: string | undefined; } ? E : never; /** * hands validation for Errors which are being checked for type/subtype */ type ValidateErrorType = TTest extends Error ? TExpected extends `${infer Type}/${infer Subtype}` ? "type" extends keyof TTest ? "subType" extends keyof TTest ? And<[TTest["type"] extends ExpectedErr["type"] ? true : false, TTest["subType"] extends ExpectedErr["subType"] ? true : false]> extends true ? true : AssertionError<`failed/isError`, `The tested type is an Error but does not match the type/subtype of '${TExpected}'. Instead it was '${As}/${As}'`, { test: TTest; expected: TExpected; type: Type; subType: Subtype; }> : TTest["type"] extends ExpectedErr["type"] ? true : AssertionError<`failed/isError`, `The tested type is an Error but it's type was not of the type "${Type}"!`, { test: TTest; expected: TExpected; type: Type; subType: Subtype; }> : "type" extends keyof TTest ? TTest["type"] extends ExpectedErr["type"] ? true : AssertionError<`failed/isError`, `The tested type is an Error but it's type was not of the type "${Type}"!`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/isError`, `The tested type is an Error but has no 'type' property defined so unable to test it's value against the expected type of '${ExpectedErr["type"]}'`, { test: TTest; expected: TExpected; }> : "type" extends keyof TTest ? TTest["type"] extends ExpectedErr["type"] ? true : AssertionError<`failed/isError`, `The tested type is an Error but it's type was not of the type ${ExpectedErr["type"]}; instead type property was: ${As}`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/isError`, `The tested type is an Error but has no 'type' property defined so unable to test it's value against the expected type of ${ExpectedErr["type"]}`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/isError`, `The test appears to be an attempt to test if a type is particular type/subtype of an Error but must be a valid string literal and wasn't!`, { test: TTest; expected: TExpected; }>; type Assert = TOp extends "equals" ? [IsEqual] extends [true] ? true : AssertionError<`failed/equals`, `The type being tested did not equal the expected type!`, { test: TTest; expected: TExpected; }> : TOp extends "extends" ? Extends extends true ? true : AssertionError<`failed/extends`, `The type being tested did not extend the expected type!`, { test: TTest; expected: TExpected; }> : TOp extends "doesNotExtend" ? DoesNotExtend extends true ? true : AssertionError<`failed/doesNotExtend`, `The test type extended the comparison type but was not supposed to!`, { test: TTest; expected: TExpected; }> : TOp extends "hasSameKeys" ? TTest extends Container ? TExpected extends Container ? HasSameKeys extends true ? true : AssertionError<`failed/hasSameKeys`, `The test type had the keys of [ ${Join, ", ">} ] which did not match the expected keys of [ ${Join, ", ">} ]`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/hasSameKeys`, `While using the test assertion of 'hasSameKeys' the expected value was NOT a container type!`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/hasSameKeys`, `While using the test assertion of 'hasSameKeys' the test type was found NOT to be a container which by extension makes this test fail!`, { test: TTest; expected: TExpected; }> : TOp extends "hasSameValues" ? TTest extends Container ? TExpected extends Container ? HasSameValues extends true ? true : AssertionError<`failed/hasSameValues`, `The 'has-same-values' test assertion failed because the tuple elements had different types!`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/hasSameValues`, `The expected type for this test was NOT a 'Container' type and it must be when using the 'has-same-values' test assertion!`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/hasSameValues`, `The 'has-same-values' test assertion failed because the test value was NOT a tuple type!`, { test: TTest; expected: TExpected; }> : TOp extends `isError` ? IsValidExpectedError extends true ? IsString extends true ? ValidateErrorType> : TExpected extends null | undefined | true ? TTest extends Error ? true : AssertionError<`failed/isError`, `The tested type was not an error!`, { test: TTest; expected: TExpected; }> : And<[TExpected extends Error ? true : false, TTest extends Error ? false : true]> extends true ? AssertionError<`failed/isError`, `The type assertion 'isError' failed because the tested type is NOT an error and therefore will never extend the expected Error!`, { test: TTest; expected: TExpected; }> : And<[TExpected extends Error ? true : false, TTest extends TExpected ? true : false]> extends true ? true : AssertionError<`failed/isError`, `While the tested type is an error, it does not extend the error type which extends the expected type`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/isError`, `The expected error type is not a valid type! Using a string value is allowed to indicate the error's "type", Using 'null', 'undefined', or 'true' are also valid to allow matching on any error type, and of course any type which extends Error is also valid!`, { test: TTest; expected: TExpected; }> : TOp extends "containsAll" ? TExpected extends readonly string[] ? TTest extends string ? ContainsAll extends true ? true : AssertionError<`failed/containsAll`, `The test string -- '${TTest}' -- did not extend all of the substrings it was supposed to!`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/containsAll`, `The test value for a 'containsAll' assertion was not a string!`, { test: TTest; expected: TExpected; }> : AssertionError<`failed/containsAll`, `The expected type for a 'containsAll' assertion must be a tuple of strings!`, { test: TTest; expected: TExpected; }> : never; type TestResult = [IsAny] extends [true] ? AssertionError<`invalid-test/any-type`, `The test evaluated to ANY! This indicates a problem in the test assertion!`, { test: TTest; expected: TExpected; assertion: TOp; }> : [IsNever] extends [true] ? AssertionError<`invalid-test/never-type`, `The test evaluated to NEVER! This indicates a problem in the test assertion!`, { test: TTest; expected: TExpected; assertion: TOp; }> : TResult; /** * **Test**`` * * A type test which `TTest` when _compared_ using the `TOp` operation * to `TExpected` results in a true outcome. * * ### Operations * * - `equals` * - `extends` * - `doesNotExtend` * - `hasSameKeys` * - `hasSameValues` * - `isError` * - `containsAll` */ type Test = [IsAny] extends [true] ? AssertionError<`invalid-test/any-type`, `A type test passed in "any" as the test value! This is not allowed.`, { test: TTest; expected: TExpected; assertion: TOp; }> : [IsAny] extends [true] ? AssertionError<`invalid-test/any-type`, `A type test passed in "any" as the expected type! This is not allowed.`, { test: TTest; expected: TExpected; assertion: TOp; }> : TestResult, TTest, TOp, TExpected>; //#endregion //#region src/assertions/TypeError.d.ts type Invalid = `invalid-test/${"any-type" | "never-type"}`; type Failed = `failed/${AssertionOp}`; /** * **TypeError** * * An error resulting from a type assertion. * * **Related:** `AssertEquals`, `AssertExtends`, `AssertTrue`, `AssertFalse` */ interface AssertionError { kind: "AssertionError"; classification: TType; message: TMsg; testType: TContext["test"]; expectedType: TContext["expected"]; ctx: WithoutKeys; } //#endregion //#region src/base-types/AnyArray.d.ts /** * **AnyArray** * * Any array, either readonly or otherwise. */ type AnyArray = unknown[] | readonly unknown[]; //#endregion //#region src/base-types/AnyMap.d.ts /** * represents _any_ `Map` type */ type AnyMap = Map; //#endregion //#region src/base-types/AnyObject.d.ts /** * **AnyObject** * * Meant to represent any valid object type (both indexable and not). */ type AnyObject = Dictionary | EmptyObject | ExplicitlyEmptyObject; //#endregion //#region src/base-types/AnySet.d.ts /** * represents _any_ `Set` type */ type AnySet = Set; //#endregion //#region src/base-types/AnyWeakMap.d.ts /** * represents _any_ `WeakMap` type */ type AnyWeakMap = WeakMap; //#endregion //#region src/base-types/Container.d.ts /** * **Container** * * A type which represents common container types including: * * - any object-based dictionary type (Record) * - any array or tuple * - any `Map`, `WeakMap`, or `Set` * * Note: functions are intentionally excluded to avoid excessive type * comparisons when treating functions as containers. */ type Container = readonly unknown[] | Dictionary | Map | WeakMap | Set; /** * **NarrowContainer**`` * * Produces a type which has maximal runtime inference capabilility * of either a Tuple or Dictionary container type. */ type NarrowContainer = Dictionary | readonly N[]; //#endregion //#region src/base-types/Defined.d.ts /** * **Defined** * * Represents **every** type except for the _undefined_ type. */ type Defined = Something | null; //#endregion //#region src/base-types/Dictionary.d.ts /** * **Dictionary**`<[K],[V]>` * * Represents a Key/Value dictionary type. * * **Note:** this is pretty much the same as the built-in * `Record` type of Typescript but */ type Dictionary = Record; //#endregion //#region src/base-types/Digital.d.ts /** * **Digital** * * A Tuple which represents a number as leading `NumericSign` and then * an array of numeric digits. * * **Related:** `DigitalLiteral` */ type Digital = [NumericSign, readonly [Digit$1, ...Digit$1[]]]; /** * **DigitalLiteral** * * A Tuple which represents a number as a leading `NumericSign` and * then an array of numeric string literals. * * **Related:** `Digital` */ type DigitalLiteral = [NumericSign, readonly [`${NumericChar}`, ...`${NumericChar}`[]]]; //#endregion //#region src/base-types/Empty.d.ts /** * **Empty** * * values/types considered to be "empty" */ type Empty = undefined | null | ExplicitlyEmptyObject | [] | ""; //#endregion //#region src/base-types/EmptyObject.d.ts /** * **EmptyObject** * * An object/dictionary with **no** defined properties. */ type EmptyObject = NonNullable; /** * **ExplicitlyEmptyObject** * * An `EmptyObject` with it's index keys set to _never_ (which prohibits any * key from being added) */ type ExplicitlyEmptyObject = NonNullable<{ [x: string]: never; [x: symbol]: never; }>; //#endregion //#region src/base-types/FalsyValue.d.ts /** * **FalsyValue** * * A union of all _falsy_ values. * * **Note:** * - any value which is _not_ falsy is "truthy" * - in addition to the types in this union type; `NaN` too is * considered _falsy_ but there is no type representation for this. */ type FalsyValue = false | 0 | -0 | "" | "false" | null | undefined; //#endregion //#region src/base-types/fns/AnyFunction.d.ts /** * **AnyFunction** * * A type which is meant to match on _all_ types of functions which can exist. */ type AnyFunction = CallableFunction; //#endregion //#region src/base-types/fns/EscapeFunction.d.ts /** * **EscapeFunction**`<[T]>` * * An escape function is a function which takes no parameters and * marks itself by setting the key `escape` to the value **true**. * * If this utility is used with a generic it will ensure that the function * has the `escape` property set. If no generic is used then it will just * present a generalized shape for escape functions. * ```ts * // () => string & {escape: true} * type Esc = EscapeFunction<() => string>; * // () => unknown & {escape: true} * type Esc2 = EscapeFunction; * ``` */ type EscapeFunction = () => any & { escape: true; }; type AsEscapeFunction = T extends EscapeFunction ? ExpandRecursively & FnKeyValue>> : never; //#endregion //#region src/base-types/fns/FnAllowingProps.d.ts /** * **FnAllowingProps** * * Allows for any typed function and any associated key/value properties. * * - by default all properties are allowed and set to `unknown` but you can use * optional generic `TDict` to be more explicit about the properties. */ type FnAllowingProps> = TypedFunction & TDict; //#endregion //#region src/base-types/fns/IdentityFunction.d.ts /** * An identity function is one which receives a value `T` * and returns the same value `T`. */ type IdentityFunction = (val: T) => T; //#endregion //#region src/base-types/fns/JustFunction.d.ts /** * **JustFunction**`` * * Type utility which strips off any dictionary properties that may have existed * on the function passed in as `T` and leaves just the pure function signature. */ type JustFunction = (...args: Parameters) => ReturnType; //#endregion //#region src/base-types/fns/NodeCallback.d.ts /** * **NodeCallback** * * The shape of a NodeJS callback function */ type NodeCallback = (((err?: any) => void) | ((err: any, result: any) => void)); //#endregion //#region src/base-types/fns/OptionalParamFn.d.ts /** * **OptionalParamFn** * * A function which either has _no_ parameters or any parameters it * does have are _optional_ in a way that it is safe to call it without * any parameters. * * To make the runtime aware of this flexibility, a property `optionalParams` * must be set to **true**. To convert a regular function to be this kind of * function you can use the `AsOptionalParamFn` utility. */ type OptionalParamFn = ((() => any) | ((p1?: any, p2?: any, p3?: any, p4?: any) => any)) & { optionalParams: true; }; /** * **AsOptionalParamFn**`` * * Converts the function passed in into a `OptionalParamFn` where possible and * converts to `ErrorCondition<"invalid-conversion">` otherwise. */ type AsOptionalParamFn = Parameters["length"] extends 0 ? T & { optionalParams: true; } : If, "extends", undefined>, Err<"invalid-conversion", `To convert to a OptionalParamFn, a function must have _no_ required Parameters but required params were found!`, { library: "inferred-types/constants"; params: Parameters; }>, T & { optionalParams: true; }>; //#endregion //#region src/base-types/fns/ParameterlessFn.d.ts /** * **ParameterlessFn** * * A function which returns takes no parameters. */ type ParameterlessFn = () => R; //#endregion //#region src/base-types/fns/RegularFn.d.ts /** * **RegularFn**`<[TArgs], [TReturn]>` * * A typical function which receives a set of arguments `TArgs`, * and then returns some type `TReturn`. */ type RegularFn = (...args: TArgs) => TReturn; //#endregion //#region src/base-types/fns/TakeFunction.d.ts /** * **TakeFunction** * * A _take function_ helps to extract a substring from the * HEAD of a string token and convert the substring into a Lexer token. * * - returning `NoMatch` indicates that the take function wasn't able to * match the HEAD of the current parse string. */ type TakeFunction = ; }, TFound extends string, TParseString extends string, TLexerTokens extends readonly TToken[]>(payload: TPayload) => Error | NoMatch | LexerDelta, [...TLexerTokens, TToken]>; /** * **TakeWrapper** * * A builder/wrapper function around the core take callback. */ type TakeWrapper = , TParseString extends string, TLexerTokens extends readonly TToken[]>(state: TState) => StartsWith extends true ? LexerState, [...TLexerTokens, TToken]> | Error : NoMatch; //#endregion //#region src/literals/BooleanLike.d.ts /** * **BooleanLike** * * A union of all boolean types plus the string literal representations of these * literals. */ type BooleanLike = boolean | "true" | "false" | "boolean"; //#endregion //#region src/literals/Box.d.ts interface Box { __type: "box"; value: T; /** * Unbox the boxed value in the narrowest possible type. * * **note:** if the boxed value is a function with parameters you * can pass the parameters directly into the `b.unbox(params)` call. */ unbox: HasParameters["value"]> extends true ? Box["value"] extends TypedFunction ? Box["value"] extends ((...args: infer A) => infer R) ? (...args: N) => R : () => ReturnType : () => T : () => T; } //#endregion //#region src/literals/branding/BrandSymbol.d.ts declare const BrandSymbol: unique symbol; //#endregion //#region src/literals/branding/Brand.d.ts /** * **Brand** * * Brands a scalar `Base` type with `{ [BrandSymbol]: Kind }`. * * - you may optionally choose to add other key/value pairs * to the metadata. */ type Brand | undefined = undefined> = [Kv] extends [undefined] ? Base & { [BrandSymbol]: Kind; } : Base & { [BrandSymbol]: Kind; } & Kv; //#endregion //#region src/literals/branding/GetBrand.d.ts /** * **GetBrand**`` * * Get's the "brand" that the symbol has been */ type GetBrand = typeof BrandSymbol extends keyof T ? T[typeof BrandSymbol] : undefined; //#endregion //#region src/literals/branding/IsBranded.d.ts /** * **IsBranded**`` * * Boolean operator which tests whether `T` has been _branded_ with the * `Brand` utility. */ type IsBranded = typeof BrandSymbol extends keyof T ? true : false; //#endregion //#region src/literals/branding/Unbrand.d.ts type Digit$9 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; type ValidTwoDigitMonth$2 = `0${Exclude}` | `1${"0" | "1" | "2"}`; type ValidTwoDigitDate$2 = `0${Exclude}` | `1${Digit$9}` | `2${Digit$9}` | `3${"0" | "1"}`; type UnbrandTwoDigitMonth = { [M in ValidTwoDigitMonth$2]: T extends Brand ? M : never }[ValidTwoDigitMonth$2]; type UnbrandTwoDigitDate = { [D in ValidTwoDigitDate$2]: T extends Brand ? D : never }[ValidTwoDigitDate$2]; /** * **Unbrand**`` * * Removes branding from a branded type, returning the original base type. * * Note: This utility has a known limitation with intersection types. * When a branded type is intersected with a literal (e.g., `Brand & "literal"`), * TypeScript creates a composite type that cannot be decomposed to extract just the literal. * This is a fundamental TypeScript limitation. * * @example * * ```ts * // string & { [Brand Symbol]: "UserId" } * type Branded = Brand; * type Unbranded = Unbrand; // string * ``` */ type Unbrand = T extends `${infer A extends Digit$9}${infer B extends Digit$9}${infer C extends Digit$9}${infer D extends Digit$9}` & { [BrandSymbol]: "FourDigitYear"; } ? `${A}${B}${C}${D}` : T extends { [BrandSymbol]: "TwoDigitMonth"; } ? UnbrandTwoDigitMonth : T extends { [BrandSymbol]: "TwoDigitDate"; } ? UnbrandTwoDigitDate : T extends Brand ? B : T; //#endregion //#region src/literals/branding/UnbrandValues.d.ts /** * **UnbrandValues**`` * * Unbrand's any values in a tuple or dictionary. * * **Related:** `Unbrand`, `Brand`, `IsBranded`, `GetBrand` */ type UnbrandOne = V extends Brand ? Unbrand : V; type UnbrandTuple = { [K in keyof T]: UnbrandOne }; type UnbrandIfBranded = UnbrandOne; type UnbrandValues = T extends readonly unknown[] ? UnbrandTuple : T extends Dictionary ? ToKv extends infer KeyValues extends readonly KeyValue[] ? { [K in keyof KeyValues]: KeyValues[K] extends infer KV extends KeyValue ? Expand & Record<"value", UnbrandIfBranded>> : never } extends infer Result extends readonly KeyValue[] ? FromKv : never : never : never; //#endregion //#region src/literals/Choices.d.ts /** * **createChoice**(name, [value]) * * Creates a "choice" for a Choice API. Values may be: * * - any `Scalar` value * - a callback of the form `s => s.literal(42)` * - or if left _undefined_ the value will be set to the name */ type CreateChoice = (name: TName, value?: TValue) => Choice; type ChoiceCallback = (cb: CreateChoice) => Choice; interface Choice { name: K; value: V; } type ChoiceValue = ShapeCallback | Scalar | Dictionary | undefined; /** * **AsChoice** * * Converts a name/value pairing from createChoice() into a Choice. */ type AsChoice = [TValue] extends [ShapeCallback] ? { name: TName; value: HandleDoneFn>; } : [TValue] extends [Scalar | Dictionary] ? { name: TName; value: TValue; } : { name: TName; value: TName; }; type ProcessChoices = T extends string ? Choice : T extends [string, Scalar] ? Choice : T extends Choice ? T : T extends ChoiceCallback ? ReturnType : never; type ToChoices = { [K in keyof T]: ProcessChoices }; interface ChoiceApiOptions { /** * A choice may only be chosen once */ unique: boolean; max: number | null; /** * the API style as it's presented after configuration */ style: "fn" | "object"; } type ChoiceApi<_TChoices extends readonly Choice[], _TOptions extends ChoiceApiOptions> = EmptyObject; interface ChoiceApiConfig { done: () => ChoiceApi; allowChoicesToBeUsedOnlyOnce: () => ChoiceApiConfig, { unique: true; }>, ChoiceApiOptions>>; /** * configured choices can be _reused_ multiple times */ allowChoicesToBeUsedMultipleTimes: () => ChoiceApiConfig, { unique: false; }>, ChoiceApiOptions>>; setStyle: (style: TStyle) => ChoiceApiConfig, { style: TStyle; }>, ChoiceApiOptions>>; /** * set a maximum number of choices that should be allowed */ maximumChoices: (max: TMax) => ChoiceApiConfig, { max: TMax; }>, ChoiceApiOptions>>; } interface MultipleChoice = Dictionary, TForceUnique extends boolean = boolean, TState extends readonly unknown[] = [], TExclude extends string = never> { selected: TState; forceUnique: TForceUnique; choices: TChoices; >(s: T): MultipleChoice, TExclude | T, TExclude>>>; /** return the selected choices */ done: () => TState; } /** * **MultiChoiceCallback**`` * * Provides the typing so that you can easily incorporate a "choice" * as a parameter to your functions. * * It is intended to be used with the runtime utility `handleDoneFn()` * so that if a user doesn't terminate their callback with a call to * `.done()` then this is done for them. */ type MultiChoiceCallback = unknown)>(cb: CB) => HandleDoneFn>; type MergeKVs$1 = [] extends TInput ? ExpandRecursively : MergeKVs$1, First$1 extends keyof TOutput ? TOutput : TOutput & First$1>; /** * **ChoiceBuilder** * * Builds a Choice API surface: */ type ChoiceBuilder = (...choices: TChoices) => ({ chooseMany: (force: TForce) => MultipleChoice extends Dictionary ? MergeKVs$1 : never, TForce>; }); //#endregion //#region src/literals/Color.d.ts type NamedColor_Pink = "Pink" | "LightPink" | "HotPink" | "DeepPink" | "PaleVioletRed" | "MediumVioletRed"; type NamedColor_Purple = "Lavender" | "Thistle" | "Plum" | "Orchid" | "Violet" | "Fuchsia" | "Magenta" | "MediumOrchid" | "DarkOrchid" | "DarkViolet" | "BlueViolet" | "DarkMagenta" | "Purple" | "MediumPurple" | "MediumSlateBlue" | "SlateBlue" | "DarkSlateBlue" | "RebeccaPurple" | "Indigo"; type NamedColor_Red = "LightSalmon" | "Salmon" | "DarkSalmon" | "LightCoral" | "IndianRed" | "Crimson" | "Red" | "FireBrick" | "DarkRed" | "Maroon"; type NamedColor_Orange = "Orange" | "DarkOrange" | "Coral" | "Tomato" | "OrangeRed"; type NamedColor_Yellow = "Gold" | "Yellow" | "LightYellow" | "LemonChiffon" | "LightGoldenRodYellow" | "PapayaWhip" | "Moccasin" | "PeachPuff" | "PaleGoldenRod" | "Khaki" | "DarkKhaki"; type NamedColor_Green = "GreenYellow" | "Chartreuse" | "LawnGreen" | "Lime" | "LimeGreen" | "PaleGreen" | "LightGreen" | "MediumSpringGreen" | "SpringGreen" | "MediumSpringGreen" | "SeaGreen" | "ForestGreen" | "Green" | "DarkGreen" | "YellowGreen" | "OliveDrab" | "DarkOliveGreen" | "MediumOliveGreen" | "MediumAquaMarine" | "DarkSeeGreen" | "LightSeaGreen" | "DarkCyan" | "Teal"; type NamedColor_Cyan = "Aqua" | "Cyan" | "LightCyan" | "PaleTurquoise" | "Aquamarine" | "Turquoise" | "MediumTurquoise" | "DarkTurquoise"; type NamedColor_Blue = "CadetBlue" | "SteelBlue" | "LightSteelBlue" | "LightBlue" | "PowerBlue" | "LightSkyBlue" | "SkyBlue" | "CornflowerBlue" | "DeepSkyBlue" | "DodgerBlue" | "RoyalBlue" | "Blue" | "MediumBlue" | "DarkBlue" | "MidnightBlue"; type NamedColor_Brown = "Cornsilk" | "BlanchedAlmond" | "Bisque" | "NavajoWhite" | "White" | "BurlyWood" | "Tan" | "RosyBrown" | "SandyBrown" | "GoldenRod" | "DarkGoldenRod" | "Peru" | "Chocolate" | "Olive" | "SaddleBrown" | "Sienna" | "Brown"; type NamedColor_White = "White" | "Snow" | "HoneyDew" | "MintCream" | "Azure" | "AliceBlue" | "GhostWhite" | "WhiteSmoke" | "SeaShell" | "Beige" | "OldLace" | "FloralWhite" | "Ivory" | "AntiqueWhite" | "Linen" | "LavenderBlush" | "MintyRose"; type NamedColor_Gray = "Gainsboro" | "LightGray" | "Silver" | "DarkGray" | "DimGray" | "Gray" | `LightSlateGray` | "SlateGray" | "DarkSlateGray" | "Black"; /** * **NamedColor** * * Most if not all CSS/HTML _named_ colors */ type NamedColor = NamedColor_Gray | NamedColor_White | NamedColor_Brown | NamedColor_Blue | NamedColor_Cyan | NamedColor_Green | NamedColor_Yellow | NamedColor_Orange | NamedColor_Red | NamedColor_Purple | NamedColor_Pink; /** * **NamedColorMinimal** * * A minimal set of _named_ colors recognized by CSS and HTML. */ type NamedColorMinimal = "Gray" | "SlateGray" | "DarkSlateGray" | "Black" | "White" | "AliceBlue" | "WhiteSmoke" | "GhostWhite" | "Brown" | "Tan" | "Cornsilk" | "Blue" | "CadetBlue" | "SteelBlue" | "PowerBlue" | "DodgerBlue" | "DarkBlue" | "Cyan" | "Turquoise" | "Aquamarine" | "Teal" | "Gold" | "Yellow" | "LightYellow" | "Moccasin" | "Orange" | "DarkOrange" | "Tomato" | "Salmon" | "Red" | "FireBrick" | "DarkRed" | "Maroon" | "Plum" | "Violet" | "Purple" | "SlateBlue" | "DarkSlateBlue" | "Indigo"; /** * **HexColor** * * A color value based in hexadecimal format */ type HexColor = `#${HexadecimalChar}${HexadecimalChar}${string}`; /** * **RgbColor** * * Type to enforce an `rgb()` color definition */ type RgbColor = CssRgb; /** * **RgbaColor** * * Type to enforce an `rgba()` color definition */ type RgbaColor = `rgba(${string},${string},${string},${string})`; //#endregion //#region src/literals/ContainerBlockKey.d.ts /** * **ContainerBlockKey**`` * * Returns the `TContainer` value intersected with a guarantee that the * `TKey` key value exists. * ```ts * // { foo: 1; bar: unknown } * type TO = ContainerBlockKey<{foo: 1}, "bar">; * // number[] & readonly [unknown,unknown,unknown] * type TA = ContainerBlockKey; * ``` */ type ContainerBlockKey = TContainer extends Tuple$1 ? TContainer & [...Tuple$1, never] : Exclude; //#endregion //#region src/literals/ContainerKeyGuarantee.d.ts /** * **ContainerKeyGuarantee**`` * * Returns the `TContainer` value intersected with a guarantee that the * `TKey` key value exists. * ```ts * // { foo: 1; bar: unknown } * type TO = ContainerKeyGuarantee<{foo: 1}, "bar">; * // number[] & readonly [unknown,unknown,unknown] * type TA = ContainerKeyGuarantee; * ``` * * - by default the guarantee is provided by assigning the `unknown` * type but you can override this by setting `TType` */ type ContainerKeyGuarantee = TContainer extends Tuple$1 ? TContainer & Readonly<[...Tuple$1, TType]> : ExpandRecursively>; //#endregion //#region src/literals/DoneFnTuple.d.ts /** * **DoneFnTuple**`<[TTuple],[TMakeUnion],[TFns]>` * * This type utility quickly builds the types you'll need for an * API surface with the `done()` command returning the stored state * as either a **Tuple** or a **Union** of the tuple state. * * **Related:** `HasDoneFn`, `Narrow`, `DoneFnKv`, `createDoneTupleFn` */ type DoneFnTuple(a: TAdd) => boolean, "add a value to the tuple/union"]; }, TMakeUnion extends boolean = false, TState extends readonly Narrow[] = Narrow[]> = { [K in keyof TFns]: FnWithDescription } & { state: TState; type_as_union: TMakeUnion; done: FnWithDescription<[() => If, TupleToUnion, TState>, "exits the API surface with the state which has been accumulated so far"]>; }; //#endregion //#region src/literals/ExpandRecursively.d.ts type _ExpandTuple = TLength extends 0 ? Readonly : _ExpandTuple, AfterFirst, [...TTuple, First$1]>; type ExpandParameters = [] extends TParams ? IsNarrowingFn extends true ? AsNarrowingFn, ExpandDictionary>> : AsStaticFn, ExpandDictionary>> : ExpandParameters, [...TResults, First$1 extends Dictionary ? ExpandDictionary> : First$1]>; type ExpandTuple = T extends Tuple$1 ? _ExpandTuple : T; type ExpandUnion = IsUnion extends true ? TupleToUnion>> : T; /** * Recursively goes over an object based structure and tries to reduce * it down to just a simple key/value type. */ type ExpandRecursively = T extends Dictionary ? { [K in keyof T]: T[K] extends AnyFunction ? T[K] extends TypedFunction ? ExpandParameters> : T[K] : ExpandRecursively } : T; /** * Recursively goes over an object based structure and tries to reduce * it down to just a simple key/value type. */ type ExpandDictionary = T extends Dictionary ? { [K in keyof T]: T[K] extends AnyFunction ? T[K] : ExpandRecursively } : T; type Expand = T extends infer O ? { [K in keyof O]: O[K] } : never; //#endregion //#region src/literals/FromTokenNames.d.ts type WideTokenNames = "string" | "number" | "boolean" | "null" | "undefined" | "never" | "unknown" | "string[]" | "number[]" | "boolean[]" | "unknown[]"; type ConvertWideTokenNames = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "null" ? null : T extends "undefined" ? undefined : T extends "never" ? never : T extends "unknown" ? unknown : T extends "string[]" ? string[] : T extends "number[]" ? number[] : T extends "boolean[]" ? boolean[] : T extends "unknown[]" ? unknown[] : never; type WideContainerNames = "object" | "Dictionary" | "Map" | "Set" | "WeakMap"; type ConvertWideContainerNames = T extends "object" ? object : T extends "Dictionary" ? Record : T extends "Map" ? Map : T extends "Set" ? Set : T extends "WeakMap" ? WeakMap : never; /** * **FromWideTokens**`` * * Looks for `WideContainerNames` or `WideTokenNames` and converts them to * the type they describe. If it is `T` is not any of these tokens it is * simply proxied through. * * If you'd prefer to setup a different type for when no token is matched * you can add it under `TElse`. */ type FromWideTokens = T extends WideTokenNames | WideContainerNames ? T extends WideTokenNames ? ConvertWideTokenNames : T extends WideContainerNames ? ConvertWideContainerNames : never : IsNever extends true ? T : TElse; //#endregion //#region src/literals/Narrow.d.ts /** * **Narrow** * * Just like the `Narrowable` type, this type is used in the _extends_ * clause during runtime to extract the narrowest types possible. Unlike * the `Narrowable` type, **Narrow** _excludes_ **symbols**. */ type Narrow = Exclude; //#endregion //#region src/literals/Narrowable.d.ts /** * **Narrowable** * * A union of types which when used as a generic's base value helps to extract * the most narrow definition available. * * **Related:** `NarrowableDefined`, `NarrowableScalar` */ type Narrowable = string | number | boolean | symbol | object | undefined | void | null; //#endregion //#region src/literals/NarrowableDefined.d.ts /** * **NarrowableDefined** * * Precisely the same as the `Narrowable` type but without _undefined_ as an option * * **Related:** `Narrowable`, `NarrowableScalar` */ type NarrowableDefined = string | number | boolean | symbol | object | void | null | EmptyObject; //#endregion //#region src/literals/NarrowableScalar.d.ts /** * **NarrowableScalar** * * A union of all types which are not "containers" (aka, objects and arrays) so that * properties like `{}` and `object` causing conflicts. */ type NarrowableScalar = string | number | boolean | symbol | undefined | void | null; //#endregion //#region src/literals/OptRequired.d.ts /** * Expresses whether an option is "opt" (optional) or "req" (required) */ type OptRequired = "opt" | "req"; //#endregion //#region src/literals/RuntimeUnion.d.ts /** * **RuntimeUnion**`` * * Represents a _union type_ at runtime where the `ReturnType` is the * union type of the member in the `members` array. */ interface RuntimeUnion { kind: "Union"; members: T; type: TupleToUnion; includes: (v: unknown) => boolean; } //#endregion //#region src/literals/Unset.d.ts /** * **Unset** * * The **Unset** type allows you to specify a _parameter_ which * has **not** been set yet but then allows a user to choose any * value they like. * * **Related:** `unset()` */ interface Unset { kind: "Unset"; } //#endregion //#region src/literals/VueComputedRef.d.ts /** * **VueComputedRef** * * The goal of this type is to _appear_ to the runtime and type systems * to be a `ComputedRef` (aka, **Computed** property). * * None of the functionality is provided by this but it allows us to create * _types_ and _type guards_ which can respond to this structure without * needing to have `Vue` but a dependency on this package. */ interface VueComputedRef { value: T; effect: any; } /** * **IsComputedRef**`` * * Boolean operator which determines whether `T` is seen to be a `ComputedRef` * property from **VueJS**. */ type IsComputedRef = T extends { value: unknown; effect: object; } ? true : false; /** * **AsVueComputedRef** * * Narrowing type that takes an _unknown_ `T` and tests to see if is * a **VueJS** `ComputedRef` property. If it is then the narrowed type * is returned, otherwise `never`. * * **Related:** `VueComputedRef`, `IsVueComputedRef` */ type AsVueComputedRef = T extends VueComputedRef ? T & VueComputedRef : never; //#endregion //#region src/literals/VueRef.d.ts declare const Ref: unique symbol; /** * **VueRef**`` * * Intended to be the same type as VueJS's `Ref` but without the need * to include any of the VueJS framework in deps. * * **Notes:** * * - a real `Ref` has both the `value` property and a _private_ symbol * exposed to the runtime as a type (but the type is intentionally not exported). * - whenever using this type, please use it with `IsRef()`,`isRef()` utils * * **Related:** * * - `IsRef`, `isRef()`, `VueComputedRef` */ interface VueRef { [Ref]: "VueRef"; value: T; } //#endregion //#region src/base-types/fns/TypedFunction.d.ts /** * **TypedFunction**`<[P],[R]>` * * A function which has basic typing information. * * **Related:** `TypedFunctionWithDictionary>` */ type TypedFunction

= ((...args: P) => R); type TypedFunctionWithDictionary

= Record> = ((...args: P) => R) & D; //#endregion //#region src/base-types/functional/LeftRight.d.ts type left = 1; type right = 2; /** * **LeftRight**`` * * A tuple which has two possible states represented as `L` * and `R`. * * **Related:** `AsLeft`, `AsRight`, `WhereLeft`, `HandleRight`, `LeftExtends`, ... */ type LeftRight = [kind: "LeftRight", left: L, right: R]; /** * **AsLeftRight**`` * * Assigns two types into a `LeftRight` tuple. * * Note: in most cases you should prefer the use of `ToLeft` and `ToRight` * but in the case where both sides of the `LeftRight` tuple are being leveraged * this is a convenient way to set the value. */ type AsLeftRight = LeftRight; /** * **IsSingleSided**`` * * Boolean utility which tests whether a `LeftRight` container has * a value only on the left or right sides but _not_ both. */ type IsSingleSided = T extends [Defined, undefined] ? true : T extends [undefined, Defined] ? true : false; /** * **AsLeft**`` * * Creates a `LeftRight` tuple with value on left. */ type AsLeft = LeftRight; /** * **IfLeft**`` * * Checks that */ type IfLeft = IsSingleSided extends true ? T[left] extends Defined ? true : false : never; /** * **AsRight**`` * * Creates a `LeftRight` tuple with value on right. */ type AsRight = LeftRight; /** * **AppendRight**`` * * Type utility to add to the right side of a `LeftRight` tuple. * * - if the right of `TExisting` is empty it will add `TErr` as the first element * of an array */ type AppendRight = TExisting[right] extends Tuple$1 ? [...TExisting[right], TErr] : [TErr]; /** * **LeftExtends**`` * * Boolean utility which states whether the value of `TEval` _extends_ * the _left_ value of `TLeftRight` */ type LeftExtends = TEval extends TLeftRight[left] ? true : false; /** * **LeftEquals**`` * * Boolean utility which states whether the value of `TEval` _equals_ * the _left_ value of `TLeftRight` */ type LeftEquals = IfEqual; /** * **LeftIncludes** * * Boolean utility which validates that at least one of the strings segments * in `TEval` -- a string or tuple of strings -- is found in the string * value contained in the left side of `TLeftRight`. */ type LeftIncludes = TLeftRight[left] extends string ? TEval extends string | readonly string[] ? Contains : false : false; type Explicitness = "loose" | "tight"; /** * **LeftContains** * * Boolean utility which validates that the _left_ value of the `TLeftRight` * is a tuple and one of the elements _contains_ `TEval`. * * The definition of _contains_ is determined by the optional `TExplicitness` generic: * - it defaults to "loose" and in turns means that `TEval` must _extend_ an element * - if set to `tight` then it will perform an explicit equality * check on each element. * * **Related:** `LeftIncludes` */ type LeftContains = TLeftRight[left] extends Tuple$1 ? TExplicitness extends "loose" ? Contains : NarrowlyContains : false; /** * **LeftExtends**`` * * Boolean utility which states whether the value of `TEval` _extends_ * the _right_ value of `TLeftRight` */ type RightExtends = TEval extends TLeftRight[right] ? true : false; /** * **RightEquals**`` * * Boolean utility which states whether the value of `TEval` _equals_ * the _right_ value of `TLeftRight` */ type RightEquals = IfEqual; /** * **RightIncludes** * * Boolean utility which validates that at least one of the strings segments * in `TEval` -- a string or tuple of strings -- is found in the string * value contained in the right side of `TLeftRight`. * * **Related:** `RightContains` */ type RightIncludes = TLeftRight[right] extends string ? TEval extends string | readonly string[] ? Contains : false : false; /** * **RightContains** * * Boolean utility which validates that the _right_ value of the `TLeftRight` * is a tuple and one of the elements _contains_ `TEval`. * * The definition of _contains_ is determined by the optional `TExplicitness` generic: * - it defaults to `loose` and in turns means that `TEval` must _extend_ an element * - if set to `tight` then it will perform an explicit equality * check. * * **Related:** `RightIncludes` */ type RightContains = TLeftRight[left] extends Tuple$1 ? TExplicitness extends "loose" ? Contains : NarrowlyContains : false; type LeftRight__Operations = "extends" | "equals" | "includes" | "contains"; /** * **WhereLeft**`` * * A branching utility which branches based on: * - some type `TEval` when using some operation `TOp` * - evaluates to `true` for `TLeftRight[left]` * * #### Operations * - operations are _extends_, _equals_, _includes_, and _contains_ * - _includes_ looks for sub-strings, whereas _contains_ looks for an element of a tuple * * #### Defaults * - the `IF` type defaults to either `TEval` or -- where possible -- a narrowed version based on the intersection of the two types * - the `ELSE` defaults to `ErrorCondition<"conditional-failure">` */ type WhereLeft, { library: "inferred-types/constants"; utility: "IfLeft"; }>> = TOp extends "extends" ? LeftExtends extends true ? IF : ELSE : TOp extends "equals" ? LeftEquals extends true ? IF : ELSE : TOp extends "includes" ? LeftIncludes extends true ? IF : ELSE : TOp extends "contains" ? LeftContains extends true ? IF : ELSE : never; //#endregion //#region src/base-types/Indexable.d.ts /** * **Indexable** * * A type which can be _indexed_. This means either an array of * some sort, an indexable object, a `Map`, or a `WeakMap`. */ type Indexable = IndexableObject | unknown[] | readonly unknown[] | WeakMap | Map; //#endregion //#region src/base-types/IndexableObject.d.ts type Len$1 = UnionToTuple>["length"]; /** * **IndexableObject**`<[TObj], [TIndex]>` * * Type utility which receives a `KV` object and and adds an _index signature_ * so that other properties may be added in the runtime. * * - by default the index signature is `{ [key: string]: unknown; [key: symbol]: unknown }` * but this can be changed by changing `TIndex` * * ```ts * // { [x: string]: unknown; foo: 1; bar: 2 } * type FooBarIdx = IndexableObject<{foo: 1; bar: 2}, KV>; * ``` * * **Related:** `EmptyObject`, `IndexedObject` */ type IndexableObject = If, never, IsEqual extends true ? Dictionary : IsNever> extends true ? Dictionary : ExpandRecursively>>; //#endregion //#region src/base-types/LikeRegExp.d.ts /** * **LikeRegExp** * * Is either a real Regular Expression or a string * that has been has been validated it _can_ be a * regular expression with utilities like `isLikeRegExp()` */ type LikeRegExp = RegExp | string; //#endregion //#region src/base-types/List.d.ts type ShallowCopy = T; type New = T; /** * **List**`` * * A _list_ of elements. Meant to behave precisely as * [Javascript's Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) * but with better behavior when using with `let` or `var` * variable declarations (versus `const` which is semantically peculiar). */ interface List { id: ID; length: number; [key: number]: T; [Symbol.iterator]: () => Iterator>; /** * **at**`(idx)` * * The `at()` method of Array instances takes an integer value * and returns the item at that index, allowing for positive and * negative integers. Negative integers count back from the last * item in the array. */ at: (idx: Fail>) => T; /** * **concat**`(arr | list)` * * The concat() method of Array instances is used to merge two or more arrays. * This method does not change the existing arrays, but instead returns a new array. */ concat: | AsArray>(list: TConcat) => List; copyWithin: AnyFunction; /** * **entries**`()` * * Returns a new array iterator object that contains the key/value pairs * for each index in the array. */ entries: () => Iterator<[number, T], Array>; /** * **every**`(callback)` * * Tests whether all elements in the array pass the test implemented by the * provided callback function. It returns a Boolean value. */ every: boolean), TReturn extends boolean>(cb: TCall) => TReturn; /** * **fill**`(val)` * * Changes _all elements_ within a range of valid indices on the list to the * passed in value. */ fill: (v: F) => List fill`>; /** * **filter**`(callback)` * * Returns a _shallow copy_ of a portion of a given List. The "portion" is filtered * down to just the elements from the given List that pass the test implemented by * the provided callback function. */ filter: boolean)>(cb: TCall) => ShallowCopy>; /** * **find**`(callback)` * * Returns the first element in the provided array that satisfies * the provided testing callback function. * * If no values satisfy the testing function, _undefined_ is returned. */ find: boolean)>(cb: TCall) => ShallowCopy> | undefined; /** * **findIndex**`(callback)` * * Returns the index of the first element in an array that satisfies the provided * testing function. * * If no elements satisfy the testing function, -1 is returned. */ findIndex: boolean)>(cb: TCall) => number | undefined; /** * **findLast**`(callback)` * * iterates the List in reverse order and returns the first element * that satisfies the provided callback function. * * If no elements satisfy the callback function, _undefined_ is returned. */ findLast: boolean)>(cb: TCall) => ShallowCopy> | undefined; /** * iterates the array in reverse order and returns the index of the first element * that satisfies the provided testing function. * * If no elements satisfy the testing function, -1 is returned. */ findLastIndex: (cb: ((v: T) => boolean)) => number | undefined; /** * **flat**`([depth])` * * Creates a new List with all sub-lists elements _flattened_ to the specified depth. * * **Note:** if no depth is specified `1` is used. */ flat: (depth?: TDepth) => List, `${ID} -> flattened${TDepth extends 1 ? "" : `(${TDepth})`}`>; /** * **flatMap**`(callback, [thisArg])` * * Returns a new List formed by applying the given callback function to each element * of the List, and then flattening the result by one level. It is identical to a * map() followed by a flat() of depth 1 (arr.map(...args).flat()), * but slightly more efficient than calling those two methods separately. * * **Note:** the value of `thisArg` sets the `this` value when executing the * callback. */ flatMap: unknown), TArg>(cb: TCall, thisArg?: TArg) => List, 1, true>, `${ID} -> mapped`>; /** * **forEach**`(callback)` * * Executes a provided callback function once for each array element. * * **Note:** the callback is allowed to return values but these values will ignored * as the _forEach_ function never returns anything. */ forEach: (cb: ((v: T) => unknown)) => void; /** * Determines whether an array includes a certain value among its entries, * returning true or false as appropriate. */ includes: (val: T) => boolean; /** * **indexOf**`(find, [instance])` * * Returns the first index at which a given element can be found in the * List, or -1 if it is not present. */ indexOf: (val: T, instance?: number) => number; /** * **join**`([separator])` * * Returns a new string by concatenating all of the elements in this List. * * If the optional _separator_ param is used then adjoining items in the List * will have the text provided. */ join: (sep?: TSep) => string; /** * **keys**`()` * * returns a new `Iterator` that contains all of the keys for the List */ keys: () => Iterator>; /** * **lastIndexOf**`(find)` * * Returns the last index at which a given element can be found in the array, * or -1 if it is not present. * * The array is searched backwards, starting at fromIndex. */ lastIndexOf: (find: T) => number; /** * **map**`(callbackfn)` * * Calls a defined callback function on each element of an array, and returns an array * that contains the results. * * @param callbackfn — A function that accepts up to three arguments. The map method * calls the callbackfn function one time for each element in the array. * * @param thisArg — An object to which the this keyword can refer in the callbackfn * function. If thisArg is omitted, undefined is used as the this value. */ map: unknown)>(cb: M) => List, `${ID} -> mapped`>; /** * **pop**`()` * * Returns the last element from an List _while_ removing it from the List. */ pop: () => T; /** * **push**`(value)` * * Adds the specified elements to the end of an List and returns the new * length of the List. */ push: (...values: V) => number; /** * **reduce**`(callback, initialValue)` * * Executes a user-supplied "reducer" callback function on each element of * the array, in order, passing in the return value from the calculation on * the preceding element. The final result of running the reducer across all * elements of the array is a single value. * * The first time that the callback is run there is no "return value of the * previous calculation". If supplied, an initial value may be used in its place. * Otherwise the array element at index 0 is used as the initial value and * iteration starts from the next element (index 1 instead of index 0). */ reduce: unknown), TVal = List, `${ID} -> reduced`>>(cb: TCall, initialValue?: TVal) => TVal; /** * **reduceRight**`(callback, initialValue)` * * Applies a callback function against an accumulator and each value of * the array (from right-to-left) to reduce it to a single value. */ reduceRight: unknown), TVal = List, `${ID} ->reducedRight`>>(cb: TCall, initialValue?: TVal) => TVal; /** * **reverse**`()` * * Reverses a List in place and returns the reference to the same List, * the first element now becoming the last, and the last element * becoming the first. In other words, elements order in the array will be * turned towards the direction opposite to that previously stated. */ reverse: () => List; /** * **shift**`()` * * Removes the first element from an array and returns that removed element. * This method changes the length of the array. */ shift: () => T; /** * **slice**([start],[end]) * * Returns a shallow copy of a portion of an array into a new array object * selected from start to end (end not included) where start and end represent * the index of items in that array. The original array will not be modified. */ slice: (start?: TStart, stop?: TStop) => ShallowCopy sliced`>>; /** * **some**`(callback)` * * Tests whether at least one element in the array passes the test implemented * by the provided callback function. It returns true if, in the array, it finds * an element for which the provided function returns true; otherwise it returns * false. It doesn't modify the List. */ some: boolean)>(cb: TCall) => boolean; /** * **sort**`(callback)` * * Sorts the elements of an array in place and returns a reference to the same * List, now sorted. * * The default sort order is ascending, built upon converting the elements * into strings, then comparing their sequences of UTF-16 code units values. */ sort: number)>(cb: TCall) => List sorted`>; /** * **splice**`(start,[deleteCount],[...items])` * * Changes the contents of an array by removing or replacing existing elements * and/or adding new elements in place. */ splice: (start: number, deleteCount?: number, ...items: T[]) => List spliced`>; /** * **toLocaleString**`()` * * Returns a string representing the elements of the array. * * The elements are converted to strings using their toLocaleString methods and * these strings are separated by a locale-specific string (such as a comma ","). */ toLocaleString: (lang: TLang, opt?: TOpts) => string; /** * **toReversed**`()` * * Is the _copying_ counterpart of the reverse() method. It returns a new array * with the elements in reversed order. */ toReversed: () => List; /** * **toSorted**`()` * * Is the _copying_ version of the sort() method. It returns a new array with * the elements sorted in ascending order. */ toSorted: () => List; /** * **toSpliced**`(start, [deleteCount], ...[items])` * * Is the _copying_ version of the splice() method. It returns a new array with * some elements removed and/or replaced at a given index. */ toSpliced: (start: number, deleteCount?: number, ...items: T[]) => List toSpliced`>; /** * **toString**`()` * * Returns a string representing the specified array and its elements. */ toString: () => string; /** * **unshift**`(...elements)` * * Adds the specified elements to the beginning of an array and returns the * new length of the array. */ unshift: (...elements: T[]) => number; /** * **values**`()` * * returns an _iterator_ that iterates the value of each item in the array. */ values: () => Iterator>; /** * **with**`(idx, val)` * * Is the _copying_ version of using the bracket notation to change the value of a * given index. It returns a new array with the element at the given index replaced * with the given value. */ with: (idx: number, val: T) => New>; } //#endregion //#region src/base-types/NarrowObject.d.ts /** * **NarrowObject**`` * * Defines a `Record` type who's values extends `Narrowable`. This type is most * commonly used in runtime settings where a function wants to _extend_ this * type to ensure that the received values are as narrow as could be available * from the input source. */ type NarrowObject = Record; //#endregion //#region src/base-types/NonArray.d.ts /** * **NonArray** * * A base type which represents any value _other_ than an array or tuple. */ type NonArray = string | number | boolean | null | undefined | symbol | Dictionary | Map | Set | WeakMap; //#endregion //#region src/base-types/Nothing.d.ts /** * **Nothing** * * This type represents a type which holds no real value; this * is a union between `null` and `undefined`. */ type Nothing = null | undefined; //#endregion //#region src/base-types/NotNull.d.ts /** * **NotNull** * * Represents **every** type except for the **null** value. */ type NotNull = Something | undefined; //#endregion //#region src/base-types/NumericSign.d.ts /** * **NumericSign** * * A `+` or `-` to indicate the numeric sign of a number. */ type NumericSign = "+" | "-"; //#endregion //#region src/base-types/ObjectKey.d.ts /** * **ObjectKey** * * The union of `string` and `symbol` represents the valid key types for a * object/dictionary type. */ type ObjectKey = string | symbol; //#endregion //#region src/base-types/ObjectMap.d.ts type ReqKeys = [] extends K ? Required : ReqKeys, I, O, R & Record, O[First$1] | (]>(v: I) => R)>>; type OptKeys$1 = [] extends K ? Partial : ReqKeys, I, O, R & Record, O[First$1] | (]>(v: I) => R)>>; /** * **ObjectMap**`` * * A dictionary who's keys map to the keys of `O` and values extend * either: * * 1. `O[key]` * 2. `(input: I) => O[key]` * * This dictionary structure describes a converion from type `I` to * type `O` though the eyes of the structure of `O`. * * **Related**: `ObjectMapConversion` */ type ObjectMap = (i: I) => ExpandDictionary, I, O> & OptKeys$1, I, O>>; type ObjectMapConversion> = (input: TInput) => { [K in keyof M]: K extends keyof O ? M[K] extends TypedFunction ? ReturnType : M[K] : never }; type ObjectMapper = (input: T) => { [K in keyof O]: O[K] }; type ObjectMapperCallback = ((cb: ObjectMapper) => unknown); //#endregion //#region src/base-types/objects/FromTo.d.ts /** * An object type which semantically is meant to express the * movement from one type to another. * * - it can be used to express any type movement but the most * common scenario is to move from one string literal to another * so both TFrom and TTo _default_ to `string`. */ interface FromTo { from: TFrom; to: TTo; } //#endregion //#region src/base-types/Scalar.d.ts /** * **Scalar** * * Defines the types which makeup a "scalar" type. */ type Scalar = string | number | bigint | boolean | null | symbol | undefined | void; //#endregion //#region src/base-types/ScalarNotSymbol.d.ts /** * **Scalar** * * Defines the types which makeup a "scalar" type but excludes `symbol`. */ type ScalarNotSymbol = string | number | boolean | null; //#endregion //#region src/base-types/Something.d.ts /** * **Something** * * This type represents **any** type _other than_ `null` or `undefined` (aka, the `Nothing` types). * * **Note:** _this is equivalent to the `{}` type (which is often a surprise to many)_ */ interface Something {} //#endregion //#region src/base-types/TakeUtility.d.ts interface TakeUtility { take: null | T; rest: string; } //#endregion //#region src/base-types/Thenable.d.ts /** * **Thenable**`` * * An object which resembles a promise and is guarenteed to provide a `.then` and `.catch` * callback hook. */ interface Thenable extends PromiseLike { then: (...args: any[]) => any; } //#endregion //#region src/base-types/Tuple.d.ts type TupleRange = [required: number, optional: number]; type _Tuple = 0 extends TLength ? TType extends unknown[] ? Readonly : readonly TType[] : TLength extends number ? Readonly> : TLength extends TupleRange ? Readonly<[...FixedLengthArray, ...FixedLengthArray]> : TLength extends `${infer Num extends number}+` ? Num extends number ? Readonly<[...FixedLengthArray, ...TType[]]> : never : never; /** * **Tuple**`` * * As a default, a **Tuple** is represented as a readonly array of _unknown_ properties. * * - by expressing `TType` you can state either a constant type _or_ a list of types * - by expressing `TLength` it will make the tuple a fixed length (assuming that `TType` * is set to a constant value rather than as a list) * ```ts * // readonly unknown[] * type T1 = Tuple; * // readonly [string, string, string, string] * type T2 = Tuple; * ``` */ type Tuple$1 = _Tuple extends readonly unknown[] ? _Tuple : never; //#endregion //#region src/base-types/Variable.d.ts /** * **Variable** * * the **Variable** type reinforces that a variable: * * - start with an alpha character (upper or lower) * - end with an alphanumeric character * * Further type safety would become too expensive. */ type Variable = `${AlphaChar}${string}${AlphanumericChar}`; type ValidChars = [] extends T ? true : First$1 extends VariableChar ? ValidChars> : false; /** * Boolean operator which returns `true` when `T` is a valid variable * name. */ type IsVariable = T extends Variable ? ValidChars> extends true ? true : false : false; //#endregion //#region src/boolean-logic/branching/Fail.d.ts type ShouldFail = [IsNever] extends [true] ? true : [IsFalse] extends [true] ? true : false; type Iterate$9 = Or<{ [K in keyof TTest]: ShouldFail<[TTest[K]]> }>; /** * **Fail**`` * * A branching utility which tests `TTest` for `false`, `never`, or `ErrorCondition` * and if matched will set the value to `never`. If there is _not_ a match then * `TVal` will be passed through. * * If you wish to have more than one test which might produce the failure * condition you can pass in a tuple of tests into `TTest` and if _any_ of * the tests fail then the condition fails. */ type Fail = [TTest] extends [Tuple$1] ? [Iterate$9] extends [true] ? never : TVal : [ShouldFail] extends [true] ? never : TVal; //#endregion //#region src/boolean-logic/branching/FailFast.d.ts type IsFail> = And<[[IsNever] extends [true] ? true : false, Contains]> extends true ? true : And<[IsFalse, Contains]> extends true ? true : And<[IsError, Contains]> extends true ? true : false; type FailureCondition = "error" | "false" | "never"; interface FailFastOptions { err?: Unset | Error; failureConditions?: FailureCondition[]; } interface DEFAULT$1 { err: Unset; failureConditions: ["error", "false", "never"]; } interface Opt$2 { err: T["err"] extends Error ? T["err"] : DEFAULT$1["err"]; failureConditions: T["failureConditions"] extends [FailureCondition, ...FailureCondition[]] ? T["failureConditions"] : DEFAULT$1["failureConditions"]; } type RtnErr> = O["err"] extends Error ? O["err"] : T; /** * **FailFast**`` * * Accepts a tuple of types and immediately returns a * _failure_ condition as soon as one is encountered in `TTest`. * * Tests which _do not_ fail are passed over until the last test is processed * and if that is processed successfully then it's type is returned. * * - a "failure" is a `never`, `false`, or any `Error` type * - if you want to adjust this you can change the `failureConditions` in options */ type FailFast> = [] extends TTests ? TLast : IsFail, Opt$2> extends true ? RtnErr, Opt$2> : FailFast, TOpt, TLast>; //#endregion //#region src/boolean-logic/branching/Fallback.d.ts /** * **Fallback**`` * * Branching operator which allows giving a value `TVal` a _default value_ when * it's value is either `null`, `undefined`, or `never`. */ type Fallback = [IsUnion] extends [true] ? [UnionMemberExtends] extends [true] ? UnionFilter | TFallback : TVal : IsNull extends true ? TFallback : IsUndefined extends true ? TFallback : TVal; //#endregion //#region src/boolean-logic/branching/Handle.d.ts type Narrow$2 = IsUnion extends true ? UnionToTuple extends readonly unknown[] ? UnionToTuple extends readonly unknown[] ? NotFilter, "extends", [THandle]> extends readonly unknown[] ? TupleToUnion, "extends", [THandle]>> : never : never : never : TContent; /** * **Handle**`` * * Maps `TContent` when it _extends_ / _equals_ (based on `TSpecificity`) the type * of `THandle` to `TMapTo`, otherwise it just proxies the value through. * * - `TSpecificity` defaults to _extends_ but can be set to _equals_ * * **Related:** `THandle` */ type Handle = [THandle] extends [never[]] ? [TContent] extends never[] ? TMapTo : TContent : TSpecificity extends "extends" ? [TContent] extends [THandle] ? TMapTo : Narrow$2 : If, TMapTo, TContent>; //#endregion //#region src/boolean-logic/branching/If.d.ts /** * **If**`` * * Branching utility which tests `TTest` for a boolean value. */ type If = [IsNever] extends [true] ? TNever : [TTest] extends [Error] ? TError : [TTest] extends [boolean] ? [IsTrue] extends [true] ? TIf : [IsBooleanLiteral] extends [true] ? TElse : TMaybe : [TTest] extends [LogicFunction] ? [IsTrue>] extends [true] ? TIf : [IsFalse>] extends [true] ? TElse : [IsBoolean>] extends [true] ? TMaybe : never : never; //#endregion //#region src/boolean-logic/branching/IfAllExtend.d.ts /** * **IfAllExtend**`` * * Branching type util which returns `IF` if **all** of the elements in * `TList` extend `TExtend`. * * - this is an inverted branching util from `IfExtendsAll` * - a closer comparison is `IfSomeExtend` which requires all items to extend */ type IfAllExtend = AllExtend extends true ? IF : ELSE; //#endregion //#region src/boolean-logic/branching/IfAllLiteral.d.ts /** * **IfAllLiteral**`` * * Branching utility which branches on whether the tuple passed in * has _literal_ values for every member. */ type IfAllLiteral = AllLiteral extends true ? IF : ELSE; //#endregion //#region src/boolean-logic/branching/IfEqual.d.ts /** * **IfEqual**`` * * Type utility which returns type `IF` _if_ `X` is equal to `Y`; otherwise returns * type `ELSE`. */ type IfEqual> = IsEqual extends true ? IF : ELSE; /** * **IfEqual**`` * * Type utility which returns type `IF` _if_ `X` is equal to `Y`; otherwise returns * type `ELSE`. * * **Note:** this is just a type alias for `IfEqual` */ type IfEquals> = IfEqual; //#endregion //#region src/boolean-logic/branching/IfLength.d.ts /** * **IfLength**`` * * Type utility which returns type `IF` when `TEvaluate` evaluates to being * a length of `TLength`. It returns type `ELSE` if it can determine the length * at design time and otherwise returns `MAYBE`. * * - the `ELSE` type will default to `TEvaluate` by default * - the `MAYBE` type will default to `IF | ELSE` by default * - If a _non-array_ type is passed into `TEvaluate` then utility will result `ELSE` * type. */ type IfLength = TEvaluate extends readonly unknown[] ? IsNumericLiteral extends true ? IfEqual, TLength, IF, ELSE> : MAYBE : TEvaluate extends unknown[] ? MAYBE : TEvaluate extends string ? If, IfEqual, TLength, IF, ELSE>, MAYBE> : MAYBE; //#endregion //#region src/boolean-logic/branching/IfNever.d.ts /** * **IfNever**`` * * Type utility which transforms type `T` based on whether it extends the _never_ * type. */ type IfNever = [IsNever] extends [true] ? IF : ELSE; //#endregion //#region src/boolean-logic/branching/IfUnset.d.ts /** * **IfUnset**`` * * Branching utility which will proxy _any_ type through except * for those set with `Unset<[T]>`. * * When `Unset` is found then it will be replaced with `TElse`. */ type IfUnset = TTest extends Unset ? TElse : Exclude; type IfUnsetOrUndefined = TTest extends Unset ? TElse : IsUndefined extends true ? TElse : Exclude; //#endregion //#region src/boolean-logic/branching/OnPass.d.ts interface OnPassRemap { never: TNever; false: TFalse; error: TError; } type Merge$2, TKeys extends readonly (ObjectKey & keyof TUser)[], TConfig extends OnPassRemap = { never: never; false: false; error: Constant<"not-set">; }> = [] extends TKeys ? TConfig : Merge$2, As, TUser[First$1]> & Omit>>, OnPassRemap>>; type Process$82> = [IsNever] extends [true] ? TRemap["never"] : [TTest] extends [Error] ? TRemap["error"] extends Constant<"not-set"> ? TTest : TRemap["error"] : [IsFalse] extends [true] ? TRemap["false"] : TPass; type Iterate$8> = [] extends TTest ? TPass : Process$82, TPass, TRemap> extends TPass ? Iterate$8, TPass, TRemap> : Process$82, TPass, TRemap>; /** * **OnPass**`` * * Branching utility which evaluates `TTest` for being * `never`, `false`, or an `Error` class and * passes that through when it occurs. * * In all other cases, the type of `TPass` is proxied through * as the type. * * - the `TRemap` allows you to remap error conditions * as well if needed */ type OnPass> = OnPassRemap>> = TTest extends readonly unknown[] ? Iterate$8> ? TRemap : Merge$2, readonly (ObjectKey & keyof TRemap)[]>>> : Process$82> ? TRemap : Merge$2, readonly (ObjectKey & keyof TRemap)[]>>>; //#endregion //#region src/boolean-logic/branching/Passthrough.d.ts /** * **Passthrough**`` * * Passes through content in `TContent` when it _extends_ the type * of `TPass`, otherwise it changes the type to `THandle`. * * **Related:** `THandle` */ type Passthrough = IfEquals>; //#endregion //#region src/boolean-logic/branching/Validate.d.ts type WideBooleanNotAllowed = Err<"wide-boolean-not-allowed", `Call to Validate received a wide boolean type for T!`>; type WideReturnNotAllowed = Err<"wide-return-not-allowed", `Call to Validate returned a wide type: ${AsString}!`>; /** * **Validate**`` * * Branching utility which proxies through the value of `T` when it is * **not** `false` or _returns_ false, otherwise it passes along `E`. * * - `E` by default is _never_ * - if `T` is a wide boolean type an `ErrorCondition<"wide-boolean-not-allowed">` * will be returned * * ```ts * const fn = (dp: T & Validate>) => {} * ``` */ type Validate = [IsTrue] extends [true] ? TTest : [IsFalse] extends [true] ? TErr : [IsBoolean] extends [true] ? WideBooleanNotAllowed : [TTest] extends [LogicFunction] ? [IsTrue>] extends [true] ? TTest : [IsFalse>] extends [true] ? TErr : WideBooleanNotAllowed : [IsWideType] extends [true] ? WideReturnNotAllowed : TTest; //#endregion //#region src/boolean-logic/branching/When.d.ts type When, TComparator extends GetComparisonParams, TThen extends never, TOp extends ComparisonOperation = "extends"> = Compare extends true ? TThen : TVal; //#endregion //#region src/boolean-logic/branching/WhenNever.d.ts /** * **WhenNever**`` * * When `T` is _never_ this utility will map it to `TMapTo`; in all * other cases it just proxies `T` through. * * **Note:** if not specified, `TMapTo` will be set to **false**. */ type WhenNever = IsNever extends true ? TMapTo : T; //#endregion //#region src/boolean-logic/combinators/And.d.ts interface LogicOptions$2 { empty?: boolean | unknown; err?: "false" | "error" | unknown; } type Reduce$2 = { [K in keyof T]: T[K] extends TypedFunction ? ReturnType : T[K] }; /** * **And**`` * * Performs logical AND operation on an array of boolean values or functions returning boolean. * * - Returns `false` if any element is `false` * - Returns `boolean` if any element is wide `boolean` type * - Returns `true` if all elements are `true` * - Returns `false` for empty arrays (or value from options.empty) * - Returns `boolean` for wide arrays (length not known at compile time) * - Supports functions that return boolean values * - Configurable error handling via options parameter * * **Related:** `Or`, `Not` */ type And = IsAny extends true ? TOpt extends { err: "error"; } ? Err<"invalid/and", "The And logical combinator has a 'any' type! And is expecting a tuple of boolean values (or functions which return boolean).", { library: "inferred-types"; }> : false : IsNever extends true ? TOpt extends { err: "error"; } ? Err<"invalid/and", "The And logical combinator has a 'never' type! And is expecting a tuple of boolean values (or functions which return boolean).", { library: "inferred-types"; }> : false : HasAny<[...T]> extends true ? TOpt extends { err: "error"; } ? Err<"invalid/and", "The And found elements in T which were the 'any' type! And expects all elements to be a boolean value or a function which returns a boolean value.", { value: T; library: "inferred-types"; }> : false : HasNever<[...T]> extends true ? TOpt extends { err: "error"; } ? Err<"invalid/and", "The And found elements in T which were the 'never' type! And expects all elements to be a boolean value or a function which returns a boolean value.", { value: T; library: "inferred-types"; }> : false : [[...T]] extends [readonly (boolean | TypedFunction)[]] ? number extends T["length"] ? boolean : [[]] extends [[...T]] ? TOpt extends { empty: infer E; } ? E : false : [[...T]] extends [readonly boolean[]] ? HasFalse extends true ? false : HasWideBoolean extends true ? boolean : true : Reduce$2<[...T]> extends readonly boolean[] ? HasFalse> extends true ? false : HasWideBoolean> extends true ? boolean : true : TOpt extends { err: "error"; } ? Err<"invalid/and", "The conditions passed into And could not be reduced down to just a boolean array.", { library: "inferred-types"; value: T; }> : false : TOpt extends { err: "error"; } ? Err<"invalid/and", "The And type utility requires that all elements passed to it are either a boolean value directly or a LogicFunction which returns a boolean value"> : false; //#endregion //#region src/boolean-logic/combinators/comparison/Compare.d.ts type ContainsAllParams = number extends TParams["length"] ? boolean : TParams extends readonly [infer Head, ...infer Rest] ? Contains extends true ? ContainsAllParams : false : true; /** * **Comparator** * * A _comparator_ is a runtime function which is created when calling * the `compare(op, params) utility. * * - a _comparator_ also has `op`, and `params` properties */ type Comparator = [IsNever] extends [true] ? Err<`invalid-operation`, `An invalid operation was presented as a Comparator!`> : { kind: "comparator"; op: TOp; params: TParams; } & (>(val: TVal) => Compare); type Process__DateTime = TOp extends "after" ? TVal extends DateLike ? First$1 extends DateLike ? IsAfter> : false : Err<`invalid-value/not-date-like`> : TOp extends "before" ? TVal extends DateLike ? First$1 extends DateLike ? IsBefore> : Err<`invalid-params/not-date-like`, `The '${TOp}' operation expects the parameter used for comparator to be a valid representation of a date but it was not!`, { param: TVal; val: TVal; }> : Err<`invalid-value/not-date-like`, `The '${TOp}' operation expects the value passed in to be a valid representation of a date but it was not!`, { val: TVal; }> : TOp extends "sameDay" ? TVal extends DateLike ? First$1 extends DateLike ? IsSameDay> : Err<`invalid-params/not-date-like`> : Err<`invalid-value/not-date-like`> : TOp extends "sameMonthYear" ? TVal extends DateLike ? First$1 extends DateLike ? IsSameMonthYear> : Err<`invalid-params/not-date-like`, `The '${TOp}' operation expects the parameter used for comparator to be a valid representation of a date but it was not!`, { param: TVal; val: TVal; }> : Err<`invalid-value/not-date-like`, `The '${TOp}' operation expects the value passed in to be a valid representation of a date but it was not!`, { val: TVal; }> : TOp extends "sameMonth" ? TVal extends DateLike ? First$1 extends DateLike ? IsSameMonth> : Err<`invalid-params/not-date-like`, `The '${TOp}' operation expects the parameter used for comparator to be a valid representation of a date but it was not!`, { param: TVal; val: TVal; }> : Err<`invalid-value/not-date-like`, `The '${TOp}' operation expects the value passed in to be a valid representation of a date but it was not!`, { val: TVal; }> : TOp extends "sameYear" ? TVal extends DateLike ? First$1 extends DateLike ? IsSameYear> : Err<`invalid-params/not-date-like`, `The '${TOp}' operation expects the parameter used for comparator to be a valid representation of a date but it was not!`, { param: TVal; val: TVal; }> : Err<`invalid-value/not-date-like`, `The '${TOp}' operation expects the value passed in to be a valid representation of a date but it was not!`, { val: TVal; }> : Unset; type Process__General = TOp extends "extends" ? DoesExtend> : TOp extends "equals" ? IsEqual : TOp extends "false" ? [TVal] extends [boolean] ? [boolean] extends [TVal] ? boolean : IsFalse : [TVal] extends [null] ? false : [TVal] extends [undefined] ? false : [TVal] extends [0] ? false : [TVal] extends [""] ? false : [TVal] extends [true] ? false : [TVal] extends [false] ? true : IsFalse : TOp extends "falsy" ? IsFalsy : TOp extends "true" ? AreIncompatible extends true ? false : IsTrue : TOp extends "truthy" ? IsTruthy : TOp extends "equalsSome" ? TParams extends readonly [...infer L] ? number extends As["length"] ? boolean : SomeEqual, TVal> : boolean : TOp extends "contains" ? TVal extends string | number | readonly unknown[] ? Contains> : false : TOp extends "containsSome" ? TVal extends string | number | readonly unknown[] ? Contains>, TParams> : false : TOp extends "containsAll" ? TVal extends string | number | readonly unknown[] ? ContainsAllParams>, TParams> : false : Unset; type Process__String = TOp extends "startsWith" ? TVal extends ComparisonAccept<"startsWith"> ? TParams extends readonly (string | number)[] ? number extends TParams["length"] ? boolean : StartsWith, TParams[number]> : Err<`invalid-type/parameters`> : Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a valid representation of a date but it was not!`, { val: TVal; }> : TOp extends "endsWith" ? TVal extends ComparisonAccept<"endsWith"> ? TParams extends readonly (string | number)[] ? number extends TParams["length"] ? boolean : EndsWith, TParams[number]> : Err<`invalid-type/parameters`> : Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a valid representation of a date but it was not!`, { val: TVal; }> : TOp extends "endsWithNumber" ? EndsWithNumber : TOp extends "startsWithNumber" ? IsStringLiteral extends true ? FirstChar> extends NumericChar ? true : false : IsString extends true ? boolean : false : TOp extends "onlyNumbers" ? IsStringLiteral extends true ? TVal extends "" ? false : IsEqual, NumericChar>, TVal> : IsString extends true ? boolean : false : TOp extends "onlyLetters" ? IsStringLiteral extends true ? TVal extends "" ? false : IsEqual, AlphaChar>, TVal> : IsString extends true ? boolean : false : TOp extends "alphaNumeric" ? IsStringLiteral extends true ? TVal extends "" ? false : IsEqual, AlphanumericChar>, TVal> : IsString extends true ? boolean : false : TOp extends "isTemplateLiteral" ? IsStringLiteral extends true ? IsTemplateLiteral : false : Unset; type Process__Object = TOp extends "objectKeyGreaterThan" ? IsDictionary extends false ? Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a dictionary object but it wasn't!`> : [Extends, NumberLike>] extends [true] ? [First$1] extends [keyof TVal] ? Extends], NumberLike> extends true ? IsGreaterThan], NumberLike>, As, NumberLike>> : Err<`invalid-value/non-numeric`, `The '${TOp}' operation expects the key '${AsString>}' in the value passed in to be a numeric value but it wasn't!`, { val: TVal; }> : false : Err<`invalid-params/${TOp}`, `The '${TOp}' operation expects the second param to be NumberLike but it wasn't!`, { val: TVal; params: TParams; invalid: TParams[1]; }> : TOp extends "objectKeyGreaterThanOrEqual" ? IsDictionary extends false ? Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a dictionary object but it wasn't!`> : [Extends, NumberLike>] extends [true] ? [First$1] extends [keyof TVal] ? Extends], NumberLike> extends true ? IsGreaterThanOrEqual], NumberLike>, As, NumberLike>> : Err<`invalid-value/non-numeric`, `The '${TOp}' operation expects the key '${AsString>}' in the value passed in to be a numeric value but it wasn't!`, { val: TVal; }> : false : Err<`invalid-params/${TOp}`, `The '${TOp}' operation expects the second param to be NumberLike but it wasn't!`, { val: TVal; params: TParams; invalid: TParams[1]; }> : TOp extends "objectKeyLessThan" ? IsDictionary extends false ? Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a dictionary object but it wasn't!`> : [Extends, NumberLike>] extends [true] ? [First$1] extends [keyof TVal] ? Extends], NumberLike> extends true ? IsLessThan], NumberLike>, As, NumberLike>> : Err<`invalid-value/non-numeric`, `The '${TOp}' operation expects the key '${AsString>}' in the value passed in to be a numeric value but it wasn't!`, { val: TVal; }> : false : Err<`invalid-params/${TOp}`, `The '${TOp}' operation expects the second param to be NumberLike but it wasn't!`, { val: TVal; params: TParams; invalid: TParams[1]; }> : TOp extends "objectKeyLessThanOrEqual" ? IsDictionary extends false ? Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a dictionary object but it wasn't!`> : [Extends, NumberLike>] extends [true] ? [First$1] extends [keyof TVal] ? Extends], NumberLike> extends true ? IsLessThanOrEqual], NumberLike>, As, NumberLike>> : Err<`invalid-value/non-numeric`, `The '${TOp}' operation expects the key '${AsString>}' in the value passed in to be a numeric value but it wasn't!`, { val: TVal; }> : false : Err<`invalid-params/${TOp}`, `The '${TOp}' operation expects the second param to be NumberLike but it wasn't!`, { val: TVal; params: TParams; invalid: TParams[1]; }> : TOp extends "objectKeyEquals" ? IsDictionary extends false ? Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a dictionary object but it wasn't!`> : [First$1] extends [keyof TVal] ? IsEqual], Second$1> : false : TOp extends "objectKeyExtends" ? TVal extends Dictionary ? First$1 extends keyof TVal ? TVal[First$1] extends Second$1 ? true : false : false : Err<`invalid-value`, `The operation '' expects values to be a valid container!`, { val: TVal; params: TParams; }> : TOp extends "objectKeyStartsWith" ? TVal extends Dictionary ? First$1 extends infer Key extends keyof TVal ? TVal[Key] extends string | number ? StartsWith, string | number>> : false : Err<`invalid-value/wrong-type`, `The '${TOp}' operation expects the value passed in to be a dictionary object but it wasn't!`> : false : Unset; type Process__Numeric = TOp extends "greaterThan" ? TVal extends NumberLike ? First$1 extends NumberLike ? IsGreaterThan> : Err<`invalid-param/not-number-like`, `The operation '${TOp}' expects the first parameter to be NumberLike!`, { val: TVal; params: TParams; }> : Err<`invalid-value/not-number-like`, `The operation '${TOp}' expects the value to be compared with the comparator to be NumberLike!`, { val: TVal; params: TParams; }> : TOp extends "greaterThanOrEqual" ? TVal extends NumberLike ? First$1 extends NumberLike ? IsGreaterThanOrEqual> : Err<`invalid-param/not-number-like`, `The operation '${TOp}' expects the first parameter to be NumberLike!`, { val: TVal; params: TParams; }> : Err<`invalid-value/not-number-like`, `The operation '${TOp}' expects the value to be compared with the comparator to be NumberLike!`, { val: TVal; params: TParams; }> : TOp extends "lessThan" ? TVal extends NumberLike ? First$1 extends NumberLike ? IsLessThan> : Err<`invalid-param/not-number-like`, `The operation '${TOp}' expects the first parameter to be NumberLike!`, { val: TVal; params: TParams; }> : Err<`invalid-value/not-number-like`, `The operation '${TOp}' expects the value to be compared with the comparator to be NumberLike!`, { val: TVal; params: TParams; }> : TOp extends "lessThanOrEqual" ? TVal extends NumberLike ? First$1 extends NumberLike ? IsLessThanOrEqual> : Err<`invalid-param/not-number-like`, `The operation '${TOp}' expects the first parameter to be NumberLike!`, { val: TVal; params: TParams; }> : Err<`invalid-value/not-number-like`, `The operation '${TOp}' expects the value to be compared with the comparator to be NumberLike!`, { val: TVal; params: TParams; }> : TOp extends "betweenExclusively" ? TVal extends NumberLike ? TParams extends readonly [infer Min extends NumberLike, infer Max extends NumberLike] ? IsBetweenExclusively : false : false : TOp extends "betweenInclusively" ? TVal extends NumberLike ? TParams extends readonly [infer Min extends NumberLike, infer Max extends NumberLike] ? IsBetweenInclusively : false : false : Unset; type Process__Other = TOp extends "errors" ? IsError : TOp extends "hasLength" ? TVal extends string ? Contains["length"]> : TVal extends readonly unknown[] ? Contains : TVal extends number ? Contains["length"]> : false : TOp extends "errorsOfType" ? TVal extends Error ? "type" extends keyof TVal ? First$1 extends TVal["type"] ? true : false : false : false : TOp extends "returnEquals" ? TVal extends TypedFunction ? IsEqual, TParams[0]> : TVal extends AnyFunction ? boolean : false : TOp extends "returnExtends" ? TVal extends ((...args: any[]) => any) ? Extends, TParams[0]> : false : Unset; /** * process the type for the comparison */ type Comparison = Process__DateTime extends Unset ? Process__General extends Unset ? Process__String extends Unset ? Process__Object extends Unset ? Process__Numeric extends Unset ? Process__Other extends Unset ? Err<`invalid-operation/compare`, `The operation '${TOp}' is not a recognized operation in the Compare<...> type utility!`> : Process__Other : Process__Numeric : Process__Object : Process__String : Process__General : Process__DateTime; /** * **Compare**`` * * Compares the value `TVal` with `TComparator` using * the `TOp` _operator_. * * When either TVal or any parameter is a wide type (like `string`, `number`), * returns `boolean` instead of a definitive `true`/`false`. */ type ValidateParams = TOp extends "equals" ? TParams extends readonly [unknown] ? true : Err<"invalid-parameters", "equals operation requires exactly 1 parameter"> : TOp extends "equalsSome" ? TParams extends readonly [unknown, unknown, ...unknown[]] ? true : Err<"invalid-parameters", "equalsSome operation requires at least 2 parameters"> : TOp extends "extends" ? TParams extends readonly [unknown, ...unknown[]] ? true : Err<"invalid-parameters", "extends operation requires exactly 1 parameter"> : true; type Compare, TOp extends Suggest, TParams extends readonly unknown[]> = TOp extends ComparisonOperation ? ValidateParams extends Error ? ValidateParams : Comparison : Err<`invalid-operation/${TOp}`, `The operation '${TOp}' is not a valid operation for the Compare utility!`, { op: TOp; params: TParams; }>; //#endregion //#region src/boolean-logic/combinators/comparison/ComparisonAccept.d.ts /** * **ComparisonAccept**`` * * Provides the _base type_ which a comparison function will accept. * * - those operations which don't state an explicit `accept` property * in their definitions will be assigned the type `unknown`. */ type ComparisonAccept = TOp extends keyof ComparisonLookup ? "accept" extends keyof ComparisonLookup[TOp] ? ComparisonLookup[TOp]["accept"] : Narrowable : TOp extends ComparisonOperation ? Narrowable : Narrowable; //#endregion //#region src/boolean-logic/combinators/comparison/ComparisonDesc.d.ts interface Descriptors<_TOp extends ComparisonOperation & keyof ComparisonLookup, TParams extends readonly unknown[]> { sameDay: `compares two DateLike values to see if they refer to the same day.`; greaterThan: TParams extends readonly [infer First, ...unknown[]] ? `checks if the passed in value(s) are greater than ${As}.` : string; lessThan: TParams extends readonly [infer First, ...unknown[]] ? `checks if the passed in value(s) are less than ${As}.` : string; } /** * **ComparisonDesc**`` * * Provides a description for a subset of the comparison operations. * * - when a description is _not_ available then `null` is returned * - the parameters being provided is important to give a fuller description * of the operation. */ type ComparisonDesc = TOp extends keyof Descriptors ? Descriptors[TOp] : null; //#endregion //#region src/boolean-logic/combinators/comparison/ComparisonFn.d.ts /** * **ComparisonFn** * * A function which take a value or a tuple of values * and: * * 1. return a boolean value when passed a */ type ComparisonFn = (ComparisonDesc extends string ? { kind: "Comparison Function"; operation: TOp; params: TParams; desc: ComparisonDesc; } : { kind: "Comparison Function"; operation: TOp; params: TParams; }) & ([]>(val: T) => T extends readonly unknown[] ? Filter : T extends ComparisonAccept ? Compare : never); //#endregion //#region src/boolean-logic/combinators/comparison/ComparisonLookup.d.ts /** the _mode_ you're using the `ComparisonLookup` table in */ type ComparisonMode = "run-time" | "design-time"; /** * **ComparisonOperation**`` * * Operations known by the `Compare` and `compare()` utilities * and leveraged by utilities like `Filter`/`filter()`, etc. * * - the generic `T` is used to switch between `run-time` and `design-time` * modes */ type ComparisonOperation = typeof COMPARISON_OPERATIONS[number]; /** * A type which provides a lookup table for standard conversion types. */ interface ComparisonLookup { isTemplateLiteral: { params: readonly []; accept: unknown; take: 1; }; extends: { params: readonly [types: unknown, ...unknown[]]; accept: unknown; }; startsWith: { params: readonly [startsWith: string | number, ...variants: (string | number)[]]; accept: string | number; }; endsWith: { params: readonly (string | number)[]; convert: "stringUnion"; accept: string | number; take: 1; }; endsWithNumber: { params: []; desc: "tests whether a string literal ends with a numeric value"; accept: string; take: 0; }; startsWithNumber: { params: []; desc: "tests whether a string literal starts with a numeric value"; accept: string; take: 0; }; onlyNumbers: { params: []; desc: "tests whether a string literal contains only numeric characters"; accept: string; take: 0; }; alphaNumeric: { params: []; desc: "tests whether a string literal contains only alphabetic and numeric characters"; accept: string; take: 0; }; onlyLetters: { params: readonly []; desc: "tests whether a string literal contains only letter characters"; accept: string; take: 0; }; contains: { params: readonly [substring: string | number]; convert: ["stringLiteral"]; accept: string | number | readonly (string | number)[]; take: 1; }; containsAll: { params: readonly [substrings: string | number, ...readonly (string | number)[]]; accept: string | number | readonly (string | number)[]; convert: "stringArray"; take: "*"; }; containsSome: { params: readonly [val1: string | number, val2: string | number, ...(string | number)[]]; accept: string | number | readonly (string | number)[]; convert: "stringUnion"; take: "1"; }; greaterThan: { params: readonly [value: NumberLike]; accept: NumberLike; take: 1; }; greaterThanOrEqual: { params: readonly [value: NumberLike]; accept: NumberLike; take: 1; }; lessThan: { params: readonly [value: NumberLike]; accept: NumberLike; take: 1; }; lessThanOrEqual: { params: readonly [value: NumberLike]; accept: NumberLike; take: 1; }; objectKeyGreaterThan: { params: readonly [key: string, type: NumberLike]; take: 2; }; objectKeyGreaterThanOrEqual: { params: readonly [key: string, type: NumberLike]; take: 2; }; objectKeyLessThan: { params: readonly [key: string, type: NumberLike]; take: 2; }; objectKeyLessThanOrEqual: { params: readonly [key: string, type: NumberLike]; take: 2; }; betweenInclusively: { params: readonly [greaterThan: NumberLike, lessThan: NumberLike]; accept: NumberLike; take: 2; }; betweenExclusively: { params: readonly [greaterThan: NumberLike, lessThan: NumberLike]; accept: NumberLike; take: 2; }; equals: { params: readonly [value: unknown]; take: 1; accept: unknown; }; equalsSome: { params: readonly [potentialValues: unknown, unknown, ...unknown[]]; take: "*"; }; errors: { params: readonly []; take: 0; }; errorsOfType: { params: readonly [type: string | Error]; take: 1; }; before: { params: readonly [date: DateLike]; accept: DateLike; take: 1; }; after: { params: readonly [date: DateLike]; accept: DateLike; take: 1; }; sameDay: { params: readonly [date: DateLike]; accept: DateLike; take: 1; }; sameMonth: { params: readonly [date: DateLike]; accept: DateLike; take: 1; }; sameMonthYear: { params: readonly [date: DateLike]; accept: DateLike; take: 1; }; sameYear: { params: readonly [date: DateLike]; accept: DateLike; take: 1; }; truthy: { params: readonly []; take: 0; accept: Narrowable; }; falsy: { params: readonly []; accept: Narrowable; take: 0; }; true: { params: readonly []; take: 0; }; false: { params: readonly []; take: 0; }; objectKeyEquals: { params: readonly [key: string, value: unknown]; take: 2; }; objectKeyExtends: { params: readonly [key: string, type: unknown]; accept: Dictionary; take: 2; }; objectExtends: { params: readonly [type: unknown]; take: 1; accept: Dictionary; }; objectKeyStartsWith: { params: readonly [prop: ObjectKey, comparator: string | number]; take: 2; accept: Dictionary; }; returnEquals: { params: readonly [validReturnTypes: unknown, ...unknown[]]; take: "*"; accept: (...args: any[]) => any; }; returnExtends: { params: readonly [validReturnTypes: unknown, ...unknown[]]; take: "1"; convert: "union"; accept: (...args: any[]) => any; }; } //#endregion //#region src/boolean-logic/combinators/comparison/ComparisonOpConfig.d.ts /** * Operations to perform across all parameters in a comparision * to create a `Comparator`. These operations will reduce all * parameters to a single parameter. */ type ComparisonParamConvert__List = "union" | "stringUnion" | "stringArray"; /** * Operations to perform on one (or all) parameters in a * comparision to create a `Comparator`. These operations * will not change the _arity_ of the Comparator vs. the params. */ type ComparisonParamConvert__Unit = "token" | "stringLiteral" | "none"; /** * Ways to convert conversion parameters to a `Comparator` * type when the `convert` configuration is active. */ type ComparisonParamConvert = ComparisonParamConvert__List | ComparisonParamConvert__Unit; /** * The definition of a _comparator's_ configuration */ interface ComparisonOpConfig { params: readonly unknown[]; /** * Explicitly state the _type_ the runtime function can take when moved * into strict mode. If not stated, it will be inferred based on the * parameters. */ accept?: unknown; /** * how many parameters the function expects to take */ take?: 0 | 1 | 2 | 3 | "*"; /** * conversion of the parameters before comparison starts * * - if a tuple then the conversion is done element by element * of the parameters received * - if not a tuple then the operation is performed across * all the parameters * * **Note:** some operations -- like `union` -- when applied across * parameters will change the parameter count; this is likely * desired but just make sure you consider this. */ convert?: ComparisonParamConvert | readonly ComparisonParamConvert__Unit[]; } //#endregion //#region src/boolean-logic/combinators/comparison/GetComparator.d.ts type TakeCount = undefined extends T["take"] ? T["params"]["length"] extends Required ? T["params"]["length"] : "*" : T["take"] extends Required ? T["take"] : never; type Take$10 = TakeCount extends 0 ? undefined : TakeCount extends 1 ? First$1 : TakeCount extends "*" ? TParams : TakeCount extends number ? Slice> : never; type ConvertUnit = [TConvert] extends ["stringLiteral"] ? [TParam] extends [string | number | boolean] ? `${TParam}` : Err<`invalid-conversion/${TConvert}`, `The '${TConvert}' conversion was used on a parameter whose type is not allowed. This operation should be used to convert strings, number, or booleans into string literals.`, { param: TParam; }> : [TConvert] extends ["token"] ? [TParam] extends [InputToken] ? FromInputToken : never : [TConvert] extends ["none"] ? TParam : TParam; /** * Called when the "convert" rule is a tuple of rules. */ type GetTupleComparator = [] extends TParams ? TResult : GetTupleComparator extends 1 ? TConvert : AfterFirst, AfterFirst, [...TResult, ConvertUnit, First$1>]>; /** * **GetComparator**`` * * Uses an operations configuration to determine what the * Comparator type or types is. * * Takes: * * - `0`   -> returns _undefined_ * - `1`   -> type after any _conversion_ * - `2+` -> a tuple of params with all _conversions_ complete */ type GetComparator = [TConfig["convert"]] extends ["stringArray"] ? Take$10, TConfig> : [TConfig["convert"]] extends ["union"] ? Take$10<[TParams[number]], TConfig> : [TConfig["convert"]] extends ["stringUnion"] ? TParams extends [infer Only] ? IsUnion extends true ? AsStringUnion : [AsString] : Take$10<[ToStringArray[number]], TConfig> : [TConfig["convert"]] extends ["token"] ? Take$10<{ [K in keyof TParams]: [TParams[K]] extends [InputToken] ? FromInputToken : never }, TConfig> : [TConfig["convert"]] extends ["stringLiteral"] ? Take$10<{ [K in keyof TParams]: [TParams[K]] extends [string | number | boolean] ? `${TParams[K]}` : never }, TConfig> : [TConfig["convert"]] extends [readonly ComparisonParamConvert__Unit[]] ? GetTupleComparator : Take$10; //#endregion //#region src/boolean-logic/combinators/comparison/GetComparisonParams.d.ts /** * Presents the type options for entering a comparison's * parameters. This is meant as a convenience function * and allows you to not be forced to enter parameter * that aren't required. */ type GetComparisonParams = As<[IsUnion] extends [true] ? readonly unknown[] : TOp extends keyof ComparisonLookup ? ["params"] extends [keyof ComparisonLookup[TOp]] ? ComparisonLookup[TOp]["params"] extends readonly unknown[] ? ComparisonLookup[TOp]["params"] : never : readonly unknown[] : readonly unknown[], readonly unknown[]>; //#endregion //#region src/boolean-logic/combinators/comparison/GetOpConfig.d.ts /** * **GetOpConfig**`` * * Type utility which extracts the configuration for * a specific comparison operation. */ type GetOpConfig = TConfig extends ComparisonOpConfig ? TConfig : TOp extends keyof ComparisonLookup ? Err<`malformed-operation/${TOp}`, `The configuration for '${TOp}' was found but is malformed and does not extend the 'ComparisonOpConfig' type!`, { config: ToStringLiteral; }> : Err<`invalid-operation/${TOp}`, `Tried to get configuration on '${TOp}' comparison operation but this operation is not known!`>; //#endregion //#region src/boolean-logic/combinators/Every.d.ts type Process$81> = TElements extends [infer Head, ...infer Rest] ? TElements extends readonly unknown[] ? Head extends ComparisonAccept ? [Compare] extends [true] ? Process$81 : false : Process$81 : false : true; /** * **Every**`` * * Evaluates a container (_a tuple or kv object_) to see if **every** one of * the _values_ it contains match the comparison provided by the `TOp` and * `TComparator`. * * ```ts * // true * type T = Every<["foo","bar","baz"], "extends", [string]>; * // false * type F = Every<["foo","bar","baz", 42], "extends", [string]>; * ``` */ type Every | First$1>> = IsWideContainer extends true ? boolean : Process$81, TOp, TComparator extends GetComparisonParams ? TComparator : TComparator extends First$1> ? [TComparator] extends GetComparisonParams ? [TComparator] : never : never>; //#endregion //#region src/boolean-logic/combinators/FirstDefined.d.ts /** * **FirstDefined**`` * * Iterates over a tuple `T` and returns the first item in the * tuple which has a defined value (e.g., not _undefined_). * * **Related:** `FirstValue` */ type FirstDefined = [] extends T ? U : IsDefined> extends true ? First$1 : FirstDefined, U>; //#endregion //#region src/boolean-logic/combinators/FirstSet.d.ts /** * **FirstSet**`` * * Iterates over a tuple `T` and returns the first item in the * tuple which has a type which is NOT `Unset`. * * **Related:** `FirstValue`, `FirstDefined` */ type FirstSet = [] extends T ? U : First$1 extends Unset ? FirstSet, U> : First$1; //#endregion //#region src/boolean-logic/combinators/FirstValue.d.ts /** * **FirstValue**`` * * Iterates over a tuple `T` and returns the first item in the * tuple which has a defined value (e.g., not _undefined_ nor _null_). * * **Related:** `FirstDefined` */ type FirstValue = [] extends T ? U : IsDefined> extends true ? First$1 : FirstValue, U>; //#endregion //#region src/boolean-logic/combinators/Inverse.d.ts /** * **Inverse**`` * * A type utility for tuples which uses the "truthy" formula to * invert the logical type of each entity in the passed in tuple * ``. * * - functions are judged by their return types * - if you wish, you can convert all non-boolean based types to * use a different strategy than whether or not it is `truthy`; * alternatives are: * - "false" * - "never" * * **Related:** `Not`, `Logic` */ type Inverse = { [K in keyof T]: Not> }; //#endregion //#region src/boolean-logic/combinators/Logic.d.ts type LogicHandler = "truthy" | "false" | "never"; type Handle$2 = THandler extends "truthy" ? IsTruthy : THandler extends "false" ? false : THandler extends "never" ? never : never; /** * Converts any type `T` into a `true`, `false` or `boolean`. * * - if `never` is passed in it will always be proxied through * - if a value is neither: * - `true`, `false`, or `boolean` * - nor _returns_ `true`, `false`, or `boolean` * - the generic `U` will come into effect * - by default it is set to `truthy` */ type Logic = [IsTrue] extends [true] ? true : [IsFalse] extends [true] ? false : [IsBoolean] extends [true] ? boolean : [IsNever] extends [true] ? never : [T] extends [LogicFunction] ? [IsTrue>] extends [true] ? true : [IsFalse>] extends [true] ? false : [IsBoolean>] extends [true] ? boolean : [IsNever>] extends [true] ? never : Handle$2 : Handle$2; //#endregion //#region src/boolean-logic/combinators/LogicOptions.d.ts /** * a set of options for logical utilities like `And` and `Or` which receive an * array of logic based values. */ interface LogicOptions { /** * The type to return if the passed in conditions * were an empty array. */ empty?: boolean; /** * Determines how to handle when the conditions passed in * don't hit the required type requirements * (aka, `readonly (boolean & LogicFunction)[]`): * * - `"error"` - returns a descriptive error message; good for debugging purposes * - `"false"` - all error conditions are converted to `false` to preserve the return * type as being exclusively a boolean value */ err?: "error" | "false"; } //#endregion //#region src/boolean-logic/combinators/None.d.ts /** * **None**`` * * Evaluates a container (_a tuple or kv object_) to see if **none** of * the _values_ `TContainer` contains match the comparison provided by the `TOp` and * `TComparator`. * * - this is the opposite of the `Every` utility * * ```ts * // true * type T = Every<["foo","bar","baz"], "extends", [string]>; * // false * type F = Every<["foo","bar","baz", 42], "extends", [string]>; * ``` */ type None> = Not>; //#endregion //#region src/boolean-logic/combinators/Not.d.ts /** * **Not**`` * * A boolean negation that can work on both a single value or an * tuple of values. * * ```ts * // false * type Single = Not; * // [ false, true, boolean ] * type Multi = Not<[true,false,boolean]>; * ``` * * **Related:** `Inverse` */ type Not = [IsAny] extends [true] ? Logic : [IsNever] extends [true] ? Logic : [IsUnknown] extends [true] ? Logic : [TVal] extends [readonly unknown[]] ? { [K in keyof TVal]: Logic } : [IsTrue>] extends [true] ? false : [IsFalse>] extends [true] ? true : [IsBoolean>] extends [true] ? boolean : never; //#endregion //#region src/boolean-logic/combinators/Or.d.ts interface LogicOptions$1 { empty?: boolean | unknown; err?: "false" | "error" | unknown; } type Reduce$1 = { [K in keyof T]: T[K] extends TypedFunction ? ReturnType : T[K] }; /** * **Or**`` * * Performs logical OR operation on an array of boolean values or functions returning boolean. * * - Returns `true` if any element is `true` * - Returns `boolean` if any element is wide `boolean` type * - Returns `false` if all elements are `false` * - Returns `false` for empty arrays (or value from options.empty) * - Returns `boolean` for wide arrays (length not known at compile time) * - Supports functions that return boolean values * - Configurable error handling via options parameter * * **Related:** `And`, `Not` */ type Or = IsAny extends true ? TOpt extends { err: "error"; } ? Err<"invalid/or", "The Or<...> logical combinator has a 'any' type! Or is expecting a tuple of boolean values (or functions which return boolean).", { library: "inferred-types"; }> : false : IsNever extends true ? TOpt extends { err: "error"; } ? Err<"invalid/or", "The Or<...> logical combinator has a 'never' type! Or is expecting a tuple of boolean values (or functions which return boolean).", { library: "inferred-types"; }> : false : HasAny extends true ? TOpt extends { err: "error"; } ? Err<"invalid/or", "The Or found elements in T which were the 'any' type! Or expects all elements to be a boolean value or a function which returns a boolean value.", { value: T; }> : false : HasNever extends true ? TOpt extends { err: "error"; } ? Err<"invalid/or", "The Or found elements in T which were the 'never' type! Or expects all elements to be a boolean value or a function which returns a boolean value.", { value: T; }> : false : T extends readonly (boolean | TypedFunction)[] ? number extends T["length"] ? boolean : [] extends T ? TOpt extends { empty: infer E; } ? E : false : T extends readonly boolean[] ? HasTrue extends true ? true : HasWideBoolean extends true ? boolean : false : Reduce$1 extends readonly boolean[] ? HasTrue> extends true ? true : HasWideBoolean> extends true ? boolean : false : TOpt extends { err: "error"; } ? Err<"invalid/or", "The conditions passed into Or could not be reduced down to just a boolean array.", { library: "inferred-types"; value: T; }> : false : TOpt extends { err: "error"; } ? Err<"invalid/or", "The Or type utility requires that all elements passed to it are either a boolean value directly or a LogicFunction which returns a boolean value", { value: T; }> : false; //#endregion //#region src/boolean-logic/combinators/Some.d.ts type Process$80, THasBool extends boolean = false> = [] extends TComparator ? IsTrue extends true ? boolean : false : T extends readonly unknown[] ? T extends readonly [infer First, ...infer Rest] ? First extends ComparisonAccept ? [Compare] extends [false] ? Process$80 : [Compare] extends [true] ? true : [Compare] extends [boolean] ? Process$80 : Process$80, TOp, TComparator, THasBool> : false : false : false; /** * **Some**`` * * Evaluates a container (_a tuple or kv object_) to see if **some** of the _values_ it contains * match the comparison provided by the `TOp` and `TComparator`. * * ```ts * // true * type Test = Some<["foo","bar","baz"], "equals", ["foo"]>; * ``` */ type Some | GetComparisonParams[0]> = IsWideContainer extends true ? boolean : Process$80, TOp, TComparator extends GetComparisonParams ? TComparator : TComparator extends GetComparisonParams[0] ? [TComparator] extends GetComparisonParams ? [TComparator] : never : never>; //#endregion //#region src/boolean-logic/combinators/Xor.d.ts /** * **Xor**`` * * - true when one (but not both) of `A` and `B` are true * - otherwise false */ type Xor = IsWideBoolean extends true ? boolean : IsWideBoolean extends true ? boolean : A extends true ? (B extends false ? true : false) : (A extends false ? (B extends true ? true : false) : false); //#endregion //#region src/boolean-logic/LogicalCombinator.d.ts /** * Expresses the _type_ of logical combinator being used */ type LogicalCombinator = "AND" | "OR" | "XOR"; //#endregion //#region src/boolean-logic/narrowing/As.d.ts /** * **As**`` * * Ensures that `TContent` _extends_ `TType` or turns type to `never`. */ type As = [TContent] extends [TType] ? TContent : never; //#endregion //#region src/boolean-logic/narrowing/AsDoneFn.d.ts /** * **AsDoneFn**`` * * Narrows */ type AsDoneFn = T extends { done: FnWithDescription; } ? T & { done: () => unknown; } : never; //#endregion //#region src/boolean-logic/narrowing/AsIndexOf.d.ts /** * **AsIndexOf**`` * * Validates that `K` is a keyof `T` and */ type AsIndexOf> = K extends keyof T ? T[K] : IfEqual, Err<"invalid-key", `the key '${AsString}' is not a valid key of the passed container`>, ERR>; //#endregion //#region src/boolean-logic/narrowing/AsSomething.d.ts type Process$79 = TupleToUnion : T[K] }>>; /** * **AsSomething**`` * * Narrowing utility which takes a type `T` and _if it's a union_ * will narrow the union elements to no longer include `undefined` * or `null`. * * - If `T` is a non-union type then: * - a `null` or `undefined` value will be mapped to `TNonUnion` ( * which defaults to `never`) * - all other values are just proxied through */ type AsSomething = IsUnion extends true ? Process$79> : T extends Nothing ? TNonUnion : T; //#endregion //#region src/boolean-logic/narrowing/IsOk.d.ts /** * **IsOk**`` * * Ensures that `T` has all "error" types removed from it's type. * * - if `T` is part of a union, then error variants are removed * - if `T` is not a union it outputs `never` when T extends Error, * otherwise it just proxies `T` through. */ type IsOk = T extends { take: null | string; rest: string; } ? T["take"] extends null ? never : { take: T["take"]; rest: T["rest"]; } : IsUnion extends true ? UnionFilter : T extends Error ? never : T; //#endregion //#region src/boolean-logic/operators/compare/AllExtend.d.ts type AllAcc = [] extends TList ? true : If, TExtend>, AllAcc, TExtend>, false>; /** * **AllExtend**`` * * Boolean type util which checks whether **all** of the elements * in `TList` _extend_ `TExtend`. * * **Related:** `SomeExtend`, `DoesExtend` */ type AllExtend = AllAcc; //#endregion //#region src/boolean-logic/operators/compare/AllLiteral.d.ts /** * **AllLiteral**`` * * A boolean operator which tests whether all properties in * the tuple `TTuple` are _literal_ types. */ type AllLiteral = And<{ [K in keyof T]: IsLiteralLike extends true ? true : false }>; //#endregion //#region src/boolean-logic/operators/compare/AreIncompatible.d.ts /** * **AreIncompatible**`` * * Checks if two types are fundamentally incompatible and can never be equal. * For example, string and number are incompatible, but string and string | number * are not incompatible because they could overlap. */ type AreIncompatible = Or<[IsNever, IsNever]> extends true ? false : [T] extends [U] ? false : [U] extends [T] ? false : [T, U] extends [string, number] ? true : [T, U] extends [number, string] ? true : [T, U] extends [string, boolean] ? true : [T, U] extends [boolean, string] ? true : [T, U] extends [number, boolean] ? true : [T, U] extends [boolean, number] ? true : [T, U] extends [string, null] ? true : [T, U] extends [null, string] ? true : [T, U] extends [number, null] ? true : [T, U] extends [null, number] ? true : [T, U] extends [boolean, null] ? true : [T, U] extends [null, boolean] ? true : [T, U] extends [string, undefined] ? true : [T, U] extends [undefined, string] ? true : [T, U] extends [number, undefined] ? true : [T, U] extends [undefined, number] ? true : [T, U] extends [boolean, undefined] ? true : [T, U] extends [undefined, boolean] ? true : false; //#endregion //#region src/boolean-logic/operators/compare/AreSameLength.d.ts /** * **AreSameLength**`` * * Tests whether `A` and `B` are of equal length. Generics should * be a `Tuple` or a string but not a combination of the two. */ type AreSameLength = IsStringLiteral extends true ? IsStringLiteral extends true ? IsEqual>["length"], Chars>["length"]> : boolean : IsTuple extends true ? IsTuple extends true ? IsEqual : IsStringLiteral extends true ? IsEqual : boolean : boolean; //#endregion //#region src/boolean-logic/operators/compare/AreSameType.d.ts /** * **AreSameType**`` * * Tests whether `A` and `B` are the same _wide_ type. * * - Note: for containers, the types are rolled up to the broad category of * container (e.g., Dictionary, Tuple, Map, Set, WeakMap) * * ```ts * // true * AreSameType<"foo","bar">; * // false * AreSameType<"foo",42>; * ``` */ type AreSameType = Widen extends Widen ? Widen extends Widen ? true : false : false; //#endregion //#region src/boolean-logic/operators/compare/DoesExtend.d.ts /** * **DoesExtend**`` * * Boolean type utility which returns `true` if `TValue` _extends_ `TExtends`. */ type DoesExtend = IsNever extends true ? false : [TValue] extends [TExtends] ? true : false; //#endregion //#region src/boolean-logic/operators/compare/DoesNotExtend.d.ts /** * **DoesNotExtend**`` * * Boolean type utility which returns `true` if `TValue` _does * not extend_ `TNotExtends`. */ type DoesNotExtend = TValue extends TNotExtends ? false : true; //#endregion //#region src/boolean-logic/operators/compare/EveryLength.d.ts /** * **EveryLength**`` * * Checks whether every element of `T` has a length of `N`. */ type EveryLength = [] extends T ? true : First$1["length"] extends N ? EveryLength, N> : false; //#endregion //#region src/boolean-logic/operators/compare/Extends.d.ts /** * **Extends**`` * * A boolean operator which checks whether `T` extends `U` and returns * **true** or **false**. This is an _alias_ for `DoesExtend`. */ type Extends = IsNever extends true ? IsNever extends true ? true : false : DoesExtend; //#endregion //#region src/boolean-logic/operators/compare/ExtendsAll.d.ts type _Extends = TList extends [infer First, ...infer Rest] ? First extends TValue ? _Extends : _Extends : And; /** * **ExtendsAll**`` * * Boolean type utility which evaluates whether a singular * value `TValue` extends **all** of the elements in `TList`. * * **Related:** `ExtendsSome`, `IfExtendsAll`, `DoesExtend` */ type ExtendsAll = _Extends; //#endregion //#region src/boolean-logic/operators/compare/ExtendsEvery.d.ts /** * **ExtendsEvery**`` * * Boolean operator which tests weather the elements in the list `T` * have at least one element which extends _every_ element in `U`. * * - This utility uses the strict `extends` operation * - Use `HasEvery` if you want to use the `equals` operation */ type ExtendsEvery = And<{ [K in keyof T]: Or<{ [Key in keyof U]: T[K] extends U[Key] ? true : false }> }>; //#endregion //#region src/boolean-logic/operators/compare/ExtendsNone.d.ts /** * **ExtendsAll**`` * * Boolean type utility which evaluates whether a singular * value `TValue` extends **all** of the elements in `TList`. * * **Related:** `ExtendsSome`, `IfExtendsAll`, `DoesExtend` */ type ExtendsNone = Not>; //#endregion //#region src/boolean-logic/operators/compare/ExtendsSome.d.ts /** * **ExtendsSome**`` * * Boolean type utility which evaluates whether `TValue` extends **some** of the * elements in `TList`. * * **Related:** `ExtendsAll`, `IfExtendsSome`, `DoesExtend` */ type ExtendsSome = [] extends TExtendsSome ? false : TValue extends First$1 ? true : ExtendsSome>; //#endregion //#region src/boolean-logic/operators/compare/HasEvery.d.ts /** * **HasEvery**`` * * Boolean operator which tests weather the list contained by `T` has * _every_ element of `U`. * * - This utility uses the strict `equality` operation * - Use `ExtendsEvery` if you want to looser operation */ type HasEvery = And<{ [K in keyof U]: Or<{ [Key in keyof T]: U[K] extends T[Key] ? true : false }> }>; //#endregion //#region src/boolean-logic/operators/compare/HasOtherCharacters.d.ts type Process$78 = ReplaceAll extends "" ? false : true; /** * **HasOtherCharacters**`` * * Boolean type utility which tests whether `TStr` has any * characters _other_ than those in `TChars`. * * - union types are fine for `TChars` * - a tuple for `TChars` behaves the same as union type * * **Related:** `HasCharacters` */ type HasOtherCharacters = [IsWideType] extends [true] ? boolean : [TChars] extends [string] ? IsWideType extends true ? boolean : Process$78 : TChars extends readonly string[] ? Process$78> : never; //#endregion //#region src/boolean-logic/operators/compare/IsAnyEqual.d.ts /** * **IsAnyEqual**`` * * Boolean tester which reports on whether `TVal` equals **any** of * the values in `TList`. */ type IsAnyEqual = [] extends TList ? true : IsEqual> extends true ? IsAnyEqual]> : false; //#endregion //#region src/boolean-logic/operators/compare/IsBalanced.d.ts type Check$4 = TInput extends [infer Head extends string, ...infer Rest extends readonly string[]] ? [IsEntryToken] extends [true] ? Check$4 : [IsNestingMatchEnd] extends [true] ? Check$4 : And<[IsExitToken, TStack["length"] extends 0 ? true : false]> extends true ? TErr extends true ? Err<"unbalanced/is-balanced", `The stack moved into negative territory when the character '${Head}' -- an END character -- while the stack was already empty!`, { char: Head; stack: ToStringLiteral__Array; }> : false : [IsExitToken] extends [true] ? TErr extends true ? Err<"unbalanced/is-balanced", `Found an end character '${Head}' that doesn't match the expected end character for the top of the stack`, { char: Head; stack: ToStringLiteral__Array; }> : false : Check$4 : [TStack["length"]] extends [0] ? true : TErr extends true ? Err<`unbalanced/is-balanced`, `The characters passed to 'IsBalanced' are not balanced for the given nesting configuration. On completing a full pass the stack still has items on it: ${Join}`> : false; type EvalString = Check$4, U, TErr>; /** * **IsBalanced**`` * * Boolean operator which tests whether the string literal `T` has an equal * number of "start" and "end" characters in it. * * - you may also pass in a `NestedString` or a _tuple_ of `NestedString`'s for `T` * * **Note:** * - if a start token is found _before_ the first start token (or the * tracker ever goes below zero for any reason) the returned value will be `false`. * - the generic `U` is a dictionary where the _keys_ represent the starting * character and the values are the ending character. * - if you prefer to get Error messages instead of `false` values you can set `TErr` * to true */ type IsBalanced = T extends string ? string extends T ? boolean : EvalString, Nesting>, TErr> : never; //#endregion //#region src/boolean-logic/operators/compare/IsDefined.d.ts /** * **IsDefined** * * Boolean type utility returns `true` if `T` is defined; `false` if undefined */ type IsDefined = T extends undefined | null ? false : true; //#endregion //#region src/boolean-logic/operators/compare/IsEmpty.d.ts /** * Boolean operator which returns `true` when `T` is: * * - `null` or `undefined` * - and empty array * - an empty object * - an empty string (aka, `""`) * * If `T` is a _wide_ type this will always return `boolean` */ type IsEmpty = T extends undefined ? true : T extends null ? true : IsWideType extends true ? boolean : IsEmptyObject extends true ? true : IsEmptyArray extends true ? true : IsEmptyString extends true ? true : false; //#endregion //#region src/boolean-logic/operators/compare/IsEqual.d.ts /** * **IsEqual**`` * * Type utility which tests whether two types -- `X` and `Y` -- are * exactly the same type. * * - if either `X` or `Y` are **any** then this test resolves to **false** * * **Alias:** `Equals` */ type IsEqual = Equals; /** * **Equals**`` * * Type utility which tests whether two types -- `X` and `Y` -- are * exactly the same type. * * - if either `X` or `Y` are **any** then this test resolves to **false** * * **Alias:** `IsEqual` */ type Equals = As<[IsAny] extends [true] ? false : [IsAny] extends [true] ? false : [X] extends [Y] ? [Y] extends [X] ? [X] extends [Container] ? [Keys$1] extends [Keys$1>] ? [Keys$1>] extends [Keys$1] ? TTrue : TFalse : TFalse : TTrue : TFalse : TFalse, TTrue | TFalse>; //#endregion //#region src/boolean-logic/operators/compare/IsLength.d.ts /** * **IsLength**`` * * Boolean type utility which returns true/false based on whether * the correct length for `T` is specified. */ type IsLength = T extends readonly unknown[] ? IfEqual, LEN, true, false> : false; //#endregion //#region src/boolean-logic/operators/compare/IsNot.d.ts /** * **IsNot**`` * * Ensures that `TTest` does not equal or extend `TCompare` * * - if `TTest` is a union with `TCompare` as an element of the union * then `TCompare` will be removed from the union * - if `TTest` is equal to `TCompare` then the type is converted to `never` * - in all other cases `TTest` remains unchanged */ type IsNot = IsUnion extends true ? UnionIncludes extends true ? Exclude : TTest : IsEqual extends true ? never : TTest; //#endregion //#region src/boolean-logic/operators/compare/IsNotEqual.d.ts /** * **NotEqual**`` * * Type utility which tests whether two types -- `X` and `Y` -- are _not_ exactly the same type */ type IsNotEqual = true extends IsEqual ? false : true; //#endregion //#region src/boolean-logic/operators/compare/IsNothing.d.ts /** * **IsNothing**`` * * Boolean operator which tests whether `T` is _nothing_ (aka., * `null` or `undefined`). */ type IsNothing = [T] extends [Nothing] ? true : false; //#endregion //#region src/boolean-logic/operators/compare/IsOptional.d.ts /** * Tests to see if `T` is a union type where one of the union members is * _undefined_. * * **Related:** `IsRequired` */ type IsOptional = IsUnion extends true ? Contains, undefined> extends true ? true : false : false; //#endregion //#region src/boolean-logic/operators/compare/IsRequired.d.ts /** * Tests to see if `T` is a union type and if it is, it validates that * none of the union members are _undefined_. * * - if `T` is explicitly typed as `undefined` this will report as **true**; * meaning it is required that it is of a certain type (aka, _undefined_) * * **Related:** `IsOptional` */ type IsRequired = Not>; //#endregion //#region src/boolean-logic/operators/compare/IsUnknown.d.ts /** * **IsUnknown**`` * * Tests whether a given `T` is of the **unknown** type. */ type IsUnknown = [IsNever] extends [true] ? false : [IsAny] extends [true] ? false : IsEqual extends true ? true : false; //#endregion //#region src/boolean-logic/operators/compare/IsUnset.d.ts /** * **IsUnset**`` * * Boolean operator which reports true/false on whether * `T` is the value `Unset`. */ type IsUnset = IsEqual; /** * **IsSet**`` * * Boolean operator which reports true/false on whether * `T` is the value `Unset`. * * **Related:** `IsUnset` */ type IsSet = IsEqual; //#endregion //#region src/boolean-logic/operators/compare/IsVueRef.d.ts /** * **IsVueRef**`` * * Boolean type utility that detects whether the type passed in * is a VueJS `Ref<...>` type or this library's `VueRef<...>` * (which serves as a lightweight proxy type for Vue's `Ref`). */ type IsVueRef = T extends object ? And<[Keys$1["length"] extends 2 ? true : false, "value" extends keyof T ? true : false]> extends true ? true : false : false; //#endregion //#region src/boolean-logic/operators/compare/NarrowlyContains.d.ts /** * **NarrowlyContains**`` * * Type utility which checks whether all elements in a tuple `TList` * **equal** the type contained in `TContains`.s * * @deprecated use `Contains` with "equals" operator for this * functionality. * * **Related:** `Contains`, `ContainsAll`, `ContainsSome` */ type NarrowlyContains = IsEqual, TContains> extends true ? true : [] extends AfterFirst ? false : NarrowlyContains, TContains>; //#endregion //#region src/boolean-logic/operators/compare/NotEqual.d.ts /** * **NotEqual**`` * * Boolean utility to determine whether two values are **not** equal. */ type NotEqual = IsEqual extends true ? false : true; //#endregion //#region src/boolean-logic/operators/compare/NotLength.d.ts /** * **NotLength**`` * * Boolean operator which detects whether `T` is _not_ a certain length. */ type NotLength = If, U>, true, false>; //#endregion //#region src/boolean-logic/operators/compare/SomeEqual.d.ts /** * **SomeEqual**`` * * A type utility which tests whether `TVal` is exactly equal to an array of values * stored in `TList`. Possible results are `true`, `false`. A wide `boolean` type * is not possible as equality operator can always be evaluated at design time. * * **See Also:** `SomeExtend` and `IfSomeEqual` */ type SomeEqual = Or<{ [K in keyof TList]: IsEqual }>; //#endregion //#region src/boolean-logic/operators/compare/SomeExtend.d.ts type SomeAcc = [] extends TList ? false : If, TExtend>, true, SomeAcc, TExtend>>; /** * **SomeExtend**`` * * Boolean util which checks whether **some** of the elements * in `TList` _extend_ `TExtend`. */ type SomeExtend = SomeAcc; //#endregion //#region src/boolean-logic/operators/containers/AllStringLiterals.d.ts /** * **AllStringLiterals**`` * * Boolean operator which checks whether **all** of the * passed in elements are _string literals_. */ type AllStringLiterals = And<{ [K in keyof T]: IsStringLiteral }>; //#endregion //#region src/boolean-logic/operators/containers/DistinguishEmptyTypes.d.ts /** * **IsStrictEmptyObject**`` * * Distinguishes between `EmptyObject` (wide type) and `ExplicitlyEmptyObject` (narrow type) * even when `IsEqual` returns true due to TypeScript's structural typing. * * Returns: * - `"empty"` for `EmptyObject` (can have properties added) * - `"explicit"` for `ExplicitlyEmptyObject` (cannot have properties) * - `"other"` for any other type */ /** * **CanHaveProperties**`` * * Checks if a type allows properties to be added to it. * This distinguishes `EmptyObject` from `ExplicitlyEmptyObject`. * * - `EmptyObject` → `true` (properties can be added) * - `ExplicitlyEmptyObject` → `false` (no properties allowed) */ type CanHaveProperties = T extends object ? T & { __test: unknown; } extends never ? false : true : false; /** * **IsExplicitlyEmptyObject**`` * * Specifically checks if a type is `ExplicitlyEmptyObject` or has the same structure. * This works by checking for never index signatures. */ type IsExplicitlyEmptyObject = T extends object ? T extends { [x: string]: never; [x: symbol]: never; } ? keyof T extends never ? true : false : false : false; /** * **IsWideEmptyObject**`` * * Checks if a type is `EmptyObject` (the wide type that accepts any object). * Distinguishes it from `ExplicitlyEmptyObject`. */ type IsWideEmptyObject = T extends EmptyObject ? IsExplicitlyEmptyObject extends true ? false : true : false; /** * **EmptyObjectKind**`` * * Categorizes empty object types into specific kinds. * * Returns: * - `"wide"` for `EmptyObject` (NonNullable) * - `"explicit"` for `ExplicitlyEmptyObject` (never index signatures) * - `"literal"` for literal empty object `{}` * - `"not-empty"` for other types */ type EmptyObjectKind = T extends object ? keyof T extends never ? T extends { [x: string]: never; [x: symbol]: never; } ? "explicit" : T extends EmptyObject ? "wide" : "literal" : "not-empty" : "not-empty"; /** * **AcceptsProperties**`` * * Alternative check to see if a type accepts new properties. * Uses index signature compatibility. */ type AcceptsProperties = T extends { [x: string]: any; } ? true : T extends object ? EmptyObject extends T ? true : false : false; /** * **IsNeverIndexed**`` * * Checks if a type has never index signatures (like ExplicitlyEmptyObject). */ type IsNeverIndexed = T extends { [x: string]: never; } ? T extends { [x: symbol]: never; } ? true : false : false; /** * **DistinguishEmpty**`` * * Main utility to distinguish between different empty object types. * Provides a detailed classification even when IsEqual returns true. */ type DistinguishEmpty = T extends object ? { kind: EmptyObjectKind; canHaveProperties: CanHaveProperties; isNeverIndexed: IsNeverIndexed; acceptsProperties: AcceptsProperties; isExplicitlyEmpty: IsExplicitlyEmptyObject; isWideEmpty: IsWideEmptyObject; } : { kind: "not-object"; canHaveProperties: false; isNeverIndexed: false; acceptsProperties: false; isExplicitlyEmpty: false; isWideEmpty: false; }; //#endregion //#region src/boolean-logic/operators/containers/HasArray.d.ts type _HasArray = [] extends TList ? false : IsArray> extends true ? true : _HasArray>; /** * **HasArray**`` * * Checks whether a list of items includes an _array_ (tuple or wide array type) within it. */ type HasArray = _HasArray; //#endregion //#region src/boolean-logic/operators/containers/HasFunctionKeys.d.ts /** * **HasTypedFunctionKeys** * * A type operator which tests whether `T` is a dictionary and * whether `K` keys are typed functions. * * **Related:** `HasFunctionKeys` */ type HasTypedFunctionKeys = [] extends K ? true : First$1 extends keyof T ? T[First$1] extends TypedFunction ? HasTypedFunctionKeys> : false : false; /** * **HasFunctionKeys** * * A type operator which tests whether `T` is a dictionary and * whether `K` keys are functions. * * **Related:** `HasTypedFunctionKeys` */ type HasFunctionKeys = [] extends K ? true : First$1 extends keyof T ? T[First$1] extends AnyFunction ? HasFunctionKeys> : false : false; //#endregion //#region src/boolean-logic/operators/containers/HasIndex.d.ts /** * **HasIndex**`` * * Boolean operator that tests whether `TContainer` has the * index value `TIdx`. */ type HasIndex = TContainer extends Container ? TIdx extends keyof TContainer ? true : false : false; //#endregion //#region src/boolean-logic/operators/containers/HasProp.d.ts /** * **HasProp** * * Boolean operator which returns true or false (by default) based * on whether `TTest` has a property defined by `TProp`. * * If you wish to change the true/false values you can override * the `Tif` and `TElse` generics. */ type HasProp = TTest extends object ? TProp extends keyof TTest ? TIf : TElse : TElse; //#endregion //#region src/boolean-logic/operators/containers/HasRequiredProps.d.ts /** * **HasRequiredProps**`` * * Receives `T` and returns true/false based on whether * the `T` is an object _and_ has at least one required property on it. */ type HasRequiredProps = IsWideObject extends true ? boolean : [RequiredKeysTuple["length"]] extends [0] ? false : true; //#endregion //#region src/boolean-logic/operators/containers/HasSameKeys.d.ts /** * **AsTuple**`` * * Type utility which ensures that `T` is tuple value * encapsulating it as a single item array if it is a * non-array type. * * **Related:** `AsArray` */ type AsTuple$1 = T extends Tuple$1 ? T : T extends unknown[] ? readonly [...T] : If, readonly [], readonly [T]>; type Process$77 = And<{ [K in keyof A]: K extends keyof B ? true : false }>; type _Keys$2 = UnionToTuple> extends readonly ObjectKey[] ? UnionToTuple> : never; /** * **HasSameKeys**`` * * Boolean operator which compares two lists to see if they have the same keys. */ type HasSameKeys = IsTuple extends true ? IsTuple extends true ? AsTuple$1["length"] extends AsTuple$1["length"] ? Process$77, AsTuple$1> : false : false : DoesExtend extends true ? DoesExtend extends true ? _Keys$2["length"] extends _Keys$2["length"] ? HasSameValues<_Keys$2, _Keys$2> : false : false : false; //#endregion //#region src/boolean-logic/operators/containers/HasSameValues.d.ts type CheckAllExist = [] extends A ? true : And<{ [K in keyof A]: NarrowlyContains }>; type Test$8 = A extends readonly unknown[] ? B extends readonly unknown[] ? [] extends A ? [] extends B ? true : false : [] extends B ? false : A["length"] extends B["length"] ? CheckAllExist extends true ? CheckAllExist extends true ? true : false : false : false : false : false; /** * **HasSameValues**`` * * Boolean type utility which determines if the values in * `TContainer` and `TComparator` are the same (even if the order * is different). * * #### Wide Types * * - if _either_ `TContainer` or `TComparator` are wide types then * this utility will evaluate to `boolean` rather than the typical `true` * or `false` literals * * #### `any` and `never` * * - if _either_ `TContainer` or `TComparator` or _both_ are equal to * `never` or `any` then this utility will resolve to `TException` (which * defaults to being `false`)! */ type HasSameValues = [IsAny] extends [true] ? TException : [IsNever] extends [true] ? TException : [IsAny] extends [true] ? TException : [IsNever] extends [true] ? TException : Test$8>, Values>> extends true ? TContainer extends readonly unknown[] ? TComparator extends readonly unknown[] ? IsEqual, GetOptionalElementCount> : false : TContainer extends Dictionary ? TComparator extends Dictionary ? IsEqual>, GetOptionalElementCount>> : false : never : TException; //#endregion //#region src/boolean-logic/operators/containers/IsArray.d.ts /** * **IsArray** * * Boolean utility which tests for whether `T` is an array ( * both a mutable array or a readonly array) */ type IsArray = [T] extends [any[]] ? true : [T] extends [readonly any[]] ? true : false; //#endregion //#region src/boolean-logic/operators/containers/IsContainer.d.ts /** * **IsContainer**`` * * Boolean operator which detects whether `T` is a "container" where a * container is any object or array. */ type IsContainer = [IsNever] extends [true] ? false : [T] extends [null | undefined] ? false : [T] extends [AnyFunction] ? false : [T] extends [readonly any[]] ? true : [T] extends [object] ? true : false; //#endregion //#region src/boolean-logic/operators/containers/IsDictionary.d.ts type IsDictionary = T extends Dictionary ? Not> : false; //#endregion //#region src/lists/AfterFirst.d.ts /** * **AfterFirst**`` * * returns the elements in an array _after_ the first element */ type AfterFirst = T extends readonly [unknown, ...unknown[]] ? T extends readonly [unknown, ...infer Rest] ? readonly [...Rest] : never : T extends unknown[] ? [] : T extends [unknown, ...infer Rest] ? Rest : []; //#endregion //#region src/lists/AppendToLast.d.ts /** * **AppendToLast**`` * * Appends some text `TAppend` to the last element of `TList`. */ type AppendToLast = TList extends readonly [...infer LeadIn extends readonly string[], infer Last extends string] ? [...LeadIn, `${Last}${TAppend}`] : [TAppend]; //#endregion //#region src/lists/ArrayElementType.d.ts /** * **ArrayElementType**`` * * Determines what type the elements in an array are. * ```ts * // string * type T = ArrayElementType; * ``` */ type ArrayElementType = IsEmptyContainer extends true ? [...T][0] : Widen>; //#endregion //#region src/lists/AsArray.d.ts type NonArrayMembers = NotFilter extends infer Members extends readonly unknown[] ? Members[number] : never; type ArrayMembers = { [K in keyof T]: T[K] extends readonly (infer Kind)[] ? As[]> : never }[number]; /** * **AsArray**`` * * Type utility which ensures that `T` is an array by: * * - encapsulating it as a single item array if it is a * non-array type (but not _undefined_). * - converting a union type into a tuple (unless it contains undefined) * - if `T` is undefined then it is converted to an empty array `[]` * - if `T` was already an array then it is just proxied through * - if `T` is a union then non array elements are converted to array types */ type AsArray = [IsAny] extends [true] ? unknown[] : [IsNever] extends [true] ? [] : [IsUnknown] extends [true] ? unknown[] : [T] extends [readonly (infer Kind)[]] ? As[]> : [IsUndefined] extends [true] ? [] : [IsUnion] extends [true] ? [UnionToTuple] extends [infer Tuple extends readonly unknown[]] ? Expand> | ArrayMembers> : never : IsUndefined extends true ? [] : [T]; //#endregion //#region src/lists/AsNumericArray.d.ts /** * Simple filter approach to avoid RemoveNever complexity */ type FilterNumeric = T extends readonly [infer Head, ...infer Tail] ? Head extends number ? FilterNumeric : Head extends `${infer N extends number}` ? FilterNumeric : FilterNumeric : Result; /** * **AsNumericArray**`` * * Converts into a numeric array: * * - `number` values are proxied through * - `${number}` values are converted to a number * - all other types are converted to `never` and removed */ type AsNumericArray = T extends readonly unknown[] ? FilterNumeric : never; //#endregion //#region src/lists/BeforeLast.d.ts /** * **BeforeLast**`` * * Returns: * * - the _elements_ in an **array**; _excluding_ the last element * - the _characters_ in a **string** excluding the last character * * This behavior is _very_ much like `Pop` but where `Pop` will * return _never_ when an empty input is passed in, this utility returns * the "empty" state: * * - a _tuple_ will return `[]` * - a _string_ will return "" * * **Related:** `Pop`, `Last`, `AfterFirst`, `First` */ type BeforeLast = [T] extends [string] ? string extends T ? string : IsEqual extends true ? "" : Pop> extends infer Leading extends readonly string[] ? Concat : never : [T] extends [readonly unknown[]] ? T extends readonly [...infer Leading, unknown] ? Leading : [] : never; //#endregion //#region src/lists/ConvertAndMap.d.ts /** * **ConverterDefn**`` * * A conversion definition which has wide types for keys and * callback functions to call when a particular type is provided * as input. */ interface ConverterDefn { string: (v: T) => TStr; number: (v: T) => TNum; boolean: (v: T) => TBool; object: (v: T) => TObj; tuple: (v: T) => TTuple; nothing: (v: T) => TNothing; } type ConverterKeys = UnionToTuple>>; type ConverterInputType = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "object" ? Record : unknown; type ConverterInputUnion = [] extends TRemaining ? TConverted : ConverterInputUnion<[...TConverted, ConverterInputType>], AfterFirst>; /** * **AvailableConverters** * * Type utility which will produce the correct union type for a "converter" */ type AvailableConverters = ConverterKeys extends readonly string[] ? TupleToUnion>> : never; type Conversion = (input: T) => TOutput; type ConverterCoverage = "string" | "number" | "boolean" | "object"; /** * Extracts the coverage provided by a `StrongMap` as a Tuple */ type MapCoverage> = T extends StrongMap ? UnionToTuple : never; type StrongMapTypes = [] extends K ? never : TupleToUnion<[First$1 extends "string" ? TupleToUnion<[string, ...UnionToTuple>>]> : First$1 extends "number" ? TupleToUnion<[number, ...UnionToTuple>>]> : First$1 extends "boolean" ? TupleToUnion<[boolean, ...UnionToTuple>>]> : First$1 extends "object" ? TupleToUnion<[Record, ...UnionToTuple>>]> : never, ...UnionToTuple>>]>; interface StrongMap { string: TDefined extends "string" ? (v: T) => R : never; number: TDefined extends "number" ? (v: T) => R : never; boolean: TDefined extends "boolean" ? (v: T) => R : never; object: TDefined extends "object" ? , R>(v: T) => R : never; } type StrongMapTransformer = >[]>(tuple: T) => { [K in keyof T]: T[K] extends string ? M["string"] extends ((...args: unknown[]) => unknown) ? ReturnType : never : T[K] extends number ? M["number"] extends ((...args: unknown[]) => unknown) ? ReturnType : never : T[K] extends boolean ? M["boolean"] extends ((...args: unknown[]) => unknown) ? ReturnType : never : T[K] extends Record ? M["object"] extends ((...args: unknown[]) => unknown) ? ReturnType : never : never }[keyof T]; //#endregion //#region src/lists/EachAsString.d.ts type EachAsString = { [K in keyof T]: T[K] extends string ? T[K] : T[K] extends number ? `${T[K]}` : T[K] extends boolean ? `${T[K]}` : T[K] extends AnyObject ? ObjectToString : T[K] extends readonly any[] ? ToJsonArray : T[K] extends Map ? `Map<${AsString},${AsString}>` : "" }; //#endregion //#region src/lists/ElementOf.d.ts /** * **ElementOf**`` * * Pulls the type of an array's element out of the array type itself. */ type ElementOf = T extends (infer U)[] ? U : never; //#endregion //#region src/lists/ExcludeIndex.d.ts type _ExcludeIndexHelper = TList extends readonly [infer First, ...infer Rest] ? Count["length"] extends TIdx[number] ? _ExcludeIndexHelper : _ExcludeIndexHelper : Output; /** * **ExcludeIndex****`` * * Given a tuple `TList` and a singular index or tuple of indices `TIdx`, * returns a new tuple with the elements at those indices removed. */ type ExcludeIndex = _ExcludeIndexHelper, readonly number[]>, [], []>; //#endregion //#region src/lists/Filter.d.ts type Process$76[], TOp extends ComparisonOperation, TParams extends readonly unknown[]> = RemoveMarked<{ [K in keyof TList]: Compare extends true ? TList[K] : Marked$2 }>; /** * **Filter**`` * * Allows a known tuple `TList` to be reduced to just those elements which * _extend_ type `TFilter`. * * - `TFilter` can be single value, an array of values, or even no values at all * - the number of parameters is dictated by the operation * - if _either_ zero or one parameters are required you may also just * express the first parameter outside of array syntax. * * **Related:** `NotFilter` * * ```ts * // [1,2,3] * type Num = Filter<[1,2,3,"foo","bar"], "extends", number>; * ``` */ type Filter[], TOp extends ComparisonOperation, TParams extends readonly unknown[]> = Process$76; //#endregion //#region src/lists/FilterEmptyString.d.ts /** * **FilterEmptyStrings**`` * * Filters out any empty strings found in the tuple `T`. * * **Related:** `FilterEmptyStringsInTerminalPosition`, `Filter` */ type FilterEmptyStringsImpl = T extends [infer Head, ...infer Rest extends readonly unknown[]] ? Depth["length"] extends 128 ? readonly unknown[] : Head extends "" ? FilterEmptyStringsImpl : FilterEmptyStringsImpl : R; type FilterEmptyStrings = FilterEmptyStringsImpl<[...T]>; type EmptyTailCount, C extends readonly unknown[] = []> = R extends [infer Head, ...infer Rest extends readonly unknown[]] ? Head extends "" ? EmptyTailCount : C["length"] : C["length"]; /** * **FilterEmptyStringsInTerminalPosition**`` * * Removes all _leading_ or _trailing_ empty strings found in `T` * while keeping empty strings that exist in the interior. * * ```ts * // [ 1,2,"",3 ] * type T = FilterEmptyStringsInTerminalPosition<["",1,2,"",3,"",""]>; * ``` * * **Related:** `FilterEmptyStrings`, `Filter` */ type FilterEmptyStringsInTerminalPositionImpl = T extends [infer Head, ...infer Rest extends readonly unknown[]] ? Head extends "" ? R extends [] ? FilterEmptyStringsInTerminalPositionImpl : FilterEmptyStringsInTerminalPositionImpl : FilterEmptyStringsInTerminalPositionImpl : Slice>>; type FilterEmptyStringsInTerminalPosition = FilterEmptyStringsInTerminalPositionImpl<[...T]>; //#endregion //#region src/lists/Find.d.ts type FindAcc)[], TOp extends ComparisonOperation, TParams extends GetComparisonParams> = [] extends TList ? undefined : First$1 extends ComparisonAccept ? [Compare, TOp, TParams>] extends [true] ? First$1 : FindAcc, TOp, TParams> : never; /** * **Find**`` * * Type utility used to find the first value in `TList` which _equals_ `TValue`. * Will return _undefined_ if no matches found. * * - use **FindExtends** if you want a more permissive match * - by default, values in `TList` will be compared directly but you can _dereference_ * array and object properties with `TIndex` if you want to compare on a child property * * ```ts * type List = [ { id: 1, value: "hi" }, { id: 2, value: "bye" } ] * // { id: 1; value: "hi" } * type T = Find * ``` */ type Find$1> = TList extends readonly ComparisonAccept[] ? FindAcc : undefined; //#endregion //#region src/lists/FindMaxLength.d.ts type Reduce = [] extends T ? TVal : Reduce, First$1 extends [string, infer Len extends number] ? If, Len, TMax> : TMax, First$1 extends [infer Val extends string, infer Len extends number] ? If, Val, TVal> : TVal>; /** * **FindMaxLength**`` * * Utility which reduces a tuple of strings to only the * string which is longest. */ type FindMaxLength = T extends readonly string[] ? Reduce<{ [K in keyof T]: T[K] extends string ? [T[K], StrLen] : never }> : never; //#endregion //#region src/lists/First.d.ts /** * **First**`` * * Returns the _first_ type in a list. If `TElse` is provided it will set * the type to `TElse` when: * - `T` is a Tuple type * - `T[1]` is not a valid index of `T` * - by default `TElse` is set to _never_ * * **Related:** `Second`, `Last` */ type First$1 = T extends readonly unknown[] ? T[0] extends T[number] ? T[0] : ELSE : never; //#endregion //#region src/lists/FirstString.d.ts /** * Returns the first `string` value from an array of values */ type FirstString = T extends [infer S, ...unknown[]] ? S extends string ? S : never : never; //#endregion //#region src/lists/Flatten.d.ts type ToFlat = IsArray extends true ? As : IsUnion extends true ? UnionHasArray extends true ? [FlattenUnion] : [T] : [T]; type FlatPass = [] extends TList ? TResult : FlatPass, [...TResult, ...ToFlat>]>; /** * Processes Tuple structures. * * - Each pass will start by validating that `TList` still has * either Tuples within it or values which are Tuples * - Assuming it does */ type FlattenTuple = TLevel extends 0 ? TList : Or<[HasUnionType, HasArray]> extends true ? FlattenTuple, Decrement> : TList; type Iterate$7 = TupleToUnion<{ [K in keyof T]: T[K] extends readonly unknown[] ? Flatten : T[K] }>; type FlattenUnion = IsUnion extends true ? Iterate$7, 1> : TValue; type WideFlatten = T extends (infer Type)[] ? Type extends unknown[] ? Type : T : never; /** * Responsible for branching the flattening operation * to either `_Flat`, `WideFlatten` for Tuples or Arrays * and `FlattenUnion` for a union type. * * Just returns `TList` "as is" if it's not a a Tuple or * Union type. */ type Process$75 = TList extends readonly unknown[] ? IsTuple extends true ? FlattenTuple : WideFlatten : IsUnion extends true ? FlattenUnion : TList; /** * converts a wide array to a scalar and tuple * to a union type */ type ToScalar = [IsTuple>] extends [true] ? TupleToUnion> : Process$75 extends (infer Type)[] ? Type : never; type IterateScalar = TupleToUnion<{ [K in keyof T]: T[K] extends unknown[] ? ToScalar : T[K] }>; /** * **Flatten**`` * * - where `TList` is an array, this utility will flatten the array to a depth of * `TLevel` (by default one level). * - where `TList` is a _union type_ it will flatten any of it's elements * - where `TList is neither an array nor has a union type which is, this utility * simply proxies the value `TList` through * - in most cases you would not _flatten_ below a single dimensional array but * if you set `ToScalar` to `true` then it will flatten right out of being an array * into a union type */ type Flatten = [ToScalar] extends [false] ? Process$75 : [IsUnion>] extends [true] ? IterateScalar>, TLevel> : [IsTuple>] extends [true] ? TupleToUnion> : Process$75 extends (infer Type)[] ? Type : never; //#endregion //#region src/lists/FromCsv.d.ts /** drops/skips empty rows */ type DropEmptyRows = T extends [infer Head extends readonly string[], ...infer Rest extends readonly string[][]] ? Head extends [""] ? DropEmptyRows : DropEmptyRows, readonly string[][]>> : R; /** * handles the parsing for a `string [][]` output */ type Multi, TResult extends readonly string[][] = []> = TRows extends readonly [infer Head extends string, ...infer Rest extends readonly string[]] ? Split extends infer Cols extends readonly string[] ? Multi>, readonly string[][]>> : never : DropEmptyRows; type BuildKv = EmptyObject> = TCols extends [infer Head extends string, ...infer Rest extends readonly string[]] ? BuildKv, TResult & Record>> : As, Record>; type Kv>, TResult extends Record[] = []> = TRows extends readonly [infer Row extends string, ...infer Rest extends readonly string[]] ? TrimEach> extends infer ColData extends readonly string[] ? ColData extends readonly [""] ? Kv : Kv]> : never : TResult; /** * **FromCsv**`` * * Takes a string containing CSV data and converts it into * either: * * 1. a multidimensional array of data in rows by columns format * 2. an array of key/value dictionaries where the _keys_ are the * column names for a given row * * The second output type will only work if the first row of data * has column names in it. * * - the optional `TResolve` parameter can be set to `true` (the * default is `false`) and when it is then `NumberLike` values * will be converted to numbers and `BooleanLike` values will * be converted to their boolean counterparts. */ type FromCsv = string extends TCsv ? TFormat extends "[][]" ? string[][] : Record[] : TFormat extends "[][]" ? As, string[][]> : TFormat extends "KV[]" ? Split extends infer Rows extends readonly string[] ? Kv, AfterFirst> : never : never; //#endregion //#region src/lists/GetEach.d.ts type Process$74 = RemoveNever<{ [K in keyof TList]: TList[K] extends Container | TypedFunction | Error ? Get : TList[K] extends TypedFunction ? Get, TKey, TDefault> : TKey extends "." ? TList[K] : never }>; /** * **GetEach**`` * * Type utility which receives a list of types -- `TList` -- and then _gets_ a * key `TKey` (using dot syntax) from each element in the array. * * - if a given element is not an object then it is excluded from the result set * - values which evaluate to _undefined_ are also removed from the result set * - if either `null` or "" are used for `TKey` then this simply proxies `TList` * through * * ```ts * // ["Bob", "Wendy"] * type T = GetEach<[ * { name: "Bob", age: 12 }, * { name: "Wendy", age: 24 } * ], "name"> * ``` */ type GetEach = TKey extends null ? TList : TKey extends "" ? TList : Process$74<[...TList], Exclude, TDefault> extends readonly unknown[] ? Process$74<[...TList], Exclude, TDefault> : never; //#endregion //#region src/lists/IndexOf.d.ts type Override$1 = TOverride extends Constant<"no-override"> ? TValue : TValue extends Error ? TOverride : TValue; type NegativeIndex = TDepth["length"] extends TPositive ? TValue extends readonly [infer Head, ...readonly unknown[]] ? Head : Err<"invalid-index", `Use of a negative index [${AsString}] was unsuccessful in matching a valid index`, { container: TValue; key: TIdx; revIndex: TPositive; revContainer: Reverse; }> : TValue extends readonly [unknown, ...infer Rest] ? NegativeIndex : If, TValue[TPositive], Err<"invalid-index", `Use of a negative index [${AsString}] was unsuccessful in matching a valid index`, { container: TValue; key: TIdx; revIndex: TPositive; revContainer: Reverse; }>>; type HandleArr = TIdx extends number ? IsNegativeNumber extends true ? NegativeIndex, TIdx> : If, TValue[TIdx], Err<"invalid-index", Concat<["Attempt to index [", ToString, "] into a non-container type!"]>, { container: TValue; key: TIdx; library: "inferred-types/constants"; }>> : Err<"invalid-index", `IndexOf}> failed because a tuple container must use numeric indexes!`, { container: TValue; key: TIdx; library: "inferred-types/constants"; }>; type HandleObj = TIdx extends keyof TValue ? TValue[TIdx] : Err<"invalid-index", Concat<["Attempt to index [", ToString, "] into a non-container type!"]>, { container: TValue; key: TIdx; library: "inferred-types/constants"; }>; type Process$73 = If, TValue, TValue extends readonly unknown[] ? If>, HandleArr>, Err<"invalid-index", `Call to IndexOf,${AsString}> is not allowed as an tuple based container must receive either null or numeric index value.`, { library: "inferred-types/constants"; container: TValue; key: TIdx; }>> : TValue extends Dictionary ? TIdx extends ObjectKey ? HandleObj : Err<"invalid-index", `Call to IndexOf,${AsString}> is not allowed as an object based container must receive either null, a string, or a symbol index value.`, { library: "inferred-types/constants"; container: TValue; key: TIdx; }> : Err<"invalid-index", `IndexOf,${AsString}> was called but a non-null value was used to index a non-container which will never work!`, { library: "inferred-types/constants"; container: TValue; key: TIdx; }>>; /** * **IndexOf** * * A type utility which _dereferences_ a property/index item on an array * or object. * * - if `TIdx` is passed in as `null` then this will act as an identity * function and return `TValue`. * - if `TIdx` is a negative number it will index in reverse for tuple based * containers * * **Related:** `Get`, `IsValidIndex` * * **Errors:** produces an Error when an a bad index value * is passed in for the given container */ type IndexOf> = TIdx extends null ? TValue : Override$1>, TOverride>; //#endregion //#region src/lists/Last.d.ts /** * **Last**`` * * Returns the _last_ element in a list of elements. * * - by default `TEmpty` is _never_ but this can be changed. */ type Last$1 = IfLength extends readonly unknown[] ? TContent[AfterFirst["length"]] extends TContent[number] ? TContent[AfterFirst["length"]] : TEmpty : TEmpty>>; //#endregion //#region src/lists/LogicalReturns.d.ts type Process$72 = { [K in keyof TValues]: TValues[K] extends ((...args: any[]) => boolean) ? ReturnType : TValues[K] }; /** * **LogicalReturns**`` * * Given a known tuple of values, this utility will reduce it to * another tuple of items which are either a _boolean type_ or a function * with a boolean return. In the latter case the function's return value * will be represented in the Tuple. * * **Related**: `ReturnTypes` and `TruthyReturns` */ type LogicalReturns = Process$72 extends readonly boolean[] ? Process$72 : never; //#endregion //#region src/lists/Longest.d.ts type StringToTuple = T extends `${string}${infer Rest}` ? StringToTuple : TResult; type IsLonger$1 = StringToTuple extends infer ATuple extends readonly string[] ? StringToTuple extends infer BTuple extends readonly string[] ? ATuple extends readonly [...BTuple, unknown, ...readonly unknown[]] ? true : false : false : false; type Process$71 = T extends [infer Head extends string, ...infer Rest extends readonly string[]] ? Process$71 extends true ? TResult extends string ? IsLonger$1 extends true ? Head : TResult : Head : TResult> : TResult extends Unset ? string : TResult; /** * **Longest**`` * * Takes a tuple of strings and returns the longest one in the tuple. * * - if more than one string is _tied_ for being longest then * the **first** one found will be returned. * - if _all_ elements passed in were wide then the result will be `string` * - if _some_ of the elements passed in were wide then they will be * ignored and only the literal strings will be compared */ type Longest = Process$71; //#endregion //#region src/lists/MakeOptional.d.ts type Process$70 = TInput extends readonly [infer Head extends unknown, ...infer Rest extends readonly unknown[]] ? Depth["length"] extends 128 ? readonly unknown[] : IsGreaterThan extends true ? Process$70, { required: TOutput["required"]; optional: [...TOutput["optional"], Head]; }, [unknown, ...Depth]> : Process$70, { required: [...TOutput["required"], Head]; optional: TOutput["optional"]; }, [unknown, ...Depth]> : [...TOutput["required"], ...Partial]; /** * **MakeOptional**`` * * Take a tuple `T` and makes the last `U` elements _optional_ with the * `?` optional modifier. * * ```ts * // [ string, number, string? ] * type Test = MakeOptional<[string, number, string], 1>; * ``` * * **Note:** * - the mix of optional vs. required elements in `T` has no bearing on * the outcome. * * **Related:** `MakeKeysOptional` */ type MakeOptional = Subtract["length"], U> extends infer Req extends number ? number extends Req ? never : Process$70, Req> : never; type MakeRequired = Process$70, U>; //#endregion //#region src/lists/MapTo.d.ts type ElseOps = "never" | "proxy" | "false" | "true" | "boolean" | "unknown"; type Convert$12> = { [K in keyof TList]: TList[K] extends TTriggers ? Find$1 extends [any, infer Type] ? Type : never : TElse extends "proxy" ? TList[K] : TElse extends "false" ? false : TElse extends "true" ? true : TElse extends "boolean" ? boolean : TElse extends "unknown" ? unknown : TElse extends "never" ? never : never }; /** * **ArrayTo**`` * * Converts elements of TList which match the _first element_ of `TMap` to the type in the _second element_ * of `TMap`. * * - by default items not expressly remapped in `TMap` will by proxied through "as is" * - you can optionally, set `TElse` to: `never`, `false`, `true`, `boolean`, or `unknown` */ type ArrayTo = Convert$12; //#endregion //#region src/lists/NotFilter.d.ts type Process$69[], TOp extends ComparisonOperation, TParams extends readonly unknown[]> = RemoveMarked<{ [K in keyof TList]: [Compare] extends [false] ? TList[K] : Marked$2 }>; /** * **NotFilter**`` * * Performs the same task as `Filter` but with the opposite results. * * - when elements are evaluated to `true` on their comparison operation * they are _removed_ * * **Related:** `Filter` * * ```ts * // ["foo","bar"] * type NotNum = NotFilter<[1,2,3,"foo","bar"], "extends", number>; * ``` */ type NotFilter[], TOp extends ComparisonOperation, TParams extends readonly unknown[]> = Process$69; //#endregion //#region src/lists/NumericKeys.d.ts type IndicesTuple = number extends T["length"] ? number[] : T extends readonly [any, ...infer R] ? IndicesTuple : Acc; /** * **NumericKeys**<`TList`> * * Will provide a tuple of numeric keys for * a literal array and `number[]` for a wide array. * * ```ts * type Arr = ["foo", "bar", "baz"]; * // readonly [0, 1, 2] * type T = NumericKeys; * ``` * * **Related:** `NumericKeys__Union`, `Keys`, `ObjectKeys` */ type NumericKeys = HasVariadicTail extends true ? DropVariadicTail extends infer NonVariadic extends readonly unknown[] ? IndicesTuple extends infer NonVariadic extends readonly unknown[] ? [...NonVariadic, ...number[]] : never : never : IndicesTuple; //#endregion //#region src/lists/optional/TakeOptionalElements.d.ts /** * **TakeOptionalElements**`` * * Returns only the **optional** elements in `T`. * * **Related:** `TakeOptionalElements` */ type TakeOptionalElements = HasOptionalElements extends true ? SliceArray> extends infer Offset extends number ? Offset : never> : T; //#endregion //#region src/lists/optional/TakeRequiredElements.d.ts /** * **TakeRequiredElements**`` * * Returns only the **required** elements in `T`. * * **Related:** `TakeOptionalElements` */ type TakeRequiredElements = HasOptionalElements extends true ? SliceArray> : T; //#endregion //#region src/lists/Pop.d.ts type _Pop = TVal extends [...(infer Rest), unknown] ? Rest : []; type AdjustVariadic< /** the list of elements with any variadic elements removed */TList extends readonly unknown[], /** the original array which we'll use to detect variadic properties */TOrigin extends readonly unknown[], /** the element which was just removed */TRemoved, TType = (VariadicType extends (infer Base)[] ? Base : never)> = IsVariadicArray extends true ? TRemoved extends TType ? [...TList, ...TType[]] : [...TList, ...TType[]] | [...TList, TRemoved, ...TType[]] : TList; /** * **Pop**`` * * Removes the last element of a list. * ```ts * // [1,2] * type T = Pop<[1,2,3]>; * ``` * * - to provide additional utility, you can also pass * in a string literal and get back the literal with the last * character removed. * - when popping an empty tuple/array, the type remains `[]` */ type Pop = TList extends readonly unknown[] ? IsWideArray extends true ? TList : DropVariadic> extends [...infer NewList extends readonly [unknown, ...unknown[]], infer Removed] ? HasOptionalElements extends true ? TupleMeta["optionalElementCount"] extends infer Optional extends number ? IsGreaterThan, 0> extends true ? MakeOptional> extends infer Next extends readonly unknown[] ? AdjustVariadic), TList, Removed> : never : NewList | Pop : NewList | Pop : AdjustVariadic : [] : TList extends string ? IsWideType extends true ? string : IsStringLiteral extends true ? TList extends string ? TList extends "" ? "" : Chars extends readonly string[] ? Concat<_Pop>> : never : never : string : _Pop>; //#endregion //#region src/lists/Push.d.ts type Process$68 = [...TList, TValue]; /** * **Push**`` * * Pushes a value `TVal` onto an existing list `TList`. * * - If you want to make the push conditional you can add `TCondition` */ type Push = [TCondition] extends [true] ? As, readonly unknown[]> : TList; //#endregion //#region src/lists/ReplaceLast.d.ts /** * **ReplaceLast**`` * * Replaces the _last_ element of `TList` with the value of `TVal`. * * **Related:** `AppendToLast` */ type ReplaceLast = Pop extends readonly unknown[] ? [...Pop, TVal] : never; //#endregion //#region src/lists/RetainLiterals.d.ts type Process$67 = RemoveMarked<{ [K in keyof T]: If, T[K], Constant<"Marked">> }>; /** * **RetainLiterals**`` * * Receives a tuple of items and keeps only the literal types * (e.g., object, number, string, Record, boolean, etc.). * * All literal types and elements such as _undefined_ and `null` are removed. * * **Related:** `Retain`, `FilterLiterals`, `RetainWideTypes` */ type RetainLiterals = Process$67 extends readonly unknown[] ? Process$67 : never; //#endregion //#region src/lists/RetainWideTypes.d.ts type Process$66 = RemoveMarked<{ [K in keyof T]: If, T[K], Constant<"Marked">> }>; /** * **RetainWideTypes**`` * * Receives a tuple of items and keeps only the "wide types" * (e.g., object literals, tuple literals, string literals, * numeric literals, and boolean literals). * * All wide types and elements such as _undefined_ and `null` are removed. * * **Related:** `Retain`, `RetainLiterals`, `FilterWideTypes` */ type RetainWideTypes = Process$66 extends readonly unknown[] ? Process$66 : never; //#endregion //#region src/lists/ReturnTypes.d.ts /** * **ReturnTypes**`` * * Given any Tuple, this utility will return a _union_ type * that represents all the possible _return types_ from functions found * in the array. Non-function types will be ignored as will functions * which don't return a boolean value. * * **See Also**: `LogicalReturns`, `TruthyReturns` */ type ReturnTypes = { [K in keyof T]: T[K] extends TypedFunction ? ReturnType extends boolean ? ReturnType : never : never }; //#endregion //#region src/lists/Reverse.d.ts type RevAcc = TInput extends [infer Head, ...infer Rest] ? RevAcc : TResults; /** * **Reverse**`` * * Reverses the order of a `Tuple` or a `string`. * * **Note:** * - to ensure all elements are retained while **not** breaking the rules * regarding _optional_ elements not being allowed to precede _required_ ones * we convert all elements to **required** rather than risk losing elements. */ type Reverse = T extends readonly unknown[] ? RevAcc> : T extends string ? Join>> : never; //#endregion //#region src/lists/Second.d.ts /** * **Second**`` * * Returns the _second_ type in a list. If `TElse` is provided it will set * the type to `TElse` when: * - `T` is a Tuple type * - `T[1]` is not a valid index of `T` * - by default `TElse` is set to _never_ * * **Related:** `First`, `Last` */ type Second$1 = T extends readonly unknown[] ? T[1] extends T[number] ? T[1] : ELSE : never; //#endregion //#region src/lists/Shift.d.ts type _Shift = TList extends [unknown, ...(infer Tail)] ? Tail : undefined; /** * **Shift**`` * * Removes the first element of a list, returning the rest. * ```ts * // [2,3] * type T = Shift<[1,2,3]>; * ``` * * - to provide additional utility, you can also pass * in a string literal and get back the literal with the first * character removed. * - if there is nothing left in Tuple or an empty string is passed in as input * then the output will _undefined_. */ type Shift = IsUndefined extends true ? undefined : [] extends T ? undefined : T extends readonly unknown[] ? _Shift> : string extends T ? string : T extends string ? T extends "" ? undefined : _Shift>>> extends readonly string[] ? Concat<_Shift>>>> : undefined : never; //#endregion //#region src/lists/Shortest.d.ts type Process$65 = T extends [infer Head extends string, ...infer Rest extends readonly string[]] ? Depth["length"] extends 128 ? TResult extends Unset ? string : TResult : Process$65 extends true ? Min$1<[TShortest, Length]> : TShortest, IsStringLiteral extends true ? IsLessThan, TShortest> extends true ? Head : TResult : TResult, [unknown, ...Depth]> : TResult extends Unset ? string : TResult; /** * **Shortest**`` * * Takes a tuple of strings and returns the shortest one in the tuple. * * - if more than one string is _tied_ for being shortest then * the **first** one found will be returned. * - if _all_ elements passed in were wide then the result will be `string` * - if _some_ of the elements passed in were wide then they will be * ignored and only the literal strings will be compared */ type Shortest = Process$65; //#endregion //#region src/lists/Slice.d.ts type PositiveOfNegative = `${T}` extends `-${infer N extends number}` ? N : never; type DropLeading = TDepth["length"] extends TStart ? TList : number extends TStart ? TList : TDepth["length"] extends 64 ? TList : TList extends readonly [unknown, ...infer Rest] ? DropLeading : never; type DropTrailing = Subtract extends infer Keep extends number ? number extends TStart ? TList : TakeFirst : []; type TruncateAtLen = TLen extends number ? number extends TLen ? TList : `${TLen}` extends `-${string}` ? DropTrailing> : TakeFirst : TList; type ProcessList = TList extends readonly unknown[] ? number extends TStart ? TruncateAtLen : `${TStart}` extends `-${string}` ? TakeLast> : IsGreaterThan extends true ? TLen extends number ? [] : never : TruncateAtLen, TLen> : never; type ProcessChars = ProcessList extends readonly string[] ? ProcessList extends infer Result extends readonly string[] ? Concat : never : never; /** * **Slice**`` * * Provides a slice of a tuple or a string. * * - negative indexes for `TEnd` can be used * - `TStart` defaults to 0 * - `TLen` defaults to the all the remaining elements * but can be any amount; if you use negative values this * will drop that many values off the end of the tuple * * **Related:** `SliceArray`, `SliceString` */ type Slice = [TList] extends [string] ? SliceString : [TList] extends [readonly unknown[]] ? SliceArray : never; /** * **SliceArray** * * Slices an array. * * - negative indexes for `TEnd` can be used * - `TStart` defaults to 0 * - `TLen` defaults to the all the remaining elements * but can be any amount; if you use negative values this * will drop that many values off the end of the tuple * * **Related:** `Slice`, `SliceArray` */ type SliceString = Chars extends infer Characters extends readonly string[] ? IsGreaterThan extends true ? "" : ProcessChars : never; /** * **SliceArray** * * Slices an array. * * - negative indexes for `TEnd` can be used * - `TStart` defaults to 0 * - `TLen` defaults to the all the remaining elements * but can be any amount; if you use negative values this * will drop that many values off the end of the tuple * * **Related:** `Slice`, `SliceString` */ type SliceArray = ProcessList<[...TList], TStart, TLen> extends infer Result extends readonly unknown[] ? Result extends readonly (TList[number])[] ? Result : never : never; //#endregion //#region src/lists/sort/BooleanSort.d.ts /** * Detect if a type is the wide boolean type rather than a boolean literal */ type IsWideBool = boolean extends T ? true extends T ? false extends T ? true : false : false : false; /** * Boolean comparison for ASC order - returns true if A should come before B * ASC order: true comes before false */ type BoolLessThan = A extends true ? B extends false ? true : false : A extends false ? B extends true ? false : false : false; type BoolGreaterThan = BoolLessThan extends true ? false : A extends B ? false : true; /** * Filter booleans that are less than or equal to the pivot */ type FilterBoolLessThanOrEqual = TValues extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? BoolLessThan extends true ? FilterBoolLessThanOrEqual : Head extends TPivot ? FilterBoolLessThanOrEqual : FilterBoolLessThanOrEqual : TOut; /** * Filter booleans that are greater than the pivot */ type FilterBoolGreaterThan = TValues extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? BoolGreaterThan extends true ? FilterBoolGreaterThan : FilterBoolGreaterThan : TOut; /** * Quicksort implementation for booleans */ type _SortBooleans = TValues extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? TReverse extends true ? [..._SortBooleans, TReverse>, Head, ..._SortBooleans, TReverse>] : [..._SortBooleans, TReverse>, Head, ..._SortBooleans, TReverse>] : []; /** * Helper to filter containers by boolean offset value comparison */ type FilterContainersBoolLessThanOrEqual = TContainers extends readonly [infer Head extends Container, ...infer Tail extends readonly Container[]] ? BoolLessThan, boolean>, As, boolean>> extends true ? FilterContainersBoolLessThanOrEqual : As, boolean> extends As, boolean> ? FilterContainersBoolLessThanOrEqual : FilterContainersBoolLessThanOrEqual : TOut; type FilterContainersBoolGreaterThan = TContainers extends readonly [infer Head extends Container, ...infer Tail extends readonly Container[]] ? BoolGreaterThan, boolean>, As, boolean>> extends true ? FilterContainersBoolGreaterThan : FilterContainersBoolGreaterThan : TOut; /** * Sort containers by boolean offset */ type _SortBooleanOffset = TContainers extends readonly [infer Head extends Container, ...infer Rest extends readonly Container[]] ? TReverse extends true ? [..._SortBooleanOffset, TOffset, TReverse>, Head, ..._SortBooleanOffset, TOffset, TReverse>] : [..._SortBooleanOffset, TOffset, TReverse>, Head, ..._SortBooleanOffset, TOffset, TReverse>] : []; /** * Filter narrow boolean types (true | false literals) */ type FilterNarrowBooleans = T extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? IsWideBool extends true ? FilterNarrowBooleans : FilterNarrowBooleans : Result; /** * Filter wide boolean types (boolean type) */ type FilterWideBooleans = T extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? IsWideBool extends true ? FilterWideBooleans : FilterWideBooleans : Result; /** * Separate wide and narrow boolean types */ interface SeparateWideBooleans { narrow: FilterNarrowBooleans; wide: FilterWideBooleans; } interface BooleanSortOptions { /** * by default this is set to sort by _ascending_ order but this can be * reversed by changing order to `DESC`. * reversed by changing order to `DESC` or kept in original order with `Natural`. * * ASC: true, false, boolean * DESC: false, true, boolean */ order?: TOrder; /** * by default, the sorting will expect the boolean value to exist * as the base type of the array's elements, however, if you are * list contains "container" types as objects then it may be more * useful to have the comparison be made to a property/offset of * these containers. */ offset?: TOffset; /** * Pin specific boolean values to the beginning of the sorted array. * If an array is provided, values are pinned in order. */ start?: unknown; /** * Pin specific boolean values to the end of the sorted array. * If an array is provided, values are pinned in order. */ end?: unknown; } /** * Main sorting logic without first elements */ type _BooleanSortMain, TNarrow extends readonly boolean[] = (TSeparated extends { narrow: infer N; } ? N extends readonly boolean[] ? N : [] : []), TWide extends readonly boolean[] = (TSeparated extends { wide: infer W; } ? W extends readonly boolean[] ? W : [] : []), TSorted extends readonly boolean[] = ([IsEqual] extends [true] ? TNarrow : _SortBooleans] extends [true] ? true : false>)> = [...TSorted, ...TWide]; /** * Extract first elements from boolean array */ type ExtractFirstBool = TFirst extends readonly unknown[] ? T extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? Head extends TFirst[number] ? ExtractFirstBool : ExtractFirstBool : TOut : T extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? Head extends TFirst ? ExtractFirstBool : ExtractFirstBool : TOut; /** * Remove first elements from boolean array */ type RemoveFirstBool = TFirst extends readonly unknown[] ? T extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? Head extends TFirst[number] ? RemoveFirstBool : RemoveFirstBool : TOut : T extends readonly [infer Head extends boolean, ...infer Tail extends readonly boolean[]] ? Head extends TFirst ? RemoveFirstBool : RemoveFirstBool : TOut; /** * Sorting logic with start elements */ type _BooleanSortWithStart, TNarrow extends readonly boolean[] = (TSeparated extends { narrow: infer N; } ? N extends readonly boolean[] ? N : [] : []), TWide extends readonly boolean[] = (TSeparated extends { wide: infer W; } ? W extends readonly boolean[] ? W : [] : []), TStart = (O["start"] extends readonly any[] ? O["start"] : [O["start"]] extends readonly [infer S] ? S : O["start"]), TStartElements extends readonly boolean[] = ExtractFirstBool, TRemainingElements extends readonly boolean[] = RemoveFirstBool, TSorted extends readonly boolean[] = ([IsEqual] extends [true] ? TRemainingElements : _SortBooleans] extends [true] ? true : false>)> = [...TStartElements, ...TSorted, ...TWide]; /** * Sorting logic with end elements */ type _BooleanSortWithEnd, TNarrow extends readonly boolean[] = (TSeparated extends { narrow: infer N; } ? N extends readonly boolean[] ? N : [] : []), TWide extends readonly boolean[] = (TSeparated extends { wide: infer W; } ? W extends readonly boolean[] ? W : [] : []), TEnd = (O["end"] extends readonly any[] ? O["end"] : [O["end"]] extends readonly [infer E] ? E : O["end"]), TEndElements extends readonly boolean[] = ExtractFirstBool, TRemainingElements extends readonly boolean[] = RemoveFirstBool, TSorted extends readonly boolean[] = ([IsEqual] extends [true] ? TRemainingElements : _SortBooleans] extends [true] ? true : false>)> = [...TSorted, ...TEndElements, ...TWide]; /** * Sorting logic with both start and end elements */ type _BooleanSortWithStartAndEnd, TNarrow extends readonly boolean[] = (TSeparated extends { narrow: infer N; } ? N extends readonly boolean[] ? N : [] : []), TWide extends readonly boolean[] = (TSeparated extends { wide: infer W; } ? W extends readonly boolean[] ? W : [] : []), TStart = (O["start"] extends readonly any[] ? O["start"] : [O["start"]] extends readonly [infer S] ? S : O["start"]), TEnd = (O["end"] extends readonly any[] ? O["end"] : [O["end"]] extends readonly [infer E] ? E : O["end"]), TStartElements extends readonly boolean[] = ExtractFirstBool, TEndElements extends readonly boolean[] = ExtractFirstBool, TEnd>, TRemainingElements extends readonly boolean[] = RemoveFirstBool, TEnd>, TSorted extends readonly boolean[] = ([IsEqual] extends [true] ? TRemainingElements : _SortBooleans] extends [true] ? true : false>)> = [...TStartElements, ...TSorted, ...TEndElements, ...TWide]; /** * **BooleanSort**`` * * Sorts a boolean based tuple `T` or containers with boolean properties. * * - by default it sorts in _ascending_ order: true, false, boolean * - DESC order: false, true, boolean (wide boolean type always last) * - any _wide_ boolean encountered will always be pushed to the * end of the sort order * - supports pinning elements to the beginning with the `first` option * - supports container/offset sorting */ type BooleanSort = IsStringLiteral extends true ? T extends readonly Container[] ? [IsEqual] extends [true] ? T : [IsEqual] extends [true] ? Reverse<_SortBooleanOffset, false>> : _SortBooleanOffset, false> : never : T extends readonly boolean[] ? Length extends 0 ? T : Length extends 1 ? T : O extends { start: any; } ? O extends { end: any; } ? _BooleanSortWithStartAndEnd : _BooleanSortWithStart : O extends { end: any; } ? _BooleanSortWithEnd : _BooleanSortMain : never; //#endregion //#region src/lists/sort/NumericSort.d.ts /** * Optimized comparison using string representation to avoid Iterator recursion * This is more efficient than creating tuple arrays for comparison */ type NumLessThanOrEqual = `${A}` extends `-${string}` ? `${B}` extends `-${string}` ? StringNumCompare<`${A}`, `${B}`> extends true | "equal" ? true : false : true : `${B}` extends `-${string}` ? false : StringNumCompare<`${A}`, `${B}`> extends true | "equal" ? true : false; type NumGreaterThan = NumLessThanOrEqual extends true ? false : true; /** * String-based numeric comparison that's more efficient than Iterator approach */ type StringNumCompare = A extends B ? "equal" : A extends `-${infer ANeg}` ? B extends `-${infer BNeg}` ? StringNumCompare : true : B extends `-${string}` ? false : ComparePositive$1; type ComparePositive$1 = A extends `${infer _A1}${infer _A2}${infer _A3}${infer _A4}${infer ARest}` ? B extends `${infer _B1}${infer _B2}${infer _B3}${infer _B4}${infer BRest}` ? ComparePositive$1 : false : B extends `${infer _B1}${infer _B2}${infer _B3}${infer _B4}${infer _BRest}` ? true : A extends `${infer A1}${infer A2}${infer A3}` ? B extends `${infer B1}${infer B2}${infer B3}` ? CompareByDigits<`${A1}${A2}${A3}`, `${B1}${B2}${B3}`> : false : B extends `${infer _B1}${infer _B2}${infer _B3}` ? true : A extends `${infer A1}${infer A2}` ? B extends `${infer B1}${infer B2}` ? CompareByDigits<`${A1}${A2}`, `${B1}${B2}`> : false : B extends `${infer _B1}${infer _B2}` ? true : CompareByDigits; type CompareByDigits = A extends B ? "equal" : A extends `${infer AH}${infer AT}` ? B extends `${infer BH}${infer BT}` ? AH extends BH ? CompareByDigits : CompareDigit$2 : false : true; type CompareDigit$2 = A extends "0" ? true : A extends "1" ? B extends "0" ? false : true : A extends "2" ? B extends "0" | "1" ? false : true : A extends "3" ? B extends "0" | "1" | "2" ? false : true : A extends "4" ? B extends "0" | "1" | "2" | "3" ? false : true : A extends "5" ? B extends "0" | "1" | "2" | "3" | "4" ? false : true : A extends "6" ? B extends "0" | "1" | "2" | "3" | "4" | "5" ? false : true : A extends "7" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" ? false : true : A extends "8" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" ? false : true : A extends "9" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" ? false : true : false; /** * Optimized filter that uses simpler comparison */ type FilterLessThanOrEqual = TValues extends readonly [infer head extends number, ...infer tail extends readonly number[]] ? NumLessThanOrEqual extends true ? FilterLessThanOrEqual : FilterLessThanOrEqual : TOut; type FilterGreaterThan = TValues extends readonly [infer head extends number, ...infer tail extends readonly number[]] ? NumGreaterThan extends true ? FilterGreaterThan : FilterGreaterThan : TOut; /** * Optimized quicksort that uses string comparison instead of Iterator */ type _Sort = TValues extends readonly [infer head extends number, ...infer tail extends readonly number[]] ? TReverse extends true ? [..._Sort, TReverse>, head, ..._Sort, TReverse>] : [..._Sort, TReverse>, head, ..._Sort, TReverse>] : []; /** * Helper to filter containers by offset value comparison */ type FilterContainersLessThanOrEqual = TContainers extends readonly [infer Head extends Container, ...infer Tail extends readonly Container[]] ? NumLessThanOrEqual, number>, As, number>> extends true ? FilterContainersLessThanOrEqual : FilterContainersLessThanOrEqual : TOut; type FilterContainersGreaterThan = TContainers extends readonly [infer Head extends Container, ...infer Tail extends readonly Container[]] ? NumGreaterThan, number>, As, number>> extends true ? FilterContainersGreaterThan : FilterContainersGreaterThan : TOut; /** * Optimized offset sort using simpler comparisons */ type _SortOffset = TContainers extends readonly [infer Head extends Container, ...infer Rest extends readonly Container[]] ? [..._SortOffset, TOffset>, Head, ..._SortOffset, TOffset>] : []; /** * Extract first elements from numeric array */ /** * Extract elements from array T that appear in the first array, in the order they appear in first array */ type ExtractFirstNumeric = TFirst extends readonly unknown[] ? TFirst extends readonly [infer FirstHead, ...infer FirstTail] ? FirstHead extends number ? [...ExtractAllMatching, ...ExtractFirstNumeric] : ExtractFirstNumeric : TOut : T extends readonly [infer Head extends number, ...infer Tail extends readonly number[]] ? Head extends TFirst ? ExtractFirstNumeric : ExtractFirstNumeric : TOut; /** * Extract all instances of a specific value from an array */ type ExtractAllMatching = T extends readonly [infer Head extends number, ...infer Tail extends readonly number[]] ? Head extends TValue ? ExtractAllMatching : ExtractAllMatching : TOut; /** * Remove first elements from numeric array */ type RemoveFirstNumeric = TFirst extends readonly unknown[] ? T extends readonly [infer Head extends number, ...infer Tail extends readonly number[]] ? Head extends TFirst[number] ? RemoveFirstNumeric : RemoveFirstNumeric : TOut : T extends readonly [infer Head extends number, ...infer Tail extends readonly number[]] ? Head extends TFirst ? RemoveFirstNumeric : RemoveFirstNumeric : TOut; interface NumericSortOptions { /** * by default this is set to sort by _ascending_ order but this can be * reversed by changing order to `DESC` or kept in original order with `Natural`. */ order?: TOrder; /** * by default, the sorting will expect the numeric value to exist * as the base type, however, if you are using some sort of "container" * object you may prefer to _offset_ */ offset?: TOffset; /** * When left as _undefined_ the sorting is a pure ASC/DESC sort. However, * if a value is added here it indicates that any element in the array * (or its offset if the offset is set) which **equals** this value * will be pinned to the beginning. * * If the value of `start` is a tuple/array then we should pin _all/any_ * of the values in `start` to the top (in the order they are specified * in the `start` tuple). * * @default undefined */ start?: unknown; /** * When left as _undefined_ the sorting is a pure ASC/DESC sort. However, * if a value is added here it indicates that any element in the array * (or its offset if the offset is set) which **equals** this value * will be pinned to the end. * * If the value of `end` is a tuple/array then we should pin _all/any_ * of the values in `end` to the bottom (in the order they are specified * in the `end` tuple). * * @default undefined */ end?: unknown; } /** * Main sorting logic without start/end elements */ type _NumericSortMain, TSorted extends readonly number[] = ([IsEqual] extends [true] ? TNumericArray : _Sort] extends [true] ? true : false>)> = TSorted; /** * Sorting logic with start elements */ type _NumericSortWithStart, TNumericStart = (TOpt["start"] extends readonly any[] ? AsNumericArray : AsNumericArray<[TOpt["start"]]> extends readonly [infer N] ? N : TOpt["start"]), TStartElements extends readonly number[] = ExtractFirstNumeric, TRemainingElements extends readonly number[] = RemoveFirstNumeric, TSorted extends readonly number[] = ([IsEqual] extends [true] ? TRemainingElements : _Sort] extends [true] ? true : false>)> = [...TStartElements, ...TSorted]; /** * Sorting logic with end elements */ type _NumericSortWithEnd, TNumericEnd = (TOpt["end"] extends readonly any[] ? AsNumericArray : AsNumericArray<[TOpt["end"]]> extends readonly [infer N] ? N : TOpt["end"]), TEndElements extends readonly number[] = ExtractFirstNumeric, TRemainingElements extends readonly number[] = RemoveFirstNumeric, TSorted extends readonly number[] = ([IsEqual] extends [true] ? TRemainingElements : _Sort] extends [true] ? true : false>)> = [...TSorted, ...TEndElements]; /** * Sorting logic with both start and end elements */ type _NumericSortWithStartAndEnd, TNumericStart = (TOpt["start"] extends readonly any[] ? AsNumericArray : AsNumericArray<[TOpt["start"]]> extends readonly [infer N] ? N : TOpt["start"]), TNumericEnd = (TOpt["end"] extends readonly any[] ? AsNumericArray : AsNumericArray<[TOpt["end"]]> extends readonly [infer N] ? N : TOpt["end"]), TStartElements extends readonly number[] = ExtractFirstNumeric, TEndElements extends readonly number[] = ExtractFirstNumeric, TNumericEnd>, TRemainingElements extends readonly number[] = RemoveFirstNumeric, TNumericEnd>, TSorted extends readonly number[] = ([IsEqual] extends [true] ? TRemainingElements : _Sort] extends [true] ? true : false>)> = [...TStartElements, ...TSorted, ...TEndElements]; /** * **NumericSort**`` * * Sorts the values in a tuple numerically. * * - _values_ can be a `number` or `${number}` * * Options: * - `order`: defaults to `ASC` but can be set to `DESC` or `Natural` (preserves original order) * - `offset`: if you have _containers_ as values, you can specify an offset to use to look for the numeric value * - `start`: pin specific numeric values to the beginning of the sorted array * - `end`: pin specific numeric values to the end of the sorted array */ type NumericSort = IsStringLiteral extends true ? TValues extends readonly Container[] ? [IsEqual] extends [true] ? TValues : [IsEqual] extends [true] ? Reverse<_SortOffset>> : _SortOffset> : never : TOpt extends { start: any; } ? TOpt extends { end: any; } ? _NumericSortWithStartAndEnd : _NumericSortWithStart : TOpt extends { end: any; } ? _NumericSortWithEnd : _NumericSortMain; //#endregion //#region src/lists/sort/Sort.d.ts type SortOrder$1 = "ASC" | "DESC" | "Natural"; type Dotpath = string; /** * **SortOptions**`<[TOrder],[TOffset],[TStart],[TEnd]>` * * Specifies how you'd like a list sorted. */ interface SortOptions { /** * the sorting strategy for the list * * @default "ASC" */ order?: SortOrder$1; /** * by adding a `DotPath` to the offset you are expressing that * the items in your list are some sort of a container and you'd * like the sorting comparison to be done on the offset/index specified. * * @default undefined */ offset?: Dotpath | undefined; /** * allows pinning items to the _start_ of the list * Can be a single value or array of values * * @default undefined */ start?: unknown; /** * allows pinning items to the _end_ of the list * Can be a single value or array of values * * @default undefined */ end?: unknown; } /** * **Sort**`` * * Sorts an array of values `TList` based on the configuration provided. * * Automatically detects the appropriate sort type based on the data: * - Pure string arrays use StringSort * - Pure number arrays use NumericSort * - Pure boolean arrays use BooleanSort * - Container arrays with offset use the type of the offset property * - Mixed type arrays fall back to StringSort with type conversion * * Supports all standard sorting options: * - `order`: ASC, DESC, Natural * - `start`/`end`: Element pinning * - `offset`: Container property sorting */ type Sort = IsStringLiteral extends true ? TList extends readonly Container[] ? TList extends readonly [infer First extends Container, ...any] ? Get extends string ? StringSort : Get extends number ? NumericSort : Get extends boolean ? BooleanSort : StringSort : StringSort : StringSort : TList extends readonly string[] ? StringSort : TList extends readonly number[] ? NumericSort : TList extends readonly boolean[] ? BooleanSort : StringSort; //#endregion //#region src/lists/sort/SortByLength.d.ts /** * Returns true if A is longer than B. * We compare by stripping one char at a time. */ type IsLonger = A extends `${string}${infer ARest}` ? B extends `${string}${infer BRest}` ? IsLonger : true : false; /** Find the longest string in a readonly tuple */ type Longest$1 = T extends readonly [infer H extends string, ...infer R extends readonly string[]] ? Longest$1 extends true ? H : Curr> : Curr; /** * Remove the first occurrence of V from a readonly tuple */ type RemoveFirst$1 = T extends readonly [infer H, ...infer R] ? H extends V ? [...Acc, ...R] : RemoveFirst$1 : Acc; type Sort$1 = T["length"] extends 0 ? Acc : Longest$1 extends infer L extends string ? Sort$1, [...Acc, L]> : never; /** * **SortByLength**`` * * Sorts the elements from longest to shortest. * * - use `Reverse` utility if you want the opposite. */ type SortByLength = Sort$1; //#endregion //#region src/lists/sort/StringSort.d.ts interface StringSortOptions { order?: TOrder; offset?: TOffset; start?: unknown; end?: unknown; } /** * Convert value to string for comparison purposes */ type ToComparisonString = T extends string ? T : T extends number ? `${T}` : T extends boolean ? T extends true ? "true" : "false" : never; /** Mixed type comparison - converts to strings for comparison but handles positioning */ type MixedLessThan = A extends string | number | boolean ? B extends string | number | boolean ? StringLessThan, ToComparisonString> : true : B extends string | number | boolean ? false : false; /** Lexicographic string comparison honoring wide strings as greatest */ type StringLessThan = A extends B ? false : IsWideString extends true ? IsWideString extends true ? false : false : IsWideString extends true ? true : A extends `${infer AFirst}${infer ARest}` ? B extends `${infer BFirst}${infer BRest}` ? AFirst extends BFirst ? StringLessThan : CodePointOf extends infer AC ? CodePointOf extends infer BC ? AC extends number ? BC extends number ? LessThan : false : false : false : false : false : true; type StringGreaterThan = StringLessThan extends true ? false : A extends B ? false : true; /** * Filter values that are less than or equal to the pivot (supports mixed types) */ type FilterMixedLessThanOrEqual = TValues extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? MixedLessThan extends true ? FilterMixedLessThanOrEqual : Head extends TPivot ? FilterMixedLessThanOrEqual : FilterMixedLessThanOrEqual : TOut; /** * Filter values that are greater than the pivot (supports mixed types) */ type FilterMixedGreaterThan = TValues extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? MixedGreaterThan extends true ? FilterMixedGreaterThan : FilterMixedGreaterThan : TOut; type MixedGreaterThan = MixedLessThan extends true ? false : A extends B ? false : true; /** * Quicksort implementation for mixed types (string, number, boolean) */ type _SortMixed = TValues extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? TReverse extends true ? [..._SortMixed, TReverse>, Head, ..._SortMixed, TReverse>] : [..._SortMixed, TReverse>, Head, ..._SortMixed, TReverse>] : []; /** * Helper to filter containers by offset value comparison */ type FilterContainersStringLessThanOrEqual = TContainers extends readonly [infer Head extends Container, ...infer Tail extends readonly Container[]] ? StringLessThan, string>, As, string>> extends true ? FilterContainersStringLessThanOrEqual : As, string> extends As, string> ? FilterContainersStringLessThanOrEqual : FilterContainersStringLessThanOrEqual : TOut; type FilterContainersStringGreaterThan = TContainers extends readonly [infer Head extends Container, ...infer Tail extends readonly Container[]] ? StringGreaterThan, string>, As, string>> extends true ? FilterContainersStringGreaterThan : FilterContainersStringGreaterThan : TOut; /** * Sort containers by string offset */ type _SortStringOffset = TContainers extends readonly [infer Head extends Container, ...infer Rest extends readonly Container[]] ? [..._SortStringOffset, TOffset>, Head, ..._SortStringOffset, TOffset>] : []; /** * Partition mixed types: strings into narrow/wide, others stay as-is */ type PartitionWide = T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? Head extends string ? IsWideString extends true ? PartitionWide : PartitionWide : PartitionWide : { narrow: TNarrow; wide: TWide; }; /** * Extract first elements from array (supports mixed types) */ type ExtractFirst = TFirst extends readonly unknown[] ? T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? Head extends TFirst[number] ? ExtractFirst : ExtractFirst : TOut : T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? Head extends TFirst ? ExtractFirst : ExtractFirst : TOut; /** * Remove first elements from array (supports mixed types) */ type RemoveFirst = TFirst extends readonly unknown[] ? T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? Head extends TFirst[number] ? RemoveFirst : RemoveFirst : TOut : T extends readonly [infer Head, ...infer Tail extends readonly unknown[]] ? Head extends TFirst ? RemoveFirst : RemoveFirst : TOut; /** * **StringSort**`` * * Sorts a string based tuple `T` or containers with string properties. * * - by default it sorts in ascending order; set `order` to `DESC` for descending or `Natural` to preserve original order * - wide string types are always pushed to the end * - supports pinning with `start` and `end` * - supports container/offset sorting */ type StringSort = IsStringLiteral extends true ? T extends readonly Container[] ? (O extends { order: infer Ord; } ? Ord : undefined) extends infer OOrder ? [IsEqual] extends [true] ? T : [IsEqual] extends [true] ? Reverse<_SortStringOffset>> : _SortStringOffset> : never : never : T extends readonly (string | number | boolean)[] ? Length extends 0 ? T : Length extends 1 ? T : O extends { start: unknown; } ? O extends { end: unknown; } ? _StringSortWithStartAndEnd : _StringSortWithFirst : O extends { end: unknown; } ? _StringSortWithEnd : _StringSortMain : never; /** * Main sorting logic without first elements */ type _StringSortMain, TNatural extends readonly unknown[] = (TPart extends { narrow: infer N; wide: infer W; } ? N extends readonly unknown[] ? W extends readonly unknown[] ? [...N, ...W] : N : [] : []), TSorted extends readonly unknown[] = ([IsEqual] extends [true] ? TNatural : _SortMixed] extends [true] ? true : false>)> = TSorted; /** * Sorting logic with first elements */ type _StringSortWithFirst, TRemainingElements extends readonly unknown[] = RemoveFirst, TPart = PartitionWide, TNatural extends readonly unknown[] = (TPart extends { narrow: infer N; wide: infer W; } ? N extends readonly unknown[] ? W extends readonly unknown[] ? [...N, ...W] : N : [] : []), TSorted extends readonly unknown[] = ([IsEqual] extends [true] ? TNatural : _SortMixed] extends [true] ? true : false>)> = [...TStartElements, ...TSorted]; /** * Sorting logic with end elements */ type _StringSortWithEnd, TRemainingElements extends readonly unknown[] = RemoveFirst, TPart = PartitionWide, TNatural extends readonly unknown[] = (TPart extends { narrow: infer N; wide: infer W; } ? N extends readonly unknown[] ? W extends readonly unknown[] ? [...N, ...W] : N : [] : []), TSorted extends readonly unknown[] = ([IsEqual] extends [true] ? TNatural : _SortMixed] extends [true] ? true : false>)> = [...TSorted, ...TEndElements]; /** * Sorting logic with both start and end elements */ type _StringSortWithStartAndEnd, TEndElements extends readonly unknown[] = ExtractFirst, TEnd>, TRemainingElements extends readonly unknown[] = RemoveFirst, TEnd>, TPart = PartitionWide, TNatural extends readonly unknown[] = (TPart extends { narrow: infer N; wide: infer W; } ? N extends readonly unknown[] ? W extends readonly unknown[] ? [...N, ...W] : N : [] : []), TSorted extends readonly unknown[] = ([IsEqual] extends [true] ? TNatural : _SortMixed] extends [true] ? true : false>)> = [...TStartElements, ...TSorted, ...TEndElements]; //#endregion //#region src/lists/SortByKey.d.ts /** * default options for sorting */ interface SortByKeyOptions { /** Object Key's that should be pinned to the start of the array */ start?: T | readonly T[]; /** Object keys's that should be pinned to the end of the array */ end?: T | readonly T[]; order?: SortOrder; } type ToArray = T extends readonly unknown[] ? T : readonly [T]; type SortByKey = TList extends readonly any[] ? Mutable<_SortByKey> : TList; type _SortByKey = _Reorder : readonly [], TConfig["end"] extends any ? ToArray : readonly []>; type _Reorder = readonly [..._GetStartElements, ..._GetMiddleElements, ..._GetEndElements]; type _GetStartElements = TStart extends readonly [infer First, ...infer Rest] ? [..._FilterByValue, ..._GetStartElements] : []; type _GetEndElements = TEnd extends readonly [infer First, ...infer Rest] ? [..._FilterByValue, ..._GetEndElements] : []; type _GetMiddleElements = _FilterByValues; type _FilterByValue = TList extends readonly [infer First, ...infer Rest extends object[]] ? First extends object ? TKey extends keyof First ? First[TKey] extends TValue ? readonly [First, ..._FilterByValue] : _FilterByValue : _FilterByValue : _FilterByValue : []; type _FilterByValues = TList extends readonly [infer First, ...infer Rest extends object[]] ? First extends object ? TKey extends keyof First ? First[TKey] extends TValues[number] ? _FilterByValues : [First, ..._FilterByValues] : [First, ..._FilterByValues] : [First, ..._FilterByValues] : []; //#endregion //#region src/lists/TakeFirst.d.ts type Take$9 = TDepth["length"] extends TLen ? TResult : number extends TLen ? TContent : TDepth["length"] extends 64 ? TResult : [] extends TContent ? TResult : TContent extends readonly [infer Head, ...infer Tail] ? Take$9 : TResult; type CountOptionalInFirstN = number extends N ? number : GetRequiredElementCount extends infer Req extends number ? GetOptionalElementCount extends infer Opt extends number ? Subtract extends infer Delta extends number ? IsLessThan extends true ? 0 : Min$1<[Opt, Delta]> : 0 : 0 : 0; /** * **TakeFirst**`` * * Takes the first `TLen` items from `TContent` and discards the rest. * * **Note:** * - if `TLen` is larger then the number of elements left in * `TContent` then only the remaining elements will be returned. */ type TakeFirst> = HasOptionalElements extends true ? AllOptionalElements extends true ? Partial> : number extends TLen ? TContent : Take$9 extends infer FirstN extends readonly unknown[] ? CountOptionalInFirstN extends infer Optional extends number ? MakeOptional : never : never : Take$9; //#endregion //#region src/lists/TakeLast.d.ts /** * **TakeLast**`` * * Takes the last `TLen` items from `TContent` and discards the rest. * * Note: * - by default if `TLen` is larger than the size of `TContent` this * is fine and instead of getting precisely `TLen` elements you'll get */ type TakeLast> = HasOptionalElements extends true ? MakeOptional, TLen>> extends readonly unknown[] ? Reverse, TLen>> : [], As, TLen]>, number>> : Reverse, TLen>>; //#endregion //#region src/lists/ToCSV.d.ts type Process$64 = T extends [infer Head, ...infer Rest] ? Process$64}` : `${TResult},${AsString}`> : StripLeading; /** * **ToCSV**`` * * Converts a tuple into a CSV string. For any elements * in the tuple which are strings the `,` character will * be replaced with the value of `TReplace` (which defaults * to ``). * * @deprecated use `ToCsv` instead */ type ToCSV = Process$64; /** * **ToCsv**`` * * Converts a tuple into a CSV string. For any elements * in the tuple which are strings the `,` character will * be replaced with the value of `TReplace` (which defaults * to ``). */ type ToCsv = Process$64; //#endregion //#region src/lists/TruthyReturns.d.ts /** * **TruthyReturns**`` * * Given a known Tuple, this utility will return a _union_ type * that represents the _[truthiness](https://frontend.turing.edu/lessons/module-1/js-truthy-falsy-expressions.html)_ * of each element; where: * * - functions are evaluated by their _return type_ * - non-functions are evaluated directly * * **Note:** `true` and `false` will be returned where possible but in cases where * a type can't be evaluated at design time then `boolean` will be returned. * * **See Also**: `ReturnTypes` and `LogicalReturns` */ type TruthyReturns = TupleToUnion<{ [K in keyof T]: T[K] extends TypedFunction ? If>, true, false, boolean> : If, true, false, boolean> }>; //#endregion //#region src/lists/TypeOfArray.d.ts /** * **TypeOfArray**`` * * Determines the _type_ of a wide array type. * * ### Example * ```ts * // string * type T = TypeOfArray; * // string | number * type U = TypeOfArray<(string | number)[]>; * ``` * * **Note:** * - tuples passed into this utility will return `never`! * - however, types such as `["foo", ...string[]]`, are not * tuples and are allowed. * */ type TypeOfArray = IsTuple extends true ? never : T extends (infer Type)[] ? Type : never; //#endregion //#region src/lists/UnionFromProp.d.ts /** * Tests whether any of the object in T are explicitly missing * the property P */ type HasMissingInstance = [] extends T ? false : P extends keyof First$1 ? HasMissingInstance, P> : true; /** * removes objects that do not have the property P */ type RemoveMissing = [] extends T ? R[number] : RemoveMissing, P, P extends keyof First$1 ? [...R, First$1] : R>; /** * **UnionFromProp** * * Given an array of objects `` and a property value `

`, this utility will * return a _union type_ of all the potential values of the objects which have * a keyof `P`. * * If an object in the array _explicitly_ doesn't have the prop in it's definition * then it is ignored, if it is shaped to be an optional property then `undefined` * will be included in the union. * * ```ts * const data = [ * { id: 123, color: "blue" }, * { id: 456, color: "red" }, * ] as const; * // 123 | 456 * type U = UnionFromProp; * ``` */ type UnionFromProp = HasMissingInstance extends true ? Get, P> | undefined : Get; //#endregion //#region src/lists/Variadic.d.ts /** Does T have at least one fixed (non-variadic) element? */ type HasFixedHead = Exclude extends never ? false : true; /** * **SplitAtVariadic**`` * * Split T into: * - Prefix: whatever remains after removing the maximal fixed suffix * - Suffix: the maximal fixed suffix (elements guaranteed to be present at the end) * * For example: * - SplitAtVariadic<[...string[], 1, 2]> -> [[...string[]], [1, 2]] * - SplitAtVariadic<[1, ...string[], 2]> -> [[1, ...string[]], [2]] * - SplitAtVariadic<[1, 2]> -> [[], [1, 2]] * - SplitAtVariadic -> [string[], []] */ type SplitAtVariadic = Depth["length"] extends 30 ? [T, Acc] : T extends readonly [...infer P, infer L] ? SplitAtVariadic : [T, Acc]; /** * **HasVariadicTail**`` * * Boolean operator which tests whether the tuple `T` concludes with * a _variadic_ type. * * - **Note**: while all wide type arrays like `number[]` or even `[...number[]]` ( * which coincidentally are the same type) are by nature _variadic_. This utility, * however, will return `false` for wide types so we can isolate only literal types * that have variadic tails. * * **Related:** * - `HasVariadicHead`, `HasVariadicInterior`, `IsVariadicArray` * - `VariadicType`, `GetNonVariadicLength` */ type HasVariadicTail = [IsAny] extends [true] ? false : [IsNever] extends [true] ? false : IsVariadicArray extends true ? HasFixedHead extends true ? SplitAtVariadic extends [...any[], []] ? true : false : false : false; /** * **HasVariadicHead**`` * * Tests whether if `T` starts with a variadic type with a fixed * type at the end. * * - **Note**: while all wide type arrays like `number[]` or even `[...number[]]` ( * which coincidentally are the same type) are by nature _variadic_. This utility, * however, will return `false` for wide types so we can isolate only literal types * that have variadic tails. * * **Related:** * - `HasVariadicTail`, `HasVariadicInterior`, `IsVariadicArray` * - `VariadicType`, `GetNonVariadicLength` */ type HasVariadicHead = [IsAny] extends [true] ? false : [IsNever] extends [true] ? false : IsVariadicArray extends true ? HasFixedHead extends true ? false : SplitAtVariadic extends [...unknown[], []] ? false : true : false; /** * **HasVariadicInterior**`` * * tests whether `T` has a _variadic_ element in the _interior_ of * the array. * * **Related:** `HasVariadicHead`, `HasVariadicTail`, `IsVariadicArray` */ type HasVariadicInterior = [IsAny] extends [true] ? false : [IsNever] extends [true] ? false : IsVariadicArray extends true ? Not, HasVariadicTail]>> extends true ? SplitAtVariadic extends [...unknown[], []] ? false : true : false : false; /** * **AllOptionalElements** * * Boolean operator which detects whether `T`'s elements are ALL designed as optional (e.g., marked with the * `?` modifier). * * **Related:** `HasOptionalElements` */ type AllOptionalElements = IsEqual, T>; /** * **GetNonVariadicLength**`` * * Determines the length of the tuple when the variadic tail has been stripped off. * * - if `T` is not variadic then this will simply report the length of the tuple` * - _optional_ elements (e.g., marked with the `?` modifier) are always included in the length */ type GetNonVariadicLength = Depth["length"] extends 25 ? F["length"] : [] extends Required ? F["length"] : Required> extends [infer Explicit, ...infer REST] ? GetNonVariadicLength : F["length"]; /** * **NonVariadicRequired**`` * * Get's the elements which have a fixed value (aka, are not * _variadic_) as well as are "required" (aka, no `?` modifier used) */ type NonVariadicRequired = Depth["length"] extends 25 ? F["length"] : [] extends T ? F["length"] : Mutable extends [infer Explicit, ...infer REST] ? NonVariadicRequired : F["length"]; /** * **GetRequiredElementCount**`` * * counts only the **required** elements of `T` * * **Related:** `GetOptionalElementCount`, `TupleMeta` */ type GetRequiredElementCount = NonVariadicRequired; /** * **GetOptionalElementCount**`` * * counts only the **optional** elements of `T` (e.g., those with the `?` modifier). * * **Related:** `GetRequiredElementCount`, `TupleMeta`, `MakeOptional` */ type GetOptionalElementCount = T extends readonly unknown[] ? T["length"] extends number ? GetNonVariadicLength extends infer NonVarLen extends number ? GetRequiredElementCount extends infer ReqLen extends number ? Subtract : 0 : 0 : 0 : never; /** * **ExtractOptionalElements**`` * * returns a tuple of the **optional** elements found in `T` * * ```ts * // [ string?, number? ] * type Test = ExtractOptionalElements<[1,42, string?, number?]>; * ``` * * **Related:** `ExtractRequiredElements`, `ExtractOptionalKeys` */ type ExtractOptionalElements>, readonly unknown[]>> = R extends readonly [...FixedLengthArray>, ...infer Rest] ? Partial : []; type ExtractOptionalKeys>, readonly unknown[]>> = NumericRange>, R["length"]>; type ExtractRequiredElements>, readonly unknown[]>> = R extends readonly [...infer Leading, ...FixedLengthArray>] ? Leading : []; /** * **DropVariadicTail**`` * * Removes the variadic tail found on the tuple `T`. * * - if no variadic tuple is found on `T` then it is just passed through * as is * * ```ts * // [ string, number? ] * type Test = ExcludeVariadicTail<[string, number?, ...string[]]>; * ``` */ type DropVariadicTail = HasVariadicTail extends true ? GetNonVariadicLength extends infer Len extends number ? SliceArray : T : T; /** * **IsVariadicArray**`` * * Boolean operator which determines if this tuple/array is variadic. * * - unlike some other utilities, this does not distinguish between * variadic arrays with fixed type elements versus **wide** array types; * both will return `true` */ type IsVariadicArray = number extends T["length"] ? true : false; /** * **DropVariadicHead**`` * * Removes the variadic head found on the tuple `T`. * * - if no variadic head is found on `T` then it is just passed through * * ```ts * // [ string, number? ] * type Test = ExcludeVariadicHead<[...string[], string, number?]>; * ``` */ type DropVariadicHead = SplitAtVariadic extends [infer Prefix extends readonly unknown[], infer Suffix extends readonly unknown[]] ? IsVariadicArray extends true ? HasFixedHead extends false ? Suffix : T : T : never; /** * **DropVariadic**`` * * Drops any variadic element found in `T` while retaining all the fixed length * elements. * * - if `T` has no variadic elements then it will be returned "as is" * * ```ts * // [1,2,3] * type Test = DropVariadic<[1,2,3, ...string[]]>; * ``` * * **Related:** `DropVariadicHead`, `DropVariadicTail`, `IsVariadicArray` */ type DropVariadic = IsVariadicArray extends false ? T : HasVariadicHead extends true ? DropVariadicHead : HasVariadicTail extends true ? DropVariadicTail : HasVariadicInterior extends true ? SplitAtVariadic extends [...infer Head, ...infer Tail] ? IsVariadicArray extends true ? Tail extends readonly unknown[] ? Tail : never : IsVariadicArray extends true ? Head extends readonly unknown[] ? Head : never : T : T : T; /** * **VariadicType**`` * * Returns the element type of a tuple's variadic tail. * * - Returns `never` if the tuple has no variadic tail * - For tuples with variadic tails like `[1, 2, ...number[]]`, returns the element type (`number`) * - Empty tuples and tuples with only optional elements return `never` * - Wide array types like `string[]`, or `number[]` -- _which are innately variadic types_ -- will correctly * report their variadic type as `string`, `number`, etc. * * **Related:** `GetNonVariadicLength`, `NonVariadic`, `VariadicType` */ type VariadicType = IsVariadicArray extends true ? HasVariadicHead extends true ? DropVariadicHead extends infer DroppedHead extends readonly unknown[] ? R extends readonly [...infer Head, ...DroppedHead] ? Head : never : never : HasVariadicTail extends true ? DropVariadicTail extends infer DroppedTail extends readonly unknown[] ? R extends readonly [...DroppedTail, ...infer Tail] ? Tail : never : never : never : never; //#endregion //#region src/boolean-logic/operators/containers/IsEmptyArray.d.ts /** * Boolean operator which tests `T` for whether it is an array * with zero elements. * * - if `T` is a wide array it will return `boolean` */ type IsEmptyArray = T extends any[] ? number extends T["length"] ? GetNonVariadicLength extends 0 ? boolean : false : T["length"] extends 0 ? true : false : false; //#endregion //#region src/boolean-logic/operators/containers/IsEmptyObject.d.ts /** * **IsEmptyObject**`` * * - T must be an object (but not a function and not an array/tuple) * - T must expose **no known keys** (`keyof T` is `never`) * - `any`, `unknown`, and `never` are rejected */ type IsEmptyObject = IsAny extends true ? false : IsNever extends true ? false : IsNull extends true ? false : IsUndefined extends true ? false : T extends AnyFunction ? false : IsObject extends true ? ObjectKeys extends readonly PropertyKey[] ? TupleMeta>["isEmpty"] : false : false; //#endregion //#region src/boolean-logic/operators/containers/IsIterable.d.ts type Process$63 = T extends Generator ? true : T extends Map ? true : T extends WeakMap ? true : T extends Set ? true : T extends readonly any[] ? true : T extends Dictionary ? Contains, Iterator> extends true ? true : false : false; /** * **IsIterable**`` * * Boolean operator which tests whether `T` is iterable. */ type IsIterable = IsNever extends true ? TNever : T extends Container ? Process$63 : false; //#endregion //#region src/boolean-logic/operators/containers/IsNonEmptyObject.d.ts /** * **IsNonEmptyObject**`` * * Boolean type util which detects whether `T` _is_ an object * and _has at least one property_. * * **Note:** this will report **false** for`ExplicitlyEmptyObject` but * not `EmptyObject` * * **Related:** `IsEmptyObject` */ type IsNonEmptyObject = T extends AnyObject ? IsEqual extends true ? false : Keys$1>["length"] extends 0 ? false : IsNumericLiteral>["length"]> extends true ? true : false : false; //#endregion //#region src/boolean-logic/operators/containers/IsObject.d.ts /** * **IsObject**`` * * Boolean operator which tests whether `T` extends `object` in a non-nullable fashion. */ type IsObject = [IsAny] extends [true] ? false : [IsNever] extends [true] ? false : [IsNull] extends [true] ? false : [IsUndefined] extends [true] ? false : T extends object ? true : false; //#endregion //#region src/boolean-logic/operators/containers/IsReadonlyArray.d.ts /** * **IsReadonlyArray**`` * * Boolean type utility which detects whether `T` is a readonly array. */ type IsReadonlyArray = T extends unknown[] ? false : T extends readonly unknown[] ? true : false; //#endregion //#region src/boolean-logic/operators/containers/IsReadonlyObject.d.ts /** * **IsReadonlyObject**`` * * Boolean operator which tests whether `T` is a _readonly * object_. This is defined as an object where all properties * are readonly. * * - Note: objects with no properties return `false` */ type IsReadonlyObject = T extends Dictionary ? IsEqual, keyof T> : false; //#endregion //#region src/boolean-logic/operators/containers/IsSameContainerType.d.ts /** * test that `A` and `B` are both a Dictionary object or both are an array */ type IsSameContainerType = Or<[And<[IsDictionary, IsDictionary]>, And<[IsArray, IsArray]>]>; //#endregion //#region src/boolean-logic/operators/containers/IsValidIndex.d.ts type HasPositiveIndex = TDepth["length"] extends TKey ? TContainer extends readonly [unknown, ...readonly unknown[]] ? true : false : TContainer extends readonly [unknown, ...infer Rest] ? HasPositiveIndex : false; type HasNegativeIndex = TDepth["length"] extends TKey ? TContainer extends readonly [unknown, ...readonly unknown[]] ? true : false : TContainer extends readonly [unknown, ...infer Rest] ? HasNegativeIndex : false; type PositiveIndexOf = `${T}` extends `-${infer N extends number}` ? N : never; /** * **IsValidIndex**`` * * Provides a boolean check on whether `TKey` is a valid key for `TContainer`. * * - valid responses are `true` or `false` if literal types found; otherwise `boolean` * - negative indexes are allowed when `TContainer` is a tuple */ type IsValidIndex = TContainer extends Tuple$1 ? IsTuple extends true ? TKey extends number ? number extends TKey ? boolean : `${TKey}` extends `-${string}` ? PositiveIndexOf extends infer Positive extends number ? Positive extends 0 ? false : HasNegativeIndex : false : HasPositiveIndex : false : boolean : TContainer extends Dictionary ? IsEqual extends true ? false : [IsLiteralLikeObject] extends [true] ? [IsStringLiteral] extends [true] ? [TKey] extends [keyof TContainer] ? true : false : [TKey] extends [symbol] ? [TKey] extends [keyof TContainer] ? true : false : false : boolean : false; //#endregion //#region src/boolean-logic/operators/containers/KeysOverlap.d.ts type Process$62 = [] extends K ? false : First$1 extends keyof O ? true : Process$62, O>; /** * **KeysOverlap**`` * * Boolean operator which tests whether two objects -- `A` and `B` -- have * overlapping keys. */ type KeysOverlap = EmptyObject extends A ? boolean : EmptyObject extends B ? boolean : And<[IsLiteralLikeObject, IsLiteralLikeObject]> extends true ? ObjectKeys extends readonly ObjectKey[] ? Process$62, B> : never : boolean; //#endregion //#region src/boolean-logic/operators/datetime/IsAfter.d.ts type IsSameDateDifferentPrecision$1 = A extends `${infer DatePart}T00:00:00Z` ? B extends DatePart ? true : false : B extends `${infer DatePart}T00:00:00Z` ? A extends DatePart ? true : false : false; type IsCharGreater$1 = A extends "0" ? false : A extends "1" ? B extends "0" ? true : false : A extends "2" ? B extends "0" | "1" ? true : false : A extends "3" ? B extends "0" | "1" | "2" ? true : false : A extends "4" ? B extends "0" | "1" | "2" | "3" ? true : false : A extends "5" ? B extends "0" | "1" | "2" | "3" | "4" ? true : false : A extends "6" ? B extends "0" | "1" | "2" | "3" | "4" | "5" ? true : false : A extends "7" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" ? true : false : A extends "8" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" ? true : false : A extends "9" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" ? true : false : A extends ":" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ? true : false : A extends "T" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-" | ":" ? true : false : A extends "Z" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-" | ":" | "T" ? true : false : A extends "-" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ? true : false : false; type LexicographicCompare$1 = A extends B ? false : IsSameDateDifferentPrecision$1 extends true ? false : [A] extends [never] ? false : [B] extends [never] ? false : [A, B] extends [string, string] ? A extends `${infer AFirst}${infer ARest}` ? B extends `${infer BFirst}${infer BRest}` ? AFirst extends BFirst ? LexicographicCompare$1 : IsCharGreater$1 : true : false : false; /** * **IsAfter**`` * * Tests whether `A` is _after_ (in time) `B`. * * Preserves literal types by using string comparison for ISO date strings. * For wide types or complex dates, it returns boolean. */ type IsAfter = A extends object ? boolean : B extends object ? boolean : string extends A ? boolean : string extends B ? boolean : number extends A ? boolean : number extends B ? boolean : A extends number ? B extends number ? IsGreaterThan : boolean : A extends string ? B extends string ? LexicographicCompare$1 : boolean : boolean; //#endregion //#region src/interpolation/ApplyTemplate.d.ts type ToBaseType$1 = { [K in keyof T]: T[K] extends NumberLike ? AsNumber : T[K] extends BooleanLike ? AsBoolean : T[K] }; type Finalize$1 = TOnlyStringLit extends true ? [TContent, ...TApplied] : [TContent, ...ToBaseType$1]; type Apply$1 = [] extends TStatic ? TResults : TStatic extends readonly [infer Head extends string, infer Next extends string, ...infer Rest extends string[]] ? Apply$1, Next>]> : TStatic extends readonly [infer Head extends string] ? [...TResults, RetainAfter] : TResults; /** * **ApplyTemplate**`` * * If the content found in `TContent` is a match for `TTemplate`, then * the type returned will be the dynamic segments defined in the template. * * Alternatively, if `TContent` _does not_ match the dynamic segments * defined in `TTemplate` then a **invalid-content** error will be returned. * * Returns a tuple of the format: * * - [ full, p1, p2, p3, ... ] */ type ApplyTemplate = IsStringLiteral extends true ? FromLiteralTemplate extends infer Template extends string ? Finalize$1>, TOnlyStringLit> : never : string; //#endregion //#region src/interpolation/AsLiteralTemplate.d.ts type Convert$11> = TKeys extends [infer Head extends string & keyof TSegments, ...infer Rest extends readonly string[]] ? [FromInputToken__String>] extends [string | number | boolean] ? Convert$11>}`>, TSegments, Rest> : TContent extends `{{${Head}}}` ? FromInputToken__String> : Err<`invalid-type/template`, `The segment '{{${Head}}}' was configured as a type which can not be embedded inside of a string literal!`, { segment: Head; invalidType: FromInputToken__String>; content: TContent; }> : TContent; /** * **AsLiteralTemplate**`` * * Converts Static Template sections to a Literal Template */ type AsLiteralTemplate = TContent extends number ? `${TContent}` : TContent extends string ? TContent extends `{{${infer Inner extends string}}}` ? Inner extends keyof TSegments ? FromInputToken__String> : Convert$11 : Convert$11 : never; //#endregion //#region src/interpolation/AsStaticTemplate.d.ts type NoBooleanConversion = Err<`invalid-string/boolean-literal`, `An attempt was made to convert a string from a "literal template" to a "static template" but the use of ${boolean} converts to a union type and quickly becomes unmanageable. Use the static {{boolean}} form instead.`, { template: T; }>; type RestoreVocabularyPlaceholders = TContent extends `${infer Before}${"$"}{${infer Name}}${infer After}` ? Name extends Extract ? RestoreVocabularyPlaceholders<`${Before}{{${Name}}}${After}`, TSegments> : `${Before}${"$"}{${Name}}${RestoreVocabularyPlaceholders}` : TContent; type HasVocabularyPlaceholder = TContent extends `${string}${"$"}{${string}}${string}` ? true : false; /** * **FromLiteralTemplate**`` * * Converts a string literal type into a Static Template where: * * - `${string}` is `{{string}}` * - `${number}` is `{{number}}` * - the `${boolean}` literal will produce a union and is too expensive to try and * capture so instead we'll return an error. * * This type utility is the _inverse_ of `StringLiteralTemplate`. */ type FromLiteralTemplate = string extends T ? string | Error : IsUnion extends true ? NoBooleanConversion : ReplaceStringInterpolation, "{{string}}">; type Convert$10> extends readonly string[] ? UnionToTuple> : [])> = TKeys extends [infer Head extends string, ...infer Rest extends readonly string[]] ? Convert$10, TSegments, Rest> : TContent; /** * **AsStaticTemplate**`` * * Converts a string literal type into a Static Template where: * * - `${string}` is `{{string}}` * - `${number}` is `{{number}}` * - the `${boolean}` literal will produce a union and is too expensive to try and * capture so instead we'll throw an error. * * In addition you can optionally add a **template map** which will allow for additional * vocabulary to be used. There are a few pre-configured maps: * * - `TemplateMap__Basics` - this is the default of strings, numbers, and booleans * - `TemplateMap__Generics` - an easy way to allow for generic params to included */ type AsStaticTemplate = As extends true ? HasVocabularyPlaceholder extends true ? RestoreVocabularyPlaceholders : Convert$10, string>, TSegments> : Convert$10, string>, TSegments>, string>; //#endregion //#region src/interpolation/AsTemplateBlock.d.ts /** * **AsTemplateType** * * Converts a static template block tag into the _type_ which will go into * this dynamic segment. * * **Related:** `AsTemplateTypes` */ type AsTemplateType = [T] extends [`{{string}}`] ? string : [T] extends [`{{number}}`] ? number : [T] extends [`{{boolean}}`] ? boolean : never; /** * **AsTemplateTypes**`` * * Converts all elements in `T` from template block tags to the underlying * types that these tags represent. * * **Related:** `AsTemplateType` */ type AsTemplateTypes = { [K in keyof T]: T[K] extends DefaultTemplateBlocks ? AsTemplateType : never }; //#endregion //#region src/interpolation/IntoTemplate.d.ts /** * Process args array helper */ type NextArg = T extends readonly [unknown, ...infer Rest] ? Rest : T; type FirstArg = T extends readonly [infer First, ...unknown[]] ? First : never; /** * Process template character by character, replacing placeholders in order */ type ProcessTemplate = TContent extends `${infer First}${infer Rest}` ? [IsEqual] extends [true] ? TArgs extends readonly [unknown, ...unknown[]] ? ProcessTemplate, `${TResult}${FirstArg & (string | number | boolean)}`> : ProcessTemplate : [IsEqual] extends [true] ? TArgs extends readonly [unknown, ...unknown[]] ? ProcessTemplate, `${TResult}${FirstArg & (string | number | boolean)}`> : ProcessTemplate : [IsEqual] extends [true] ? TArgs extends readonly [unknown, ...unknown[]] ? ProcessTemplate, `${TResult}${FirstArg & (string | number | boolean)}`> : ProcessTemplate : ProcessTemplate : [TContent] extends [""] ? TResult : [IsEqual] extends [true] ? TArgs extends readonly [unknown, ...unknown[]] ? `${TResult}${FirstArg & (string | number | boolean)}` : `${TResult}${TContent}` : [IsEqual] extends [true] ? TArgs extends readonly [unknown, ...unknown[]] ? `${TResult}${FirstArg & (string | number | boolean)}` : `${TResult}${TContent}` : [IsEqual] extends [true] ? TArgs extends readonly [unknown, ...unknown[]] ? `${TResult}${FirstArg & (string | number | boolean)}` : `${TResult}${TContent}` : `${TResult}${TContent}`; /** * **IntoTemplate**`` * * Takes a template literal type and a tuple of values, and returns the * interpolated string literal type. * * This implementation processes template literals in left-to-right order, * correctly matching template placeholders to arguments sequentially. * * ```ts * // "Hello World!" * type Result = IntoTemplate<`Hello ${string}!`, ["World"]>; * // "Age: 42" * type Age = IntoTemplate<`Age: ${number}`, [42]>; * // "Bob is 45 years old and his favorite color is blue." * type Complex = IntoTemplate<`${string} is ${number} years old and his favorite color is ${string}.`, ["Bob", 45, "blue"]>; * ``` */ type IntoTemplate> = TArgs extends readonly unknown[] ? ProcessTemplate : never; //#endregion //#region src/dictionary/AddKeyValue.d.ts /** * **AddKeyValue**`` * * Extends the object `TObj` to include the new KV pair of `TKey` * and `TVal`. * * Any attempt to _override_ an existing key in `TObj` will result * in an **ErrorCondition< "duplicate-key" >**. Use the `UpsertKeyValue` utility if * you want this condition to result in an overwrite. */ type AddKeyValue = If>, K>, Err<"duplicate-key", Concat<["The object passed into AddKeyValue already has the key '", ToString, "'. This is not allowed. If you intended this then consider using UpsertKeyValue instead."]>>, SimplifyObject>>; //#endregion //#region src/dictionary/CamelKeys.d.ts type Convert$9 = [] extends TKeys ? ExpandDictionary : Convert$9, First$1 extends string ? (Record>, TObj[First$1] extends Dictionary ? CamelKeys]> : TObj[First$1]> & TResult) : Record, TObj[First$1]> & TResult>; type Process$61 = CamelCase> extends infer _CC extends readonly ObjectKey[] ? Convert$9, readonly (ObjectKey & keyof T)[]>> : never; /** * Converts an object's keys to the **camelCase** equivalent * while keeping the values the same. */ type CamelKeys = Process$61> extends infer CamelDict extends Dictionary ? OptionalKeysTuple extends infer OptKeys extends readonly ObjectKey[] ? { [K in keyof OptKeys]: OptKeys[K] extends string ? CamelCase : OptKeys[K] } extends infer OptKeys extends readonly ObjectKey[] ? MakeKeysOptional : never : never : never; //#endregion //#region src/dictionary/CombinedKeys.d.ts /** * **CombinedKeys**`` * * Provides a tuple of unique keys which incorporate all key values across * both `A` and `B`. * * ```ts * // [ "foo", "bar", "baz", "bax" ] * type T = CombinedKeys<{foo: 1; bar: 2; baz: 3}, {bar: 4; baz: 5; bax: 6}> * ``` */ type CombinedKeys = Unique<[...(IsLiteralLike extends true ? Keys$1 : []), ...(IsLiteralLike extends true ? Keys$1 : [])]>; //#endregion //#region src/dictionary/ConstrainObject.d.ts /** * Helper type to infer narrow types while constraining to a broad type. */ type ConstrainObject = { [K in keyof TConstraint]: K extends keyof TObj ? TObj[K] & TConstraint[K] : never }; type ConstrainedObjectCallback = (cb: (input: ConstrainObject) => TReturn) => (input: ConstrainObject) => TReturn; /** * A function which will accept any object that meets the * defined constraint and will extract a narrow type from it. * * **Related:** `narrowObjectTo` */ interface ConstrainedObjectIdentity { (input: T & ConstrainObject): T; asCallback: ConstrainedObjectCallback; } //#endregion //#region src/dictionary/CreateKV.d.ts type Process$60 = [] extends TKeys ? TObj : Process$60, TValue, TObj & Record, TValue>>; /** * **CreateKV**`` * * Creates a key value pair with the keys passed in * as `TKeys` and with all properties set to the value * of `TValue` (which defaults to `unknown`) */ type CreateKV = ExpandRecursively>; //#endregion //#region src/dictionary/CreateLookup.d.ts type Process$59[], TKeyProp extends string, TValProp extends string, TOutput extends Record = NonNullable> = [] extends TPayload ? TOutput : TKeyProp extends keyof First$1 ? TValProp extends keyof First$1 ? Process$59, TKeyProp, TValProp, First$1[TKeyProp] extends ObjectKey ? TOutput & Record[TKeyProp], First$1[TValProp]> : TOutput & Record[TKeyProp]>, First$1[TValProp]>> : Process$59, TKeyProp, TValProp, TOutput> : Process$59, TKeyProp, TValProp, TOutput>; /** * **CreateLookup** * * Creates a dictionary lookup from a Tuple of similarly typed objects. */ type CreateLookup[], TKeyProp extends string, TValProp extends string> = ExpandRecursively>; //#endregion //#region src/dictionary/DefaultOptions.d.ts /** * **DefaultOptions**`` * * By providing a shape for an options hash in `TFor`, you can then define * the `Required` variant with type appropriate default values. * * The return type is **explicitly** of `Required` in intersection with * the literal values provided. */ type DefaultOptions> = TDef & Required; //#endregion //#region src/dictionary/DictChangeValue.d.ts /** * Allow a dictionary to have it's value's type changed to `T` while maintaining the keys in * the original object `I` so long as the original value for the KV pair extends `V`. * * If `V` is not specified then it defaults to _any_ and therefore all KVs are preserved. * * ```ts * type Obj = { foo: "hello", bar: 42, baz: () => "world" }; * // { foo: number, bar: number, baz: number }; * type AllNumbers = DictChangeValue; * // { foo: number } * type StringToBool = DictChangeValue * ``` */ type DictChangeValue< /** the object who's value-type we're changing */I extends Record, /** the return type that functions should be modified to have */T, /** *The type we expect in the value; if the value extends type `V` then the value will * be converted to type `O`; if not then the KV pair will be discarded */ V = unknown> = SimplifyObject<{ [K in keyof I]: I[K] extends V ? Record : never }[keyof I]>; //#endregion //#region src/dictionary/EnsureKeys.d.ts type BuildObj = [] extends TKey ? TObj : First$1 extends keyof TObj ? TEnsure extends Dictionary ? First$1 extends keyof TEnsure ? TObj[First$1] extends TEnsure[First$1] ? BuildObj> : Err<`invalid-type/${AsString>}`, `The key '${AsString>}' on the originating object of EnsureKeys is not compatible with the type we are trying to ensure with.`, { fn: "EnsureKeys"; key: First$1; originType: TObj[First$1]; ensureType: TEnsure[First$1]; }> : TObj[First$1] extends TType ? BuildObj> : never : TObj[First$1] extends TType ? BuildObj> : Err<`invalid-type/${AsString>}`, `The key '${AsString>}' on the originating object does not extend the TType property set in EnsureKeys`, { fn: "EnsureKeys"; key: First$1; originType: TObj[First$1]; type: TType; }> : BuildObj, TEnsure extends readonly string[] ? TType : TEnsure extends Dictionary ? First$1 extends keyof TEnsure ? TEnsure[First$1] : never : never>>, TEnsure, TType, AfterFirst>; /** * **EnsureKeys**`` * * Receives an object `TObj` and a specifier `TKeys` which * ensures that the specified _keys_ exist on the object. * * The _keys_ specifier may be either an array of keys or a dictionary of key/value pairs. * * - when _keys_ is a _dictionary_ then both the key and _type_ of that key * are inferred. * - otherwise, the optional `TType` (set to `unknown` by default) is used. */ type EnsureKeys = [IsWideObject] extends [true] ? IsDictionary extends true ? TEnsure : TEnsure extends readonly string[] ? Record : never : TEnsure extends readonly string[] ? BuildObj : BuildObj, readonly ObjectKey[]>>; //#endregion //#region src/dictionary/FromMaybeRef.d.ts /** * **FromMaybeRef**`` * * Dereferences the `value` property on VueJS `Ref`'s otherwise * returns `T` as is. */ type FromMaybeRef = IsVueRef extends true ? "value" extends keyof T ? T["value"] : never : T; //#endregion //#region src/dictionary/Get.d.ts type _Get = K extends `${infer A}.${infer B}` ? A extends keyof T ? _Get> : Acc : K extends keyof T ? _Get : Acc; /** * **Get**`` * * Provides a type utility which allows reaching into * a container using a _dot path_ to get the type * somewhere inside the parent structure. */ type Get = IsNever<_Get> extends true ? TDefVal : _Get extends undefined ? TDefVal : _Get; //#endregion //#region src/dictionary/GetFixedKeys.d.ts /** * **GetFixedKeys**`` * * Returns a union type for all _fixed_ keys found in `T` (aka, not indexed keys). * * **Related:** `GetIndexKeys`, `OnlyFixedKeys`, `RemoveIndexKeys` */ type GetFixedKeys = IsEqual extends true ? ObjectKey[] : T extends Dictionary ? keyof RemoveIndexKeys : never; //#endregion //#region src/dictionary/GetIndexKeys.d.ts /** * **GetIndexKeys`` * * Returns a union type of all the _index_ types found in `T`. * * - an index can be wide-type indexes such as `{ [x: string]: string }` * _or_ `{ [x: symbol]: number }` * - but they can also be _template literal_ indexes like `{ [x: `_${string}`]: string }` * * **Related:** `OnlyIndexKeys` */ type GetIndexKeys = keyof OnlyIndexKeys & (string | symbol); //#endregion //#region src/dictionary/KebabKeys.d.ts type Convert$8, readonly (ObjectKey & keyof T)[]>, O extends Dictionary = EmptyObject> = K extends [infer Head extends ObjectKey & keyof T, ...infer Rest extends readonly (ObjectKey & keyof T)[]] ? Convert$8, string>, T[Head] extends Dictionary ? KebabKeys : T[Head]> : Record : T[Head]>)> : ExpandRecursively; /** * Converts an object's keys to the **kebab-case** equivalent * while keeping the values the same. */ type KebabKeys = Required extends infer ReqDict extends Dictionary ? Convert$8 extends infer ReqDict extends Dictionary ? OptionalKeysTuple extends infer OptKeys extends readonly ObjectKey[] ? { [K in keyof OptKeys]: OptKeys[K] extends string ? KebabCase : OptKeys[K] } extends infer OptKeys extends readonly ObjectKey[] ? MakeKeysOptional : never : never : never : never; //#endregion //#region src/dictionary/KeysEqualValue.d.ts /** * **KeysEqualValue**`` * * The _keys_ on a given object `TObj` which are _equal to_ `TValue`. * * ```ts * // "foo" * type Str = KeysEqualValue<{ foo: string; bar: 5; baz: "bye" }, string>; * ``` * * **Related:** `KeysWithValue` */ type KeysEqualValue = { [K in keyof TObj]: TObj[K] extends readonly unknown[] ? IfEqual : IfEqual }[keyof TObj]; //#endregion //#region src/dictionary/KeysNotEqualValue.d.ts /** * **KeysNotEqualValue**`` * * The _keys_ on a given object `T` which _do not_ explicitly equal the type value of `W`. * * ```ts * // "bar" * type Str = KeysNotEqualValue<{ foo: 6; bar: 5 }, 5>; * ``` * * **Related:** `KeysEqualValue`, `KeysWithoutValue` */ type KeysNotEqualValue = { [K in keyof TObj]: IfEqual> }[keyof TObj]; //#endregion //#region src/dictionary/KeysWithError.d.ts type Process$58, readonly ObjectKey[]>, R extends readonly ObjectKey[] = []> = [] extends K ? R : First$1 extends keyof T ? T[First$1] extends Error ? Process$58, [...R, First$1]> : Process$58, R> : never; /** * **KeysWithError**`` * * Returns all of the keys in a dictionary `T` which _extend_ `Error`. */ type KeysWithError = Process$58; //#endregion //#region src/dictionary/KeysWithoutValue.d.ts /** * **KeysWithoutValue**`` * * The _keys_ on a given object `T` which _do not_ extend the type value of `W`. * * ```ts * // "foo" * type T = KeysWithoutValue<{ foo: "hi"; bar: 5; baz: number }, number>; * ``` */ type KeysWithoutValue = { [K in keyof TObj]: TObj[K] extends TValue ? never : Readonly }[keyof TObj]; //#endregion //#region src/dictionary/KeysWithValue.d.ts /** * **KeysWithValue**`` * * Filter's the key/values found on `TObj` to only those whose * value _extends_ `TValue`. * * ```ts * // "foo" | "baz" * type Str = KeysWithValue<{ foo: "hi"; bar: 5; baz: "bye" }, string>; * ``` * * **Related:** `KeysEqualValue` */ type KeysWithValue = IsLiteralLikeObject extends true ? { [K in keyof TObj]: TObj[K] extends TValue ? TObj[K] extends AnyFunction ? TValue extends AnyFunction ? K : never : And<[TObj[K] extends readonly any[] ? true : false, TValue extends readonly any[] ? false : true]> extends true ? never : K : never }[keyof TObj] : ObjectKey[]; //#endregion //#region src/dictionary/KvFn.d.ts /** * **KvFnDefn** * * Used as input to the `KvFn` utility. */ type KvFnDefn = [key: string, fn: FnDefn]; /** * **KvFn**`` * * A succinct and strong type definition for a KV value pair where the * _value_ is a function. */ type KvFn = Record>; //#endregion //#region src/dictionary/MakeKeysOptional.d.ts type Iterate$6 = ExpandRecursively & { [K in keyof WithKeys]?: K extends keyof TObj ? TObj[K] : never }>; type ConvertArray = IsGreaterThanOrEqual extends true ? Partial : Subtract extends infer ReqNum extends number ? Negative extends infer OptNum extends number ? [Slice, Slice] extends [infer ReqElements extends readonly unknown[], infer OptElements extends readonly unknown[]] ? [...ReqElements, ...Partial] : never : never : never; /** * **MakeKeysOptional**`` * * Makes a set of keys on a known container `T`: * * - if `T` is a **dictionary** object then `U` should: * - be a tuple of keys which you want to force * to _optional_. * - all other keys will be kept "as is" * - if `T` is an **array** then `U` should be: * - in a tuple, only the _last_ items are allowed to be optional * - therefore `U` is a number indicating _how many_ values should be optional * * **Related:** `MakeKeysRequired` */ type MakeKeysOptional = T extends Dictionary ? Iterate$6> : T extends readonly unknown[] ? ConvertArray, As> : never; //#endregion //#region src/dictionary/MakeKeysRequired.d.ts /** * **MakeKeysRequired**`` * * Makes a set of keys on a known object `TObj` become * _optional_ parameters while leaving the other properties * "as is". * * **Related:** `MakeKeysOptional` */ type MakeKeysRequired = ExpandDictionary & { [K in keyof WithKeys]: K extends keyof TObj ? TObj[K] : never }>; //#endregion //#region src/dictionary/MakePropsMutable.d.ts /** * **MakePropsMutable**`` * * Given a dictionary of type ``, this utility function will * make the properties of `TMutProps` _mutable_. `TMutProps` can be * a union type (as shown below) or a union. * * ```ts * // { foo: string, bar?: number, readonly baz: number } * type Example = MutableProps<{ * readonly foo: string, * bar?: number, * readonly baz: number * }, "foo" | "bar">; * ``` * * **Related:** `MutablePropsExclusive` */ type MakePropsMutable = SimplifyObject> & WithoutKeys>; /** * **MutablePropsExclusive**`` * * Given a dictionary of type ``, this utility function will * make the properties represented by `M` _mutable_ and all others * immutable. * * ```ts * // { foo: string, readonly bar: number, readonly baz: number } * type Example = MutableProps<{ * readonly foo: string, * bar?: number, * readonly baz: number * }, "foo">; * ``` * * **Related:** `MutableProps` */ type MutablePropsExclusive = ExpandRecursively> & Readonly>>; //#endregion //#region src/dictionary/MapTo.d.ts declare const DEFAULT_ONE_TO_MANY_MAPPING: FinalizedMapConfig<"req", "I -> O[]", "opt">; declare const DEFAULT_ONE_TO_ONE_MAPPING: FinalizedMapConfig<"req", "I -> O", "req">; declare const DEFAULT_MANY_TO_ONE_MAPPING: FinalizedMapConfig<"req", "I[] -> O", "req">; /** * The _default_ One-to-Many mapping that the mapTo() utility provides */ type DefaultOneToManyMapping = typeof DEFAULT_ONE_TO_MANY_MAPPING; /** * The _default_ One-to-One mapping that the mapTo() utility provides */ type DefaultOneToOneMapping = typeof DEFAULT_ONE_TO_ONE_MAPPING; /** * The _default_ Many-to-One mapping that the mapTo() utility provides */ type DefaultManyToOneMapping = typeof DEFAULT_MANY_TO_ONE_MAPPING; /** * Expresses relationship between inputs/outputs: */ declare enum MapCardinality { /** every input results in 0:M outputs */ OneToMany = "I -> O[]", /** every input results in 0:1 outputs */ OneToOne = "I -> O", /** every input is an array of type I and reduced to a single O */ ManyToOne = "I[] -> O" } type MapCardinalityIllustrated = `${string | number}`; /** * The _user_ configuration of a **mapTo** mapper function * which will be finalized by merging it with the appropriate * default mapping type. */ interface MapConfig { input?: IR; output?: OR; cardinality?: D; /** * Whether calls to the final `MapFn` will be logged to stderr * for debugging purposes. Defaults to false; if you specify * a _string_ for a value that will be sent to stderr along * with other debugging info. */ debug?: boolean | string; } /** * A finalized configuration of a **mapTo** mapper functions cardinality * relationships between _inputs_ and _outputs_. * * Note: _this configuration does _not_ yet include the actual mapping * configuration between the input and output._ */ type FinalizedMapConfig, D extends MapCardinalityIllustrated = MapCard, OR extends OptRequired = MapOR> = Required, "debug">> & { finalized: true; debug: boolean | string; }; /** * User configuration exposed by a config function which specifies the * cardinality already (e.g., `oneToMany()`, `manyToOne()`) */ interface MapCardinalityConfig { /** whether we the input can _optionally_ be an `undefined` value or not */ input?: IR; /** whether we the output can _optionally_ be an `undefined` value or not */ output?: OR; /** * Whether calls to the final `MapFn` will be logged to stderr * for debugging purposes. Defaults to false; if you set to a string * value than this will be echoed out with stderr. */ debug?: boolean | string; } /** * **ConfiguredMap** * * A partial application of the mapTo() utility which has expressed the * configuration of the _inputs_ and _outputs_ and provides a `.map()` * method which allows the user configure the specifics of the mapping. */ interface ConfiguredMap> { map: (map: MapTo) => MapperOld; input: MapIR; cardinality: MapCard; output: MapOR; debug: boolean | string; } /** * Extracts the IR, Cardinality, and OR generics from a FinalizedMapConfig */ type DecomposeMapConfig> = M extends MapConfig ? IR extends OptRequired | undefined ? D extends MapCardinalityIllustrated | undefined ? OR extends OptRequired | undefined ? [IR, D, OR] : never : never : never : M extends FinalizedMapConfig ? IR extends OptRequired ? D extends MapCardinalityIllustrated ? OR extends OptRequired ? [IR, D, OR] : never : never : never : never; /** extracts IR from a `FinalizedMapConfig` */ type MapIR> = DecomposeMapConfig[0]; /** * extracts the MapCardinality from a `FinalizedMapConfig` */ type MapCard> = DecomposeMapConfig[1]; /** extracts OR from a `FinalizedMapConfig` */ type MapOR> = DecomposeMapConfig[2]; /** * Merges the types of a userland configuration with a default configuration */ type AsFinalizedConfig, D extends FinalizedMapConfig> = MergeObjects extends FinalizedMapConfig ? FinalizedMapConfig : never; interface MapperApi { /** * Provides opportunity to configure _input_, _output_, and _cardinality_ * prior to providing a mapping function. * * Note: _the defaults for configuration are defined by the_ `DEFAULT_ONE_TO_MANY_MAPPING` * _constant made available as a symbol from this library._ */ config: >(config: C) => ConfiguredMap>; /** * Provides a nice 1:1 ratio between the input and output. * * By default the input and output are considered to be _required_ * properties but this can be changed with the options hash provided. * ```ts * const mapper = mapTo.oneToOne().map(...); * // add in ability to filter out some inputs * const mapAndFilter = mapTo.oneToOne({ output: "opt" }) * ``` */ oneToOne: >(config?: C) => ConfiguredMap>; /** * **manyToOne** _mapping_ * * Provides a configuration where multiple inputs `I[]` will be mapped to a * single output `O`. * * Choosing this configuration will, by default, set both input and output * to be "required" but you can change this default if you so choose. */ manyToOne: >(config?: C) => ConfiguredMap>; oneToMany: >(config?: C) => ConfiguredMap>; } type MapInput = C extends MapCardinality.OneToMany | "I -> O[]" ? IR extends "opt" ? I | undefined : I : C extends MapCardinality.OneToOne | "I -> O" ? IR extends "opt" ? I | undefined : I : C extends MapCardinality.ManyToOne | "I[] -> O" ? IR extends "opt" ? I[] | undefined : I[] : never; type MapOutput = C extends MapCardinality.OneToMany | "I -> O[]" ? OR extends "opt" ? O[] : [O, ...O[]] : C extends MapCardinality.OneToOne | "I -> O" ? OR extends "opt" ? O | null : O : C extends MapCardinality.ManyToOne | "I[] -> O" ? OR extends "opt" ? O | null : O : never; /** * **MapTo** * * A mapping function between an input type `I` and output type `O`. Defaults to using * the _default_ OneToMany mapping config. * * **Note:** this type is designed to guide the userland mapping; refer * to `MapFn` if you want the type output by the `mapFn()` utility. */ type MapTo = DefaultOneToManyMapping> = MapIR extends "opt" ? (source?: MapInput, MapCard>) => MapOutput, MapCard> : (source: MapInput, MapCard>) => MapOutput, MapCard>; type MapFnOutput = C extends "I -> O[]" | MapCardinality.OneToMany ? S extends I[] ? OR extends "opt" ? O[] : [O, ...O[]] : OR extends "opt" ? O[] | null : O[] : C extends MapCardinality.OneToOne | "I -> O" ? S extends I[] ? OR extends "opt" ? O[] : [O, ...O[]] : OR extends "opt" ? O | null : O : C extends MapCardinality.ManyToOne | "I[] -> O" ? S extends I[][] ? OR extends "opt" ? O[] : [O, ...O[]] : OR extends "opt" ? O | null : O : never; type MapFnInput = D extends "I -> O[]" | MapCardinality.OneToMany ? IR extends "opt" ? I | I[] | undefined : I | I[] : D extends MapCardinality.OneToOne | "I -> O" ? IR extends "opt" ? I | I[] | undefined : I | I[] : D extends MapCardinality.ManyToOne | "I[] -> O" ? IR extends "opt" ? I[] | I[][] | undefined : I[] | I[][] : never; /** * The mapping function provided by the `mapFn()` utility. This _fn_ * is intended to be used in two ways: * * 1. Iterative: * ```ts * const m = mapTo(i => [ ... ]); * // maps inputs to outputs * const out = inputs.map(m); * ``` * 2. Block: * ```ts * // maps inputs to outputs (filtering or splitting where appr.) * const out2 = m(inputs); * ``` */ type MapFn> = MapIR extends "opt" ? , MapCard>>(source?: S) => MapFnOutput, MapCard> : , MapCard>>(source: S) => MapFnOutput, MapCard>; /** * **Mapper** * * A fully configured _mapper_ stemming from the **mapTo()** utility. It is both a mapping * function and a dictionary which describes the mapper's properties. * ```ts * const m = mapTo.oneToOne().map( ... ); * const mapped = m(inputs); * const mappedOver = inputs.map(m); * ``` * * Note: the root of a `Mapper` is the mapper function but * this is combined with a dictionary of settings and types * which you can use. For instance, look at the `fnSignature` * property to get the _type_ signature of the map function. */ type MapperOld = FinalizedMapConfig> = { input: MapIR; output: MapOR; cardinality: MapCard; debug: boolean | string; inputType: I; outputType: O; /** * Provides the _type_ information for mapper function. * * Note: _this is just a **type**_ not the actual function which positioned * at the root of the Mapper type */ fnSignature: MapFn; } & MapFn; /** * **MapInputFrom** * * Type utility which extracts the `I` type from a fully configured `Mapper` */ type MapInputFrom = T extends MapperOld ? I : never; /** * **MapOutputFrom** * * Type utility which extracts the output [`O`] type from a fully configured `Mapper` */ type MapOutputFrom = T extends MapperOld ? O : never; /** * **MapCardinalityFrom** * * Type utility which extracts _cardinality_ of a `Mapper`'s inputs to outputs */ type MapCardinalityFrom = T extends MapperOld ? C extends FinalizedMapConfig ? Cardinality : never : never; //#endregion //#region src/dictionary/MaybeRef.d.ts /** * **MaybeRef**`` * * Used to represent a type which is either of the two: * * - `T` * - `VueRef` * * **Related:** `IsRef`, `IfRef` * ```ts * // number | VueRef * type T = MaybeRef; * ``` */ type MaybeRef = T | VueRef; //#endregion //#region src/dictionary/MergeKVs.d.ts type Process$57 = [] extends TInput ? TOutput extends Record ? ExpandRecursively : never : Process$57, First$1 extends keyof TOutput ? TOutput : TOutput & First$1>; /** * **MergeKVs**`` * * Receives an array of `Dictionary` types and merges this to * single dictionary. * * **Note:** _if key is repeated in the set, only the first one's value will be retained_ */ type MergeKVs = Process$57; //#endregion //#region src/dictionary/MixObjects.d.ts type Mix, readonly (PropertyKey & keyof B)[]>> = K extends [infer Head extends keyof B & PropertyKey, ...infer Rest extends readonly (keyof B & PropertyKey)[]] ? Head extends keyof A ? Mix & Record, B, Rest> : Mix, B, Rest> : ExpandDictionary; /** * **MixObjects**`` * * Combines two objects by unionizing the values of shared keys * and adding keys in `B` to `A` which didn't exist. */ type MixObjects = Mix; //#endregion //#region src/dictionary/MutableProps.d.ts /** * **MutableProps**`` * * Reduces an object down to just the key/value pairs which * are mutable. */ type MutableProps = Omit>; //#endregion //#region src/dictionary/NonNumericKeys.d.ts /** * **NonNumericKeys**`` * * The keys in an array/object `T` which are _not_ numeric keys. */ type NonNumericKeys = { [K in keyof T]: K extends number ? never : Readonly }[keyof T]; //#endregion //#region src/dictionary/NonStringKeys.d.ts /** * **NonStringKeys**`` * * Builds a union type of the keys of `T` which are _not_ * _string_ keys. This can be useful as _symbols_ can also * be seen as valid keys and these keys are often used for * "identity" purposes. * * **Related:** `StringKeys` */ type NonStringKeys = { [K in keyof T]: K extends string ? never : Readonly }[keyof T]; //#endregion //#region src/dictionary/ObjectKeys.d.ts type Shaped = [] extends TKeys ? [...L, ...Partial, ...Partial] : IsTemplateLiteral> extends true ? First$1 & string extends infer Pattern extends string ? Shaped, TOpt, L, O, [...V, ...Pattern[]]> : never : Contains> extends true ? Shaped, TOpt, L, [...O, First$1], V> : Shaped, TOpt, [...L, First$1], O, V>; type HandleDict = Required extends Record ? IsNever extends true ? TObj extends Dictionary ? [] : PropertyKey[] : IsEqual extends true ? ObjectKey[] : IsEqual extends true ? string[] : IsEqual extends true ? symbol[] : IsEqual extends true ? number[] : IsNever extends true ? PropertyKey[] : IsNever> extends true ? IsLiteralString extends true ? Shaped, readonly PropertyKey[]>, OptionalKeysTuple> : IsUnion extends true ? Shaped, readonly PropertyKey[]>, OptionalKeysTuple> : K[] : [...UnionToTuple>, ...(GetIndexKeys)[]] : never; /** * **ObjectKeys**`` * * Provides the keys of a given object in a tuple form. * * **Related:** `Keys`, `OptionalKeys`, `RequiredKeys`, `NumericKeys` */ type ObjectKeys = [IsAny] extends [true] ? Err<`invalid-type/object-keys`, `Call to ObjectKeys where T was 'any'!`> : IsNever extends true ? Err<`invalid-type/object-keys`, `Call to ObjectKeys where T was 'never'!`> : TObj extends object ? TObj extends Map ? IsUnion extends true ? IsLiteralUnion extends true ? Required, readonly PropertyKey[]>, OptionalKeysTuple>> : IsWideUnion extends true ? UnionToTuple[] : "mixed" : K[] : TObj extends Set ? Err<`invalid-type/object-keys`, `The type passed into ObjectKeys was a Set. Set's do not have keys`> : TObj extends WeakMap ? IsUnion extends true ? K : K extends Scalar | object | readonly unknown[] ? K[] : unknown : Required extends Record ? IsNever extends true ? TObj extends Dictionary ? [] : PropertyKey[] : IsEqual extends true ? ObjectKey[] : IsEqual extends true ? RemoveIndexKeys> extends Record ? [...(As>>, readonly PropertyKey[]>), ...string[]] : PropertyKey[] : IsNever extends true ? PropertyKey[] : TObj extends Dictionary ? HandleDict : K[] : ObjectKey[] : Err<`invalid-type/object-keys`, `The type passed into ObjectKeys was not an object!`, { value: TObj; }>; //#endregion //#region src/dictionary/OnlyFixedKeys.d.ts /** * **OnlyFixedKeys**`` * * Removes all index index keys to leave a dictionary with only the * _fixed_ keys defined in `T`. * * **Related:** `GetFixedKeys`, `OnlyIndexKeys`, `GetIndexKeys` */ type OnlyFixedKeys = T extends Dictionary ? WithKeys, PropertyKey>> : never; //#endregion //#region src/dictionary/OnlyIndexKeys.d.ts type ExtractIndexKeysFromObj = { [K in keyof T as string extends K ? K : number extends K ? K : symbol extends K ? K : never]: T[K] }; type GetTemplateLiteralIndexes = TKeys extends [infer Head extends ObjectKey, ...infer Rest extends readonly ObjectKey[]] ? IsTemplateLiteral extends true ? GetTemplateLiteralIndexes> : GetTemplateLiteralIndexes : ExpandDictionary; /** * **OnlyIndexKeys**<`T`> * * Returns a dictionary with all fixed keys removed and only _index_ * signatures remaining. * * - index can be wide-type indexes such as `{ [x: string]: string }` * - but they can also be _template literal_ indexes like `{ [x: `_${string}`]: string }` * * **Related: `GetIndexKeys` */ type OnlyIndexKeys = ExpandDictionary & GetTemplateLiteralIndexes>>; //#endregion //#region src/dictionary/OptionalKeys.d.ts /** * **OptionalKeys**`` * * Provides a union type of the _keys_ in `T` which are * **optional** properties. * * **Note:** you also may optionally filter further by specifying a value * by the _value_ of the key and then only keys which are required AND * who extend `V` will be included in the union. * * **Related:** `OptionalKeys`, `RequiredProps` * Provides a union type of the _keys_ in `T` which are * **required** properties. * * **Note:** you also may optionally filter further by specifying a value * by the _value_ of the key and then only keys which are required AND * who extend `V` will be included in the union. * * **Related:** `RequiredKeys`, `RequiredProps` */ type OptionalKeys = T extends Dictionary ? { [K in keyof T]-?: EmptyObject extends { [P in K]: T[K] } ? If, K, K extends V ? K : never> : never }[keyof T] : never; /** * **OptionalKeysTuple**`` * * Provides a tuple of the _keys_ in `T` which are * **optional** properties. * * **Related:** `RequiredKeys`, `OptionalProps` */ type OptionalKeysTuple = T extends Dictionary ? As>, "equals", [boolean]>, readonly ObjectKey[]> : never; //#endregion //#region src/dictionary/OptionalProps.d.ts /** * **OptionalProps** * * Reduces an object to only key/value pairs where the key is optional */ type OptionalProps = EmptyObject extends RemoveIndexKeys>> ? RemoveIndexKeys>> : never; //#endregion //#region src/dictionary/OptRecord.d.ts /** * **OptRecord**`` * * Create a Record with the optional property set. */ type OptRecord = MakeKeysOptional, [T]>; //#endregion //#region src/dictionary/PascalKeys.d.ts type Convert$7, readonly (ObjectKey & keyof T)[]>, O extends Dictionary = EmptyObject> = K extends [infer Head extends ObjectKey & keyof T, ...infer Rest extends readonly (ObjectKey & keyof T)[]] ? Convert$7, string>, T[Head] extends Dictionary ? PascalKeys : T[Head]> : Record : T[Head]>)> : ExpandRecursively; /** * **PascalKeys**`` * * Converts an object's keys to the **PascalCase** equivalent * while keeping the values the same. */ type PascalKeys = Required extends infer ReqDict extends Dictionary ? Convert$7 extends infer ReqDict extends Dictionary ? OptionalKeysTuple extends infer OptKeys extends readonly ObjectKey[] ? { [K in keyof OptKeys]: OptKeys[K] extends string ? PascalCase : OptKeys[K] } extends infer OptKeys extends readonly ObjectKey[] ? MakeKeysOptional : never : never : never : never; //#endregion //#region src/dictionary/ReadonlyKeys.d.ts type MyEqual = (() => X extends A ? 0 : 1) extends (() => X extends B ? 0 : 1) ? true : false; type isReadonly = MyEqual<{ [P in K]: T[P] }, { readonly [P in K]: T[P] }>; /** * **ReadonlyKeys**`` * * Creates a union of properties in `T` which are readonly. */ type ReadonlyKeys = keyof { [K in keyof T as isReadonly extends true ? K : never]: T[K] }; //#endregion //#region src/dictionary/ReadonlyProps.d.ts /** * **ReadonlyProps**`` * * Reduces an object down to just the key/value pairs which * are readonly. */ type ReadonlyProps = Pick>; //#endregion //#region src/dictionary/RemoveIndexKeys.d.ts type Arr$1 = { [K in keyof T as number extends K ? never : string extends K ? never : symbol extends K ? never : K]: T[K] }; type FilterDictKeys = { [K in keyof T as string extends K ? never : number extends K ? never : symbol extends K ? never : IsTemplateLiteral extends true ? never : K]: T[K] }; /** * **RemoveIndexKeys**`` * * Removes _index_ keys which permit key/values to be added to an object while * retaining all explicit key/values defined on an object. * * - this includes both _wide_ indexes like `string` but also literal template * indexes like `_${string}` * * ```ts * type Obj = { [key: string]: unknown; foo: 42 }; * // { foo: 42 } * type Obj2 = RemoveIndexKeys; * ``` */ type RemoveIndexKeys = T extends Dictionary ? HasIndexKeys extends true ? Required>> extends infer Keys extends readonly PropertyKey[] ? WithKeys : never : T : T extends readonly any[] ? Arr$1 : never; //#endregion //#region src/dictionary/RequiredKeys.d.ts /** * **RequiredKeys**`` * * Provides a union type of the _keys_ in `T` which are * **required** properties. * * **Note:** you also may optionally filter further by specifying a value * by the _value_ of the key and then only keys which are required AND * who extend `V` will be included in the union. * * **Related:** `OptionalKeys`, `RequiredProps`, `RequiredKeysTuple` */ type RequiredKeys = As<{ [K in keyof T]-?: EmptyObject extends { [P in K]: T[K] } ? never : IfUnset }[keyof T], ObjectKey>; /** * **RequiredKeysTuple**`` * * Provides a tuple of the _keys_ in `T` which are * **required** properties. * * **Related:** `OptionalKeys`, `RequiredProps`, `RequiredKeys` */ type RequiredKeysTuple = UnionToTuple>; //#endregion //#region src/dictionary/RequiredProps.d.ts /** * **RequiredProps**`` * * Reduces an object `T` to only those key/value pairs where the key is required */ type RequiredProps = Pick>; //#endregion //#region src/dictionary/RequireProps.d.ts /** * Given a dictionary of type ``, this utility function will * make the `` generic property _required_ (use a union to make * more than one prop required). * * ```ts * // { foo: string, bar?: number } * type Example = RequireProps<{foo?: string, bar?: number}, "foo">; * ``` */ type RequireProps = ExpandRecursively> & T>; //#endregion //#region src/dictionary/ReverseLookup.d.ts /** * **ReverseLookup**`` * * Inverts a table of string to string lookups so that the values * can now lookup the keys. * * Uses mapped types for O(1) complexity instead of recursive processing, * significantly improving performance for large mappings while preserving * narrow literal types. */ type ReverseLookup> = { [K in keyof T as T[K]]: K }; //#endregion //#region src/dictionary/Set.d.ts type SetAtIndex = K extends keyof T ? { [P in keyof T]: P extends K ? V : T[P] } : T; type StripLeadingDot = T extends `.${infer Rest}` ? Rest : T; type _Set = StripLeadingDot extends `${infer Head}.${infer Tail}` ? T extends readonly unknown[] ? Head extends keyof T ? { [P in keyof T]: P extends Head ? _Set : T[P] } : T : T extends object ? Head extends keyof T ? { [P in keyof T]: P extends Head ? _Set : T[P] } : T & { [P in Head]: _Set } : T : StripLeadingDot extends keyof T ? T extends readonly unknown[] ? SetAtIndex & string, V> : T extends object ? { [P in keyof T]: P extends StripLeadingDot ? V : T[P] } : T : T extends object ? StripLeadingDot extends string | number | symbol ? T & { [P in StripLeadingDot]: V } : T : T; type Set$1>, TValue> = _Set; //#endregion //#region src/dictionary/SetKey.d.ts /** * **SetKeyStrict**` * * Sets one of the keys `TKey` of an object `TObj` to `TValue` * while ensuring that `TVal` extends the _wide_ type of `TObj[TKey]`. * * - if you want `TVal` to be unconstrained, use `ForceSetKey` instead. * - if you want `TVal` to be less constrained, use `SetKey` instead. */ type SetKeyStrict = { [K in keyof TObj]: K extends TKey ? TVal : TObj[K] }; /** * **SetKey**` * * Sets one of the keys `TKey` of an object `TObj` to `TValue` * while ensuring that `TVal` extends the _wide_ type of `TObj[TKey]`. * * - if you want `TVal` to be unconstrained, use `SetKeyForce` * instead. * - if you want to be constrained to the literal type use `SetKeyStrict` */ type SetKey = { [K in keyof TObj]: K extends TKey ? TVal : TObj[K] extends Widen ? TObj[K] : never }; /** * **ForceSetKey**` * * Sets one of the keys `TKey` of an object `TObj` to `TValue` * even if `TValue` doesn't fit the type which `TObj` proposes. * * - if you want `TVal` to be constrained to valid keys of * `TObj` use `SetKey` instead. */ type SetKeyForce = { [K in keyof TObj]: K extends TKey ? TVal : TObj[K] }; //#endregion //#region src/dictionary/SetKeysTo.d.ts /** * **SetKeysTo**`` * * Mutates the type of `TObj` to have all keys specified in `TKeys` to by * typed to the value of `TValue`. */ type SetKeysTo = [] extends TKeys ? ExpandDictionary : SetKeysTo, TValue>, AfterFirst, TValue>; //#endregion //#region src/dictionary/SharedKeys.d.ts /** * **SharedKeys**`` * * Given two objects `A` and `B`, this type utility will provide the * _keys_ which both objects contain. * ```ts * type O1 = { foo: 1; bar: 2; baz: 88 }; * type O2 = { bar: 5; baz: 3; nada: true }; * // ["bar", "baz"] * type X = SharedKeys; * ``` * * **Note:** this is now just an alias to `IntersectingKeys` */ type SharedKeys | object, B extends Record | object> = IntersectingKeys, As>; //#endregion //#region src/dictionary/SimplifyObject.d.ts /** * Often when mutating the shape of an object you will end up with the union of a number of * `Record` and `Record` which is messy to look at and take away meaning. * * This type utility will cleanup an object and return a simple dictionary definition for it. */ type SimplifyObject = ExpandRecursively>>; //#endregion //#region src/dictionary/SnakeKeys.d.ts type Convert$6, readonly (ObjectKey & keyof T)[]>, O extends Dictionary = EmptyObject> = K extends [infer Head extends ObjectKey & keyof T, ...infer Rest extends readonly (ObjectKey & keyof T)[]] ? Convert$6, string>, T[Head] extends Dictionary ? SnakeKeys : T[Head]> : Record : T[Head]>)> : ExpandRecursively; /** * Converts an object's keys to the **kebab-case** equivalent * while keeping the values the same. */ type SnakeKeys = Required extends infer ReqDict extends Dictionary ? Convert$6 extends infer ReqDict extends Dictionary ? OptionalKeysTuple extends infer OptKeys extends readonly ObjectKey[] ? { [K in keyof OptKeys]: OptKeys[K] extends string ? SnakeCase : OptKeys[K] } extends infer OptKeys extends readonly ObjectKey[] ? MakeKeysOptional : never : never : never : never; //#endregion //#region src/dictionary/StringKeys.d.ts /** * **KeysUnion**`` * * Creates a union type of all the _string_ keys in `T`. * * **Related:** `Keys`, `StringKeys` */ type KeysUnion = { [K in keyof T]: K extends string ? Readonly : never }[keyof T]; type _StringKeys = UnionToTuple<{ [K in keyof T]: K extends string ? Readonly : never }[keyof T]>; /** * **SKeys**`` * * Creates a tuple of all _string_ keys of `T`. * * **Related:** `Keys`, `StringKeys` * @deprecated prefer use of `StringKeys` */ type SKeys = IsVueRef extends true ? ["value"] : _StringKeys extends readonly string[] ? _StringKeys : never; /** * **StringKeys**`` * * Creates a tuple of all _string_ keys of `T`. * * **Related:** `Keys` */ type StringKeys = IsVueRef extends true ? ["value"] : _StringKeys extends readonly string[] ? _StringKeys : never; //#endregion //#region src/dictionary/TakeProp.d.ts /** * **TakeProp**`` * * Takes the property `TTest` and determines if `TProp` is a key of * of `TTest`. If it is it will return `TTest[TProp]` otherwise `TElse` * (which is defaulted to _undefined_). */ type TakeProp = TProp extends keyof TTest ? TTest[TProp] : TElse; //#endregion //#region src/dictionary/UpsertKeyValue.d.ts type Process$56 = K extends keyof TObj ? Omit & Record : TObj & Record; /** * **UpsertKeyValue**`` * * Updates the object `TObj` with the provided KV when keys overlap, * otherwise just adds the KV to `TObj`. * * **Related:** `AddKeyValue` */ type UpsertKeyValue = ExpandRecursively>; //#endregion //#region src/dictionary/ValidKey.d.ts /** * **ValidKey** * * Similar to the `Keys` utility but returns a union of values * which are considered valid for the container. * * **Related**: `Keys` */ type ValidKey = TupleToUnion>>; //#endregion //#region src/dictionary/Values.d.ts type Validate$10 = [IsAny] extends [true] ? Err<`invalid-type/values`, `Values was called where T was the 'any' type`> : [IsNever] extends [true] ? Err<`invalid-type/values`, `Values was called where T was the 'never' type`> : T; type GetValues = [] extends TKeys ? TAcc : Required extends readonly [infer First, ...infer Rest] ? First extends keyof TObj ? Rest extends readonly PropertyKey[] ? IsTuple extends true ? UnionMemberEquals extends true ? GetValues : GetValues : GetValues : never : never : TAcc; /** * **Values**`` * * Produces a tuple of all the _values_ in an object. * * - you _can_ run it on a tuple too but this is in effect an identity * function and will just return the tuple's values/types "as is" * - passing in `any` or `never` to this utility will result in an Error */ type Values = As extends Error ? Validate$10 : T extends readonly unknown[] ? T : Keys$1 extends readonly unknown[] ? number extends Keys$1["length"] ? T extends Record ? V[] : T extends readonly (infer V)[] ? V[] : unknown[] : GetValues> extends infer V extends readonly unknown[] ? OptionalKeysTuple["length"] extends infer OptNum extends number ? OptNum extends 0 ? GetValues> : MakeKeysOptional : GetValues> : never : never, readonly unknown[]>; //#endregion //#region src/dictionary/WithKeys.d.ts type MakeIntoUnion = K extends readonly PropertyKey[] ? TupleToUnion : K; type MakeNumericIndex = T; /** * **WithKeys**`` * * This type utility will ensure that the type `T` will _retain_ the key/value * pairs which extend `K`. * * It is very similar to **Pick** but rather `K` being restricted to * being a string union, wth **WithKeys** you can use the union type * or a readonly array of strings. * * ```ts * type Test = { foo: 1, bar: number, baz: string }; * // { foo: 1, bar: number } * type T1 = WithKeys; // Pick syntax * type T2 = WithKeys; * ``` */ type WithKeys = ExpandRecursively extends keyof T ? T extends Tuple$1 ? MakeNumericIndex>> : Pick> : never>>; //#endregion //#region src/dictionary/WithNumericKeys.d.ts /** * **WithNumericKeys**`` * * Reduces an object to only the key/value pairs where the key is numeric. */ type WithNumericKeys = Omit>; //#endregion //#region src/dictionary/WithoutKeys.d.ts /** * **WithoutKeys**`` * * Removes the keys in `TKeys` from an object `TObj`. * * **Note:** This is functionally equivalent to the `Omit` built-in but: * * - allows passing in a union type (like Omit) * - or a tuple of ObjectKey's (distinct from Omit). */ type WithoutKeys = TKeys extends readonly ObjectKey[] ? Omit : TKeys extends ObjectKey ? ExpandDictionary> : never; //#endregion //#region src/dictionary/WithoutValue.d.ts /** * **WithoutValue** * * Reduces an object's type down to only those key/value pairs where the * value is **NOT** of type `W`. * * ```ts * const foo = { a: 1, b: "hi", c: () => "hello" } * // { a: 1, b: "hi" } * type W = WithValue * ``` * * You manually exclude keys as well by setting the optional `E` generic. */ type WithoutValue = Mutable>>>; //#endregion //#region src/dictionary/WithStringKeys.d.ts /** * **WithStringKeys**`` * * Reduces an object to only the key/value pairs where the key is a * string. */ type WithStringKeys = Omit>; //#endregion //#region src/dictionary/WithValue.d.ts type Marked$1 = typeof MARKED; type Process$55 = RemoveMarked<{ [K in keyof TObj]: If : Extends, TObj[K], Marked$1> }>; /** * **WithValue**`` * * Reduces an object's type down to only those key/value pairs where the * value is of type `W`. * ```ts * const foo = { a: 1, b: "hi", c: () => "hello" } * // { c: () => "hello" } * type W = WithValue * ``` * * **Related:** `WithoutValue`, `WithKeys`, `WithoutKeys` */ type WithValue = ExpandRecursively>; //#endregion //#region src/interpolation/IsStaticTemplate.d.ts type Curly, O extends string = never> = K extends [infer Head extends string, ...infer Rest extends readonly string[]] ? Curly : O; /** * **IsStaticTemplate**`` * * A boolean operator which indicates whether any of the dynamic segments * defined in `TSegments` was found in `TContent`. */ type IsStaticTemplate = Contains>; //#endregion //#region src/type-conversion/AsBoolean.d.ts /** * **AsBoolean**`` * * Converts any `BooleanLike` value to a boolean value * and return `never` otherwise. */ type AsBoolean = T extends boolean ? T : T extends "true" ? true : T extends "false" ? false : T extends "boolean" ? boolean : never; //#endregion //#region src/type-conversion/AsContainer.d.ts /** * **AsContainer**`` * * Evaluates `T` and if it finds union type which includes a container * type then it narrows it to just the container types. * * - If `T` has no ability to be a container the type `TNever` is returned * (which defaults to the type of `never`) */ type AsContainer = T extends readonly unknown[] ? T & readonly unknown[] : T extends Dictionary ? T & Dictionary : TError; //#endregion //#region src/type-conversion/AsDefined.d.ts /** * **AsDefined**`` * * Ensures that if `T` includes _undefined_ as part of a union, it is * removed. */ type AsDefined = Exclude; //#endregion //#region src/type-conversion/AsDictionary.d.ts type AsDictionary = T extends Dictionary ? T : never; //#endregion //#region src/type-conversion/AsFromTo.d.ts /** converts an object's key values into FromTo tuple */ type ConvertFromTo = Values<{ [K in keyof TObj]: { from: K; to: TObj[K]; } }>; /** * **AsFromTo**`` * * Converts: * - an object KV is converted into a `FromTo[]` tuple * * **Notes:** * - any value which is already a FromTo will be kept as is * - any value which is _not_ a number will be converted to a `NumberLike` string and added * - any value which is neither a string or any of the above will be discarded */ type AsFromTo> = IsLiteralLikeObject extends true ? ConvertFromTo extends readonly FromTo[] ? ConvertFromTo : never : FromTo[]; //#endregion //#region src/type-conversion/AsFunction.d.ts /** * **AsFunction** * * Attempts to narrow `T` to a string type where possible. * * **Related:** `ToString` */ type AsFunction = TTest & ((args: TArgs) => unknown); //#endregion //#region src/type-conversion/AsNonNull.d.ts type InvalidCast = Err<"invalid-cast", `An attempt to cast a type as being non-null based was unsuccessful!`, { library: "inferred-types/constants"; value: T; }>; /** * **AsNonNull**`` * * A narrowing utility which ensures that a union type which includes a `null` * option will have the **null** option removed. * * **Note:** if `T` is _equal to **null** then an `ErrorCondition<"invalid-cast">` * will be raised. */ type AsNonNull = If, InvalidCast, IsUnion extends true ? TupleToUnion, "extends", [null]>> : T> extends null ? never : If, InvalidCast, IsUnion extends true ? TupleToUnion, "extends", [null]>> : T>; //#endregion //#region src/type-conversion/AsNumber.d.ts /** * **ParseInt**`` * * Converts a known string literal representation of a number * to an actual number. */ type ParseInt = T extends `${infer Int}.${infer Dec}` ? StripChars extends "" ? Int extends `${infer N extends number}` ? N : never : `${Int}.${TrimCharEnd}` extends `${infer N extends number}` ? N : never : T extends `${infer N extends number}` ? N : never; type JustZeros = T extends `${infer HEAD extends string}${infer REST extends string}` ? HEAD extends "0" ? JustZeros : false : true; /** * Addresses the possibility of leading zeros for both integer values * and decimal values, positive and negative values */ type Handler = StartsWith extends true ? Contains extends true ? JustZeros> extends true ? As<`0.${RetainAfter}`, `${number}`> : As, `${number}`> : JustZeros extends true ? "0" : StripWhile : StartsWith extends true ? As<`0${T}`, `${number}`> : T; /** * **AsNumber**`` * * Returns a _number_ for `T` where `T` extends a _number_ or * `${number}` type; otherwise return _never_. Literal types are * preserved. * * ```ts * // 4 * type Num = AsNumber<"4">; * ``` * **Related:** `ToNumber` */ type AsNumber = IsBranded extends true ? AsNumber> : T extends number ? T : T extends `${number}` ? StartsWith extends true ? ParseInt<`-${Handler, `${number}`>>}`> : ParseInt> : never; //#endregion //#region src/type-conversion/AsObject.d.ts /** * **AsObject** * * Proxies through any ony existing object, but will also * convert a `KeyValueTuple` into an object. */ type AsObject = T extends Dictionary ? T : T & Dictionary; //#endregion //#region src/type-conversion/AsObjectKeys.d.ts /** * **AsObjectKeys**`` * * Narrows type by validating that `T` extends a tuple of only * values which extend `ObjectKey`. */ type AsObjectKeys = T extends readonly ObjectKey[] ? T : never; /** * **AsObjectKey**`` * * Narrows type by validating that `T` extends `ObjectKey`. */ type AsObjectKey = T extends ObjectKey ? T : never; //#endregion //#region src/type-conversion/AsPropertyKey.d.ts /** * **AsPropertyKey**`` * * Ensures that `T` is a property key or, if a tuple is passed in, that * all values extend `PropertyKey` */ type AsPropertyKey = T extends PropertyKey ? T : never; //#endregion //#region src/type-conversion/AsRecord.d.ts /** * **AsRecord**`` * * Receives a `Record`, `object`, or `Tuple` and ensures the type * is a `Record` type for all object-like types and just passes * Tuples through "as is". */ type AsRecord = T extends Tuple$1 ? T : T extends Dictionary ? T : T extends object ? T extends any[] ? never : NonNullable : never; //#endregion //#region src/type-conversion/AsRef.d.ts type AsRef = T extends Container ? T & { value: unknown; } : never; //#endregion //#region src/type-conversion/AsString.d.ts type OnlyString = As, readonly string[]>; /** * **AsString** * * Attempts to convert `T` to a string type where possible. * * - will convert any string, boolean, or numeric value * to a string value * - `42` -> `"42"` * - number -> `${number}` * - true -> `"true"` * - union types who's elements include at least one element of * `string` | `number | `boolean` will be converted to an appropriate * string literal: * - `"foo" | 42 | true` will be converted to `"foo" | "42" | "true"` * - wide `string[]` arrays will be converted to `string` * - a tuple of values will be made into a JS string representing that type: * - `[string, number, "foo"]` -> `"[ string, number 'foo' ]""` * * **Related:** `ToString` */ type AsString = [string] extends [T] ? string : [T] extends [string] ? T : [IsUnion] extends [true] ? OnlyString>[number] : [T] extends [number] ? `${T}` : [T] extends [boolean] ? `${T}` : [T] extends [readonly (unknown)[]] ? IsWideArray extends true ? T extends (infer Type extends string | number | boolean)[] ? `${Type}` : never : ToJsonArray : [T] extends [object] ? [T] extends [Dictionary] ? ToJsonObject : never : never; //#endregion //#region src/type-conversion/AsStringUnion.d.ts type ConvertUnion$1 = TupleToUnion<{ [K in keyof T]: [T[K]] extends [string] ? T[K] : [T[K]] extends [number] ? `${T[K]}` : [T[K]] extends [boolean] ? `${T[K]}` : [THandle] extends ["drop"] ? never : T[K] }>; /** * **AsStringUnion**`` * * A type conversion utility which ensures unions (and a few literals) are * converted to string literal variants: * * - if `T` is a union type, all _numeric_ or _boolean_ elements in the union * will be converted to a string literal equivalent and others will be dropped * - if you would prefer non-convertible types are left as part of the union * you can set the `THandle` to "proxy" (instead of the default "drop") * * For non-union types, the goal is to address a similar outcome which is: * * - if `T` is of type `number` or `boolean` then this is converted to a * string literal equivalent * - all other types result in `never` or are just proxied through if * `THandle` is set to "proxy" */ type AsStringUnion = [IsUnion] extends [true] ? ConvertUnion$1, THandle> : [T] extends [string] ? T : [T] extends [number] ? `${T}` : [T] extends [boolean] ? `${T}` : [THandle] extends ["drop"] ? never : T; //#endregion //#region src/type-conversion/AsTuple.d.ts /** * **AsTuple**`` * * Similar to `AsArray` but will convert union types to tuples as well * as scalar values. */ type AsTuple = IsUnion extends true ? UnionToTuple : IsArray extends true ? T : [T]; //#endregion //#region src/type-conversion/AsUnion.d.ts /** * **AsUnion**`` * * Converts any tuple into a union based on the tuples elements. Otherwise, * simply passes `T` through unchanged. */ type AsUnion = T extends readonly any[] ? T[number] : T; //#endregion //#region src/type-conversion/Awaited.d.ts /** * **Awaited**`` * * Unwraps the expected return value inside a promise-like * result. */ type Awaited$1 = T extends Promise ? Type : T extends PromiseLike ? Type : T extends Thenable ? ReturnType : never; //#endregion //#region src/type-conversion/BaseType.d.ts type BaseType = T extends string ? string : T extends number ? number : IsNull extends true ? null : IsUndefined extends true ? undefined : T extends boolean ? boolean : T extends readonly unknown[] ? readonly unknown[] : T extends Dictionary ? Dictionary : T extends AnyMap ? AnyMap : T extends AnySet ? AnySet : T extends AnyWeakMap ? AnyWeakMap : unknown; //#endregion //#region src/type-conversion/Break.d.ts /** * **Break** * * Takes a string `T`, and splits it into a tuple of the form `[F, R]`. * ```ts * // ["the", " long and winding road"] * type T1 = Break<"the long and winding road", " ">; * // ["there", " I was, there I was"] * type T2 = Break<"there I was, there I was", " ">; * ``` * * **Related:** `Split` */ type Break$1 = (string extends T ? [string, string] : (T extends `${infer F}${D}${infer _R}` ? (F extends `${infer _X}${D}${infer _Y}` ? never : (T extends `${F}${infer R}` ? [F, R] : never)) : [T, ""])); //#endregion //#region src/type-conversion/encoding/EncodingDefinition.d.ts /** * **EncodingDefinition**`` * * An encoding and decoding tuple for converting one * string literal type to another. */ interface EncodingDefinition> { kind: "EncodingDefinition"; defn: TDefn; } //#endregion //#region src/type-conversion/encoding/EncodingLookups.d.ts type SafeEncoding__Quotes = Mutable; type SafeEncoding__Whitespace = Mutable; type SafeEncoding__Brackets = Mutable; type SafeEncodingKey__Quotes = keyof SafeEncoding__Quotes; type SafeEncodingKey__Whitespace = keyof SafeEncoding__Whitespace; type SafeEncodingKey__Brackets = keyof SafeEncoding__Brackets; type SafeDecodingKey__Quotes = Values[number]; type SafeDecodingKey__Whitespace = Values[number]; type SafeDecodingKey__Brackets = Values[number]; type SafeEncodingConversion = [] extends T ? R : SafeEncodingConversion, [...R, ...(First$1 extends "quotes" ? AsFromTo : First$1 extends "brackets" ? AsFromTo : First$1 extends "whitespace" ? AsFromTo : [])]>; type Esc = { [K in keyof T]: { from: Concat<[BackTick, T[K]["from"]]>; to: T[K]["to"]; } }; type EscapedSafeEncodingConversion = [] extends T ? R : SafeEncodingConversion, [...R, ...(First$1 extends "quotes" ? Esc> : First$1 extends "brackets" ? Esc> : First$1 extends "whitespace" ? Esc> : [])]>; type SafeDecodingConversion = [] extends T ? R : SafeDecodingConversion, [...R, ...(First$1 extends "quotes" ? AsFromTo> : First$1 extends "brackets" ? AsFromTo> : First$1 extends "whitespace" ? AsFromTo> : [])]>; //#endregion //#region src/type-conversion/encoding/SafeDecode.d.ts /** * **SafeDecode**`` * * Decodes an encoded `SafeString` back to a normal string. * Groups are: * * - "whitespace" * - "quotes" * - and "brackets" * * By default ALL are used. */ type SafeDecode = IsStringLiteral extends true ? ReplaceAllFromTo> : string; //#endregion //#region src/type-conversion/encoding/SafeEncode.d.ts /** * **SafeEncode**`` * * Encodes string into a `SafeString` using some or all of the * "safe key" groups. Groups are: * * - "whitespace" * - "quotes" * - and "brackets" * * By default ALL are used. * * **Related:** `SafeEncodeEscaped` */ type SafeEncode = IsStringLiteral extends true ? ReplaceAllFromTo> : SafeString; /** * **SafeEncodingEscaped**`` * * Looks for _escaped characters_ in `T` and applies safe encoding to * only those characters which have been explicitly marked via the `\` * escape notation. */ type SafeEncodeEscaped = IsStringLiteral extends true ? ReplaceAllFromTo> : SafeString; //#endregion //#region src/type-conversion/encoding/SafeEncodingGroup.d.ts type SafeEncodingGroup = "whitespace" | "brackets" | "quotes"; //#endregion //#region src/type-conversion/encoding/SafeString.d.ts /** * **SafeString** * * A string which was encoded using `safeEncode()` runtime utility or `SafeEncode` type * utility. It is a string which has had one of several "groups" of characters replaced * (aka., encoded) into a safe token value. * * - use `safeDecode()` or `SafeDecode` utilities to move back to the original string value. */ type SafeString = Brand; encoded: T; }>; //#endregion //#region src/type-conversion/encoding/StringEncoder.d.ts /** * **StringEncoder** * * A base type for _string encoders_ which take a string and convert * to anther type of string. */ type StringEncoder = (input: T) => R; //#endregion //#region src/type-conversion/form-fields.d.ts /** * **Email** * * A simple email address representation * * **Related:** `IsEmail`, `isEmail()` */ type Email = `${string}@${string}.${T}`; //#endregion //#region src/type-conversion/Immutable.d.ts type NeverOnSet = T extends `set${infer Name}` ? Name extends Capitalize ? never : T : T; /** * **Immutable**`` * * An alternative to `Readonly` but adds: * * - removes the types of all _setter_ methods in the values of `T` * - deeply sets container properties as read-only (rather than just top level properties) * * **Related:** `immutable()`, `freeze()`, `var Object.freeze()` */ type Immutable = Expand<{ readonly [K in keyof T as T[K] extends AnyFunction ? NeverOnSet : K]: T[K] extends object ? TDeep extends false ? T[K] : Immutable : T[K] }>; //#endregion //#region src/type-conversion/IntersectionToTuple.d.ts type IntersectionToTuple = (T extends any ? (x: T) => void : never) extends ((x: infer U) => void) ? [...IntersectionToTuple>, U] : []; //#endregion //#region src/type-conversion/LeftWhitespace.d.ts /** * Provides the _left_ whitespace of a string * ```ts * // "\n\t " * type T = LeftWhitespace<"\n\t foobar">; * ``` */ type LeftWhitespace = string extends S ? string : Replace extends string ? TrimLeft : never, "">; //#endregion //#region src/type-conversion/MapKeys.d.ts type CaseOptions = "none" | "PascalCase" | "CamelCase" | "SnakeCase" | "KebabCase"; interface MapKeysOptions { /** * Indicates whether to replace _all_ `from` instances in the key or * just the first one. Default is `true`. */ replaceAll: boolean; /** * switch the _casing_ standard of all keys (camelCase, PascalCase, etc.) */ casing: CaseOptions; } interface DEFAULT extends MapKeysOptions { replaceAll: true; casing: "none"; } type Process$54 = DEFAULT> = TConfig extends readonly FromTo[] ? TOpt["replaceAll"] extends false ? { [K in keyof TObj as ReplaceFromTo]: TObj[K] extends Dictionary ? Process$54 : TObj[K] } : { [K in keyof TObj as ReplaceAllFromTo]: TObj[K] extends Dictionary ? Process$54 : TObj[K] } : TConfig extends Dictionary ? AsFromTo extends infer Config extends readonly FromTo[] ? Process$54 : never : TConfig extends EmptyObject ? TObj : never; type Go | readonly FromTo[]> = T extends readonly FromTo[] ? T : T extends Dictionary ? AsFromTo : never; /** * **MapKeys**`` * * Maps a given `TObj`'s keys to a variant set of keys. * * - keys are mapped with `TMap` * - `TMap` can either be a dictionary config or a tuple of `FromTo` instructions * - the TMap transforms are done _before_ any "case-based" transforms from * the options hash. * * - `TOpt` allows you to express: * - `deep` - whether the traversal should be deep or not (default is **true**) * - `replaceAll` - whether _all instances_ of `from` in the key should be replaced * or just the first instance (default is **true**) * * ```ts * // { Foo: { Bar: 2 }} * type Obj = MapKeys<{ _foo_: { _bar_: 2 }}, [ * { from: "f"; to: "F" }, * { from: "b"; to: "B" }, * { from: "_"; to: "" } * ]> * ``` */ type MapKeys, TOpt extends Partial = DEFAULT> = Go extends infer Config extends readonly FromTo[] ? TOpt["casing"] extends "CamelCase" ? Process$54 extends infer Camel extends Dictionary ? CamelKeys : never : TOpt["casing"] extends "PascalCase" ? PascalKeys> : TOpt["casing"] extends "KebabCase" ? KebabKeys> : TOpt["casing"] extends "SnakeCase" ? SnakeKeys> : Process$54 : never; //#endregion //#region src/type-conversion/Merge.d.ts /** * **MergeScalars**`` * * Provides a `Scalar` value by evaluating whether `TDefault` * and `TOverride` extends `TEmpty` (which is `null` | `undefined` * by default). * * Note: if both `TDefault` and `TOverride` are _undefined_ then the * exiting type will be _undefined_ (which isn't strictly a `Scalar` * value). */ type MergeScalars = TDefault extends TEmpty ? TOverride : TOverride extends TEmpty ? TDefault : TOverride; type MergeTuplesAcc = TOverride extends [infer Override, ...infer Rest extends unknown[]] ? If, MergeTuplesAcc, Rest, TKey, [...TResults, First$1]>, MergeTuplesAcc, Rest, TKey, [...TResults, Override]>> : readonly [...TResults, ...TDefault]; /** * **MergeTuples** * * Merges two tuple arrays by position in the tuple: * * - if `TOverride` is longer than `TDefault` then no defaults will be provided * - if `TDefault` is longer than `TOverride` then `TDefault` will be extended */ type MergeTuples = MergeTuplesAcc<[...TDefault], [...TOverride], TKey>; type Process$53 = And<[DoesExtend, DoesExtend]> extends true ? MergeObjects, AsDictionary> : And<[DoesExtend, DoesExtend]> extends true ? MergeScalars : And<[DoesExtend, DoesExtend]> extends true ? MergeTuples : never; /** * **Merge**`` * * A type utility that will merge any two like values together. * * **Related:** `MergeObjects`, `MergeScalars`, `MergeTuples` */ type Merge = AreSameType extends true ? Process$53 : IsNothing extends true ? TOverride : Err<"invalid-merge", `Merge received two empty values; at least one needs to have a value!`, { library: "inferred-types/constants"; TDef: TDefault; TOver: TOverride; }>; //#endregion //#region src/type-conversion/MergeObjects.d.ts /** * **MergeObjects**`` * * A type utility that _shallowly merges_ two object types. * * Properties in TOverride will override properties in TDef. * This implementation avoids excessive recursion when dealing with optional properties. */ type MergeObjects = ExpandDictionary & TOverride>; //#endregion //#region src/type-conversion/Mutable.d.ts type MutableObject = [T] extends [boolean] ? T : { -readonly [K in keyof T]: T[K] extends Dictionary ? Mutable> : IsTuple extends true ? Mutable : T[K] extends readonly (infer R)[] ? [...R[]] : Mutable }; type MutableArray = [...{ [K in keyof T]: Mutable }]; /** * **Mutable**`` * * Makes a readonly type -- either a dictionary or an array -- into a mutable value without * widening the type. */ type Mutable = [IsUnion] extends [true] ? T : [T] extends [infer Arr extends readonly unknown[]] ? MutableArray : [T] extends [infer Dict extends Dictionary] ? MutableObject : T; //#endregion //#region src/type-conversion/numeric/HexToDecimal.d.ts type H2D = Lowercase extends "f" ? 15 : Lowercase extends "e" ? 14 : Lowercase extends "d" ? 13 : Lowercase extends "c" ? 12 : Lowercase extends "b" ? 11 : Lowercase extends "a" ? 10 : Lowercase extends "9" ? 9 : Lowercase extends "8" ? 8 : Lowercase extends "7" ? 7 : Lowercase extends "6" ? 6 : Lowercase extends "5" ? 5 : Lowercase extends "4" ? 4 : Lowercase extends "3" ? 3 : Lowercase extends "2" ? 2 : Lowercase extends "1" ? 1 : 0; type _HexToDecimalArray = As<{ [K in keyof T]: H2D }, readonly number[]>; type HexByte = Lowercase extends "0" ? H2D : Lowercase extends "1" ? [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31][H2D] : Lowercase extends "2" ? [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47][H2D] : Lowercase extends "3" ? [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63][H2D] : Lowercase extends "4" ? [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79][H2D] : Lowercase extends "5" ? [80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95][H2D] : Lowercase extends "6" ? [96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111][H2D] : Lowercase extends "7" ? [112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127][H2D] : Lowercase extends "8" ? [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143][H2D] : Lowercase extends "9" ? [144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159][H2D] : Lowercase extends "a" ? [160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175][H2D] : Lowercase extends "b" ? [176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191][H2D] : Lowercase extends "c" ? [192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207][H2D] : Lowercase extends "d" ? [208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223][H2D] : Lowercase extends "e" ? [224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239][H2D] : [240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255][H2D]; type HexCharsToDecimal = T extends readonly [infer A extends HexadecimalChar, infer B extends HexadecimalChar, ...infer Rest extends readonly HexadecimalChar[]] ? TDepth["length"] extends 64 ? number[] : HexCharsToDecimal], [...TDepth, unknown]> : T extends readonly [infer A extends HexadecimalChar] ? [...V, H2D] : V; /** * **HexToDecimal**`` * * Iterates left-to-right, peeling off two hexadecimal digits at a time * until there are only 0 or 1 digits left (adds final digit if 1 is left). * What is left is an array of decimal numbers ranging from 0-255. * * ```ts * // [15] * type T1 = HexToDecimal<"f">; * // [255] * type T2 = HexToDecimal<"ff"> * // [255] * type T3 = HexToDecimal<"0xFF"> * // [255, 238, 9] * type T4 = HexToDecimal<"ffee09"> * ``` */ type HexToDecimal = T extends number ? number extends T ? number[] : [T] : T extends `0x${infer Rest}` ? HexToDecimal : T extends "" ? [0] : string extends T ? number[] | Err<"invalid-type/hexadecimal"> : IsHexadecimal extends true ? string extends T ? number | Error : Chars> extends readonly HexadecimalChar[] ? HexCharsToDecimal>> : never : Err<"invalid-type/hexadecimal">; /** * HexToDecimalArray * * convert a hexadecimal number into an array of decimal numbers * on a digit by digit basis. * * **Related:** `HexToDecimal` */ type HexToDecimalArray = string extends T ? number | Error : T extends `0x${infer Rest}` ? HexToDecimalArray : T extends "" ? [0] : IsHexadecimal extends true ? Chars> extends readonly HexadecimalChar[] ? _HexToDecimalArray>> : never : Err<"invalid-type/hexadecimal">; //#endregion //#region src/type-conversion/ObjectToCssString.d.ts type Prefix$4 = As; type Process$52 = Join<{ [K in keyof T]: T[K]["key"] extends infer Key extends string ? `${Prefix$4}${Key}: ${AsString}` : never }, "; ">; /** * **ObjectToCssString**`` * * Converts a Javascript object into a CSS representation. * * **Related:** `ObjectToJsString`, `ObjectToJsonString`, `ObjectToTuple` */ type ObjectToCssString = Keys$1["length"] extends 0 ? "{}" : IsWideObject extends true ? IsEqual extends true ? "{}" : `{${string}}` : TObj extends ExplicitlyEmptyObject ? "{}" : Process$52>, false> extends infer P extends string ? Surround : never; //#endregion //#region src/type-conversion/ObjectToJsonString.d.ts type Prefix$3 = T extends true ? "\n " : ""; type Process$51 = Join<{ [K in keyof T]: T[K]["key"] extends string ? T[K]["value"] extends string ? `${Prefix$3}"${T[K]["key"]}": "${T[K]["value"]}"` : `${Prefix$3}"${T[K]["key"]}": ${AsString}` : never }, ", ">; /** * **ObjectToJsonString**`` * * Converts a Javascript object into a JSON string representation. * * **Related:** `ObjectToCssString`, `ObjectToJsString`, `ObjectToTuple` */ type ObjectToJsonString = TObj extends ExplicitlyEmptyObject ? "{}" : IsWideContainer extends true ? string : `{ ${Process$51, TExpand>} }`; //#endregion //#region src/type-conversion/ObjectToJsString.d.ts type Prefix$2 = T extends true ? "\n " : ""; type Process$50 = Join<{ [K in keyof T]: T[K]["key"] extends string ? T[K]["value"] extends string ? `${Prefix$2}${T[K]["key"]}: "${T[K]["value"]}"` : `${Prefix$2}${T[K]["key"]}: ${AsString}` : T[K]["key"] extends symbol ? T[K]["value"] extends string ? `${Prefix$2}[key: symbol]: "${T[K]["value"]}"` : `${Prefix$2}[key: symbol]: ${AsString}` : never }, ", ">; /** * **ObjectToJsString**`` * * Converts a Javascript object into a string representation. * * **Related:** `ObjectToCssString`, `ObjectToJsonString`, `ObjectToTuple` */ type ObjectToJsString = TObj extends ExplicitlyEmptyObject ? "{}" : IsWideContainer extends true ? string : `{ ${Process$50, TExpand>} }`; //#endregion //#region src/type-conversion/ObjectToKeyframeString.d.ts type Prefix$1 = T extends true ? "\n " : ""; type Process$49[], E extends boolean> = Join<{ [K in keyof T]: T[K] extends Record ? Value extends AnyObject ? `${Prefix$1}${Key} ${AsString}` : never : never }, "\n ">; /** * **ObjectToKeyframeString**`` * * Converts a Javascript object into a CSS Keyframe representation. * * **Related:** `ObjectToJsString`, `ObjectToJsonString`, `ObjectToTuple`, `ObjectToCssString` */ type ObjectToKeyframeString = TObj extends ExplicitlyEmptyObject ? "{}" : IsWideContainer extends true ? string : Surround, false>, TExpand extends false ? "{ " : "{\n ", TExpand extends false ? " }" : "\n}">; //#endregion //#region src/type-conversion/Promised.d.ts /** * **Promised**`` * * Ensures that the value `T` is a _thenable_ `PromiseLike` * structure by converting non-`Thenable` values to * `Promise`. * * **Related:** `Synchronous`, `Thenable`, `Awaited` */ type Promised = T extends Thenable ? T : Promise; /*** * **Asynchronous**`` * * - An alias for the `Promised` type * - Ensures `T` is returned as a `PromiseLike` type * * **Related:** `Promised`, `Synchronous`, `Thenable`, `Awaited` */ type Asynchronous = Promised; //#endregion //#region src/type-conversion/ReduceValues.d.ts type ProcessTuple$2 = [] extends TArray ? TResults : First$1 extends TypedFunction ? ProcessTuple$2, [...TResults, ReturnType>]> : ProcessTuple$2, [...TResults, First$1]>; /** * **ReduceValues**`` * * Reduces a container to it's _values_ where if it's a function then the * `ReturnType` is returned, if not a function than just it's normal value. * * ```ts * // [true, "blue"] * type T = ReduceValues<[true, false, () => true, () => "blue"] * ``` * * **Related:** `ReturnValues`, `Values` */ type ReduceValues = TContainer extends readonly unknown[] ? ProcessTuple$2 : IsDictionary extends true ? ProcessTuple$2> : never; //#endregion //#region src/type-conversion/RemoveFromEnd.d.ts /** * **RemoveFromEnd**`` * * Type utility which removes selected text -- `TRemove` -- from the end of `TContent`. * * Note: if `TRemove` is not found then `TContent is left unchanged */ type RemoveFromEnd = TContent extends `${infer Start}${TRemove}` ? Start : TContent; //#endregion //#region src/type-conversion/RemoveFromStart.d.ts /** * **RemoveFromStart**`` * * Type utility which removes selected text -- `TRemove` -- from the beginning of `TContent`. * * Note: if `TRemove` is not found then `TContent is left unchanged */ type RemoveFromStart = TContent extends `${TRemove}${infer Rest}` ? Rest : TContent; //#endregion //#region src/type-conversion/RemoveIndex.d.ts /** * **RemoveIndex**`` * * Removes an index like below while retaining other key/value pairs. * ```ts * interface Foo { * foo: string; * [key: string]: any; * } * // { foo: string } * type T = RemoveIndex; * ``` * * @deprecated use `RemoveIndexKeys` instead * */ type RemoveIndex> = { [P in keyof T as string extends P ? never : number extends P ? never : symbol extends P ? never : P]: T[P] }; //#endregion //#region src/type-conversion/RenameKey.d.ts /** * **RenameKey**`` * * Renames a key in `T`. */ type RenameKey = MapKeys; //#endregion //#region src/type-conversion/Replace.d.ts type Process$48 = TText extends "" ? If, TReplace, ""> : TFind extends "" ? TText : TText extends `${infer F}${TFind}${infer E}` ? `${F}${TReplace}${E}` : TText; /** * **Replace**`` * * Type utility which takes a string `TText` and finds the _first instance_ of * `TFind` and replaces it with `TReplace`. * * ```ts * type Fooy = "fooy"; * // "Foo" * type Foo = Replace; * ``` * * Alternatively you can pass in `TFind` as an array of `FromTo` objects to describe * multiple transformations at once. * * ```ts * type Fooy = "fooy"; * // "Pooey" * type Pooey = Replace; * ``` * * **Related:** `ReplaceAll`, `ReplaceToFrom`, `ReplaceAllToFrom` */ type Replace = IsStringLiteral extends true ? As, string> : string; //#endregion //#region src/type-conversion/ReplaceAll.d.ts type ReplaceAllLiterals$2 = TText extends `${infer Head}${TFind}${infer Tail}` ? `${Head}${TReplace}${ReplaceAllLiterals$2}` : TText; type Iterate$5 = [] extends TFind ? TText : Iterate$5, TReplace>, AfterFirst, TReplace>; type Singular = IsStringLiteral extends true ? IsStringLiteral extends true ? IsUnion extends true ? UnionToTuple extends readonly string[] ? Iterate$5, TReplace> : never : ReplaceAllLiterals$2 : string : string; type EachTupleElement = { [K in keyof TText]: ReplaceAll }; /** * **ReplaceAll**`` * * Type utility which takes a string `TText` and finds _all_ instances of * `TFind` and replaces it with `TReplace`. * * ```ts * const fooy = "fooy, Joey"; * // "foo, Joe" * type Foo = ReplaceAll; * ``` * * **Related:** `Replace` * * - **Note:** this utility has been upgraded to take either a _string_ or a * _tuple_ of strings for `TText`. */ type ReplaceAll = TText extends readonly string[] ? IsLiteralLike extends true ? EachTupleElement : string[] : TText extends string ? Singular : never; //#endregion //#region src/type-conversion/ReplaceAllFromTo.d.ts type ReplaceAllFromToLiteral$1 = Mappings extends readonly [infer First extends { from: string; to: string; }, ...infer Rest extends { from: string; to: string; }[]] ? ReplaceAllFromToLiteral$1, Rest> : S; type ReplaceAllLiterals$1 = TText extends `${infer Head}${TFind}${infer Tail}` ? `${Head}${TReplace}${ReplaceAllLiterals$1}` : TText; type ApplyMapping$1 = ReplaceAllLiterals$1; /** * **ReplaceAllFromTo**`` * * Replaces the _all instances_ of the `from` element of `TFromTo` found in * `TText` with the corresponding `to` value in `TFromTo`. * * ```ts * // "Foo-bar-baz" * type Dashing = Replace<"Foo Bar Baz", [ * { from: " "; to: "-" }, * { from: "B"; to: "b" } * ]>; * ``` * **Related:** `Replace`, `ReplaceAll` * * **Notes:** * - does allow TText to be passed in as a _symbol_ but when it is * it is ignored and passed through * - it also allows numeric values to be passed through and in those cases * the numbers are converted to a `NumberLike` type */ type ReplaceAllFromTo = TText extends string ? ReplaceAllFromToLiteral$1 : TText extends number ? ReplaceAllFromTo<`${TText}`, TMappings> : TText; //#endregion //#region src/type-conversion/ReplaceAllToFrom.d.ts type ReplaceAllFromToLiteral = Mappings extends readonly [infer First extends { from: string; to: string; }, ...infer Rest extends { from: string; to: string; }[]] ? ReplaceAllFromToLiteral, Rest> : S; type ReplaceAllLiterals = TText extends `${infer Head}${TFind}${infer Tail}` ? `${Head}${TReplace}${ReplaceAllLiterals}` : TText; type ApplyMapping = ReplaceAllLiterals; /** * **ReplaceAllToFrom**`` * * Intended to be used to produce a "reverse FromTo". * Replaces the _all instances_ of the `to` element of `TFromTo` found in * `TText` with the cooresponding `from` value in `TFromTo`. * * ```ts * // "Foo-bar-baz" * type Dashing = Replace<"Foo Bar Baz", [ * { from: " "; to: "-" }, * { from: "B"; to: "b" } * ]>; * ``` * **Related:** `ReplaceAllFromTo` * * **Notes:** * - does allow TText to be passed in as a _symbol_ but when it is * it is ignored and passed through * - it also allows numeric values to be passed through and in those cases * the numbers are converted to a `NumberLike` type */ type ReplaceAllToFrom = TText extends string ? ReplaceAllFromToLiteral : TText extends number ? ReplaceAllToFrom<`${TText}`, TMappings> : TText; //#endregion //#region src/type-conversion/ReplaceFromTo.d.ts type ProcessFromTo = [] extends TFromTo ? TText : First$1 extends { from: infer From extends string; to: infer To extends string; } ? ProcessFromTo, AfterFirst> : never; type MAX = 35; type ExcessProcessor = TakeFirst extends infer FirstItems extends readonly FromTo[] ? ProcessFromTo : never; /** * **ReplaceFromTo**`` * * Replaces the first instance of each `from` element of `TFromTo` found in * `TText` with the cooresponding `to` value in `TFromTo`. * * ```ts * type Fooy = "fooy"; * // "Pooey" * type Pooey = Replace; * * **Related:** `Replace`, `ReplaceAll`, `ReplaceAllToFrom` * - does allow TText to be passed in as a _symbol_ but when it is * it is ignored and passed through * - it also allows numeric values to be passed through and in those cases * the numbers are converted to a `NumberLike` type */ type ReplaceFromTo = TText extends string ? IsStringLiteral extends true ? IsGreaterThan extends true ? ExcessProcessor : ProcessFromTo : string : TText extends number ? ReplaceFromTo<`${TText}`, TFromTo> : TText; //#endregion //#region src/type-conversion/ReplaceType.d.ts /** * **ReplaceType** * * Replaces types which extend `TFind` with `TReplace` within `TContent`. * * - will work where `TContent` is a tuple, a union type or just a bare type */ type ReplaceType = TContent extends readonly any[] ? { [K in keyof TContent]: ReplaceType } : [TContent] extends [TFind] ? TReplace : TContent; //#endregion //#region src/type-conversion/RetainChars.d.ts type Retention = TChar extends `${infer Head}${infer Rest}` ? Head extends TRemove ? Retention : Retention : TRetain; /** * **RetainChars**`` * * Converts a string `TContent` into a string with all * of the characters in `TRetain` _retained_ while all * other characters are removed. */ type RetainChars = string extends TContent ? string : string extends TRetain ? string : Retention; //#endregion //#region src/type-conversion/ReturnValues.d.ts type ProcessTuple$1 = [] extends TArray ? TResults : First$1 extends TypedFunction ? ProcessTuple$1, [...TResults, ReturnType>]> : ProcessTuple$1, TResults>; /** * **ReturnValues**`` * * Reduces a container's values down to just the return type of the * functions. * ```ts * // [true, "blue"] * type T = ReturnValues<[true, false, () => true, () => "blue"] * ``` * * **Related:** `ReduceValues` */ type ReturnValues = TContainer extends readonly unknown[] ? ProcessTuple$1 : TContainer extends Dictionary ? ProcessTuple$1> : never; //#endregion //#region src/type-conversion/RightWhitespace.d.ts /** * Provides the _left_ whitespace of a string * ```ts * // "\n\t " * type T = LeftWhitespace<"\n\t foobar">; * ``` */ type RightWhitespace = string extends S ? string : Replace, "">; //#endregion //#region src/type-conversion/StringLength.d.ts /** * Type utility that provides the _length_ of a given string type in a way which * is _not_ limited to TS's recursive string length of roughly 48. * * ```ts * // 3 * type Three = StringLength<"foo">; * ``` */ type StringLength = S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Seventh}${infer _Eighth}${infer _Ninth}${infer _Tenth}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Seventh}${infer _Eighth}${infer _Ninth}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Seventh}${infer _Eighth}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Seventh}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer _Third}${infer Rest}` ? StringLength : S extends `${infer _First}${infer _Second}${infer Rest}` ? StringLength : S extends `${infer _First}${infer Rest}` ? StringLength : [...R]["length"]; //#endregion //#region src/type-conversion/StringLiteralFromTuple.d.ts type LitString = [] extends TItems ? TLiteral : LitString, First$1 extends string ? IsStringLiteral> extends true ? `${TLiteral}${First$1}` : `${TLiteral}${string}` : First$1 extends number ? IsNumericLiteral> extends true ? `${TLiteral}${First$1}` : `${TLiteral}${number}` : TLiteral>; /** * **StringLiteralFromTuple**`` * * Receives a tuple and creates a string literal type based * on the sequence of elements in the tuple. * * ```ts * // `${string}(${number})${string}` * type Lit=StringLiteralFromTuple<[ * string, "(", number, ")", string * ]>; * ``` */ type StringLiteralFromTuple = LitString; //#endregion //#region src/type-conversion/StripChars.d.ts type Removal = TContent extends `${infer Head}${infer Remaining}` ? Removal : TCollect; /** * **StripChars**`` * * Converts a string `TContent` into a string with all * of the characters in `TStrip` removed. * * - `TStrip` must be a single character or a union * of single characters */ type StripChars = string extends TContent ? string : string extends TStrip ? string : Removal; //#endregion //#region src/type-conversion/Synchronous.d.ts /** * **Synchronous**`` * * Ensures that the value `T` is a _thenable_ `PromiseLike` * structure by converting non-`Thenable` values to * `Promise`. * * **Related:** `Promised`, `Asynchronous`(alias), `Thenable`, `Awaited` */ type Synchronous = T extends Thenable ? Awaited$1 : T; //#endregion //#region src/type-conversion/ToBoolean.d.ts /** * **ToBoolean**`` * * Type utility which converts `T` into a boolean type regardless of * `T`'s underlying type. * * - _boolean_ values are proxied through * - _scalar_ values are tested with the JS Truthy test to return a true/false value * - _containers_ with no keys evaluate to false, with keys to true * - _never_, _null_, and _undefined_ map to false * - all other values return the wide "boolean" type */ type ToBoolean = If, false, T extends boolean ? T : T extends Scalar ? If, true, If, false, boolean>> : T extends readonly unknown[] ? If["length"], 0>, false, true> : T extends AnyObject ? If>["length"], 0>, false, true> : If, false, boolean>>; //#endregion //#region src/type-conversion/ToJson.d.ts type Enc$1> = TOpt["encode"] extends true ? SafeEncode : T; type AsJsonArray = Join<["[ ", ...ToStringArray, " ]"]>; /** * **ToJsonValue**`` * * Converts the value in `T` to a form appropriate for a * JSON value. * * Note: all outputs are a _string_ but: * * - string are placed in double quotes * - tuples are processed recursively */ type ToJsonValue = T extends string ? `${Q}${T}${Q}` : T extends number ? `${T}` : T extends boolean ? `${T}` : T extends undefined ? "undefined" : T extends null ? "null" : T extends readonly unknown[] ? AsJsonArray }, string>> : never; type InnerArray$1> = As<{ [K in keyof T]: T[K] extends string ? `${O["quote"]}${T[K]}${O["quote"]}` : Or<[Extends, Extends, Extends, Extends]> extends true ? `${As}` : T[K] extends readonly any[] ? ToJsonArray : T[K] extends Dictionary ? `{ ${InnerObject$2, O>} }` : never }, readonly string[]>; /** * **ToJsonArray**`` * * Converts an array to a JSON string of the same type. * * **Related:** `ToJson`, `ToJsonObject`, `ToJsonScalar` */ type ToJsonArray = InnerArray$1> extends readonly string[] ? Join>, ", "> extends infer Inner extends string ? `[ ${Inner} ]` : never : never; type InnerObject$2 = { quote: "\""; encode: false; }, R extends readonly string[] = []> = [] extends K ? Join : InnerObject$2, O, [...R, Or<[Extends], number>, Extends], boolean>, Equals], null>, Equals], undefined>]> extends true ? `${O["quote"]}${First$1}${O["quote"]}: ${As], boolean | number | null | undefined>}` : T[First$1] extends string ? `${O["quote"]}${First$1}${O["quote"]}: ${O["quote"]}${T[First$1]}${O["quote"]}` : T[First$1] extends readonly unknown[] ? `${O["quote"]}${First$1}${O["quote"]}: ${ToJsonArray], O>}` : T[First$1] extends Dictionary ? `${O["quote"]}${First$1}${O["quote"]}: ${ToJsonObject]>}` : never]>; /** * **ToJsonObject**`` * * Converts an object type `T` to a JSON string of the same type. * * **Related:** `ToJson`, `ToJsonArray`, `ToJsonScalar` */ type ToJsonObject = { quote: "\""; encode: false; }> = `{ ${InnerObject$2, O>} }`; /** * **ToJsonScalar**`` * * Converts a scalar value to the JSON string representation. * * **Related:** `ToJson`, `ToJsonArray`, `ToJsonObject` */ type ToJsonScalar, O extends Required = { quote: "\""; encode: false; }> = T extends string ? `${O["quote"]}${Enc$1}${O["quote"]}` : `${As}`; interface ToJsonOptions { quote?: QuoteCharacter; encode?: boolean; } /** * Merges user options with defaults to create `Required` */ type O$2 = As>, Required>; /** * Converts an object, array or scalar value to a * strongly typed JSON string. * * **Related:** * - `ToJsonObject`, `ToJsonArray`, `ToJsonScalar` * - `ToStringLiteral` */ type ToJson | Dictionary | Tuple$1, Opt extends ToJsonOptions = { quote: "\""; encode: false; }> = T extends Exclude ? ToJsonScalar, Required>> : T extends Dictionary ? ToJsonObject, Required>> : T extends Tuple$1 ? ToJsonArray, Required>> : never; //#endregion //#region src/type-conversion/ToNumber.d.ts /** * **ToNumber**`` * * - Converts `T` into a numeric type: * - if `T` is a Scalar/Object it's converted to a number where possible * - if `T` is an array then each element will be converted to a number where possible * - any non-numeric content which can not be converted to a number will be convert to `never` * - a number or a numeric array will be proxied through "as is" */ type ToNumber = IsTuple extends true ? TValue extends readonly unknown[] ? ToNumericArray extends readonly (number | never)[] ? ToNumericArray : Err<"can-not-convert", `Attempt to convert a tuple into a numeric tuple failed!`, { library: "inferred-types/constants"; value: TValue; }> : never : TValue extends number ? TValue : TValue extends `${infer Num extends number}` ? Num : If, IsEqual]>, 1, If, IsEqual]>, 0, If, readonly (number | never)[], never>>>; //#endregion //#region src/type-conversion/ToString.d.ts /** * Converts a union type to a string representation of the type. */ type UnionToString, O extends Required = { quote: "'"; encode: false; }, TOut extends readonly string[] = []> = [] extends TEl ? Join : UnionToString, O, ToString> extends string ? [...TOut, ToString>] : TOut>; type _ArrayToString = { quote: "'"; encode: false; }, TOut extends string = "[ "> = [] extends T ? `${TOut} ]` : _ArrayToString, O, ToString> extends string ? TOut extends "[ " ? `[ ${ToString>}` : `${TOut}, ${ToString>}` : never>; type ArrayToString = { quote: "'"; encode: false; }> = IsWideContainer extends true ? T extends (infer Kind)[] ? `${ToString}[]` : `unknown[]` : _ArrayToString; type InnerObject$1 = { quote: "'"; encode: false; }, R extends readonly string[] = []> = [] extends K ? Join : InnerObject$1, O, [...R, Or<[Extends], number>, Extends], boolean>, Equals], null>, Equals], undefined>]> extends true ? `${First$1}: ${As], boolean | number | null | undefined>}` : T[First$1] extends string ? `${First$1}: ${O["quote"]}${T[First$1]}${O["quote"]}` : T[First$1] extends readonly unknown[] ? `${First$1}: ${ArrayToString], O>}` : T[First$1] extends Dictionary ? `${First$1}: ${ObjectToString]>}` : never]>; type ObjectToString = { quote: "'"; encode: false; }> = IsLiteralLikeObject extends true ? `{ ${InnerObject$1, O>} }` : T extends Record ? `Record}>` : "object"; type MapToString> = T extends Map ? `Map<${ToString}, ${ToString}>` : `Map`; type SetToString> = T extends Set ? `Set<${ToString}>` : `Set`; type WeakMapToString> = T extends WeakMap ? `WeakMap<${ToString}, ${ToString}}` : `WeakMap`; /** * **ToString** * * Converts _any_ type into a string representation of that type. * * **Related:** `AsString`, `ToJson` */ type ToString = { quote: "'"; encode: false; }> = [T] extends [readonly unknown[]] ? ArrayToString : [T] extends [string] ? [IsStringLiteral] extends [true] ? `${O["quote"]}${T}${O["quote"]}` : "string" : [T] extends [number] ? [IsNumericLiteral] extends [true] ? `${T}` : "number" : [T] extends [boolean] ? [IsBooleanLiteral] extends [true] ? `${T}` : "boolean" : [T] extends [null] ? `null` : [T] extends [undefined] ? `undefined` : [T] extends [Set] ? SetToString : [T] extends [Map] ? MapToString : [T] extends [WeakMap] ? WeakMapToString : [T] extends [Dictionary] ? ObjectToString : [IsUnion] extends [true] ? "Union<...>" : "unknown"; //#endregion //#region src/type-conversion/ToStringArray.d.ts /** * **ToStringArray**`` * * Receives a tuple of values and converts each item * into a _string_ value using the `ToString` utility. */ type ToStringArray = As<{ [K in keyof T]: AsString }, readonly string[]>; //#endregion //#region src/type-conversion/ToStringLiteral.d.ts interface ToLiteralOptions { quote?: QuoteCharacter; encode?: boolean; /** * by default all scalar values are taken to be _what they are_ * but if this flag is set to `true` then string literals will * be evaluated as being an `InputToken`. */ tokensAllowed?: boolean; /** * for containers which support the concept of "optional" keys */ isOptional?: boolean; } type Enc = TOpt["encode"] extends true ? SafeEncode : T; /** * Converts the elements in an array to tokens. */ type InnerArray = As<{ [K in keyof T]: T[K] extends string ? `${O["quote"]}${T[K]}${O["quote"]}` : Or<[Extends, Extends, Extends, Extends]> extends true ? `${As}` : T[K] extends readonly any[] ? ToStringLiteral__Array : T[K] extends Dictionary ? ToStringLiteral__Object : never }, readonly string[]>; type Wrap = `(${T})[]`; type AsUnionArrayString = [] extends T ? Wrap, string>> : AsUnionArrayString, ToStringLiteral> extends infer Type extends string ? [...O, Type] : O>; type Splitter$1 = T extends [infer Head, ...infer Rest extends readonly unknown[]] ? IsGreaterThan extends true ? Splitter$1, [...R, Head], O> : Splitter$1, R, [...O, Head]> : [R, T extends [infer Last] ? [...O, Last] : O]; type ArrayWithOptionalElements> = Required extends infer Tuple extends readonly unknown[] ? Splitter$1 extends [infer Req extends readonly unknown[], infer Opt extends readonly unknown[]] ? InnerArray extends infer Req extends readonly string[] ? InnerArray extends infer Opt extends readonly string[] ? Join<[...Req, ...Each], ", "> extends infer Inner extends string ? `[ ${Inner} ]` : never : never : never : never : never; /** * **ToStringLiteral__Array**`` * * Converts an array to a string literal representing that array. * * ```ts * // "[ 1, 2, 3 ]"" * type Test = ToStringLiteral__Array<[1,2,3]>; * ``` * * **Related:** * - `ToStringLiteral`, `ToStringLiteral__Object` * - `ToJson`, `ToJsonObject`, `ToJsonScalar` */ type ToStringLiteral__Array = [TupleMeta["hasOptionalElements"]] extends [true] ? ArrayWithOptionalElements : [TupleMeta["isWide"]] extends [true] ? [T] extends [readonly (infer Type)[]] ? [IsUnion] extends [true] ? [UnionToTuple] extends [readonly unknown[]] ? AsUnionArrayString> : never : [Type] extends [Scalar] ? `${ToStringLiteral__Scalar}[]` : [Type] extends [Dictionary] ? ToStringLiteral__Object extends infer Obj extends string ? `${Obj}[]` : never : never : never : [T["length"]] extends [0] ? `[]` : InnerArray extends (infer Arr extends readonly string[]) ? Join extends infer Inner extends string ? `[ ${Inner} ]` : never : never; /** * Object keys typically do not need be surrounded by quotations * marks at least if they are of the `PascalCase` or `camelCase` * variety but if they contain spaces, dashes, or really any character * other than alphanumeric characters then they must be quoted. */ type IsObjectKeyRequiringQuotes> = [] extends TChars ? false : First$1 extends AlphanumericChar ? IsObjectKeyRequiringQuotes> : true; type KeyName = As; type Quote$1 = As}${O["quote"]}` : `"${Enc}"`, string>; /** * Builds out the key/value pairs in the an object */ type InnerObject & ObjectKey)[] = As>, readonly (keyof Required & ObjectKey)[]>, TOptKeys extends string | symbol = OptionalKeys, TReq extends Dictionary = Required, TResult extends readonly string[] = []> = TKeys extends [infer K extends ObjectKey & keyof TDict, ...infer Rest extends readonly ObjectKey[]] ? TReq[K] extends infer Value ? Value extends Error ? Value : [IsUnion] extends [true] ? InnerObject, TOpt> extends infer Union extends string ? [...TResult, `${KeyName}: ${Union}`] : never> : Value extends Scalar ? InnerObject}: ${ToStringLiteral__Scalar}`]> : Value extends readonly unknown[] ? InnerObject}: ${ToStringLiteral__Array}`]> : Value extends Dictionary ? ToStringLiteral__Object extends infer ObjResult ? ObjResult extends Error ? ObjResult : ObjResult extends string ? InnerObject}: ${ObjResult}`]> : never : never : never : never : TKeys extends [infer Last extends keyof Required & ObjectKey] ? [...TResult, ToStringLiteral] : TResult; /** * **ToStringLiteral__Object**`` * * Converts an object type `T` to a JSON string of the same type. * * **Related:** `ToJson`, `ToJsonArray`, `ToJsonScalar` */ type ToStringLiteral__Object = InnerObject extends infer Inner ? Inner extends Error ? Inner : Inner extends readonly string[] ? `{ ${Join} }` : never : never; /** * **ToJsonScalar**`` * * Converts a scalar value to the JSON string representation. * * **Related:** `ToJson`, `ToJsonArray`, `ToJsonObject` */ type ToStringLiteral__Scalar = [IsAny] extends [true] ? `any` : [IsNever] extends [true] ? `never` : [T] extends [string] ? [string] extends [T] ? `string` : `${Quote$1}` : [T] extends [number] ? [number] extends [T] ? `number` : `${T}` : [T] extends [bigint] ? [bigint] extends [T] ? `bigint` : `${T}` : [IsNull] extends [true] ? `null` : [IsUndefined] extends [true] ? `undefined` : [IsUnknown] extends [true] ? `unknown` : [IsTrue] extends [true] ? `true` : [IsFalse] extends [true] ? `false` : [IsBoolean] extends [true] ? `boolean` : [T] extends [void] ? `void` : [T] extends [symbol] ? `symbol` : never; type ToStringLiteral__Union = Join<{ [K in keyof T]: ToStringLiteral }, " | ">; interface O$1 { quote: T["quote"] extends QuoteCharacter ? T["quote"] : "\""; encode: T["encode"] extends boolean ? T["encode"] : false; } /** * Converts any Typescript type into a string literal * _representation_ of that type. * * **Related:** * - `ToStringLiteral__Scalar`, `ToStringLiteral__Object` * - `ToJsonObject`, `ToJsonArray`, `ToJsonScalar` */ type ToStringLiteral = [IsAny] extends [true] ? "any" : [IsNever] extends [true] ? "never" : [T] extends [Error] ? T : [IsUnion] extends [true] ? ToStringLiteral__Union, Opt> : [T] extends [Scalar] ? ToStringLiteral__Scalar : [T] extends [readonly unknown[]] ? ToStringLiteral__Array> : [T] extends [Dictionary] ? ToStringLiteral__Object> : never; //#endregion //#region src/type-conversion/ToUnion.d.ts /** * **ToUnion**`` * * Converts `T` -- which must be an array of something -- to * a Union type. * * **Related:** `TupleToUnion` */ type ToUnion = T[number]; //#endregion //#region src/type-conversion/TrimDictionary.d.ts type _TrimDict = [] extends K ? Expand : _TrimDict, R & Record, T[First$1] extends string ? Trim]> : T[First$1]>>; /** * **TrimDictionary**`` * * Trims all of the _values_ of a Dictionary which are strings. Non-string * values are proxied through unchanged. * * **Related:** `TrimEach` */ type TrimDictionary = _TrimDict, readonly (keyof T & ObjectKey)[]>>; //#endregion //#region src/type-conversion/TrimEach.d.ts /** * **TrimEach**`` * * Trims each element of a Tuple/Array which extends _string_. * * - Non-string values are left as-is * * **Related:** `TrimDictionary` */ type TrimEach = { [K in keyof T]: T[K] extends string ? Trim : T[K] }; //#endregion //#region src/type-conversion/TupleToIntersection.d.ts type Break$4 = E extends "error" ? Err<"invalid-intersection", TMsg, TCtx> : never; type Set$2 = IsUnset extends true ? W : V & W; type Intersect$1 = T extends [infer Head, ...infer Rest] ? Head extends TypedFunction ? IsNever>> extends true ? Break$4<`A function with a key-value dictionary caused the intersection type to become 'never'`, { intersection: V; conflict: Head; }, E> : Intersect$1>> : IsNever> extends true ? Break$4<`TupleToIntersection hit an element which caused the intersection type to become 'never'`, { intersection: V; conflict: Head; }, E> : Intersect$1> : F extends undefined ? ExpandRecursively : F extends TypedFunction ? F & ExpandRecursively : never; /** * **TupleToIntersection**`` * * Recursively intersects all the elements of a tuple. * * - Empty tuples will return `unknown` as type * - if you want an Error instead of the `never` type you can set `E` to * "error" and the conflicting element which _caused_ the intersection to * become `never` will be highlighted. */ type TupleToIntersection = [] extends T ? unknown : Intersect$1; //#endregion //#region src/type-conversion/TupleToUnion.d.ts /** * Converts a Tuple type into a _union_ of the tuple elements * * ```ts * const arr = [1, 3, 5] as const; * // 1 | 3 | 5 * type U = TupleToUnion; * ``` * * **Note:** an empty array will be converted to a `string` type. */ type TupleToUnion = [T] extends [readonly unknown[]] ? [Keys$1["length"]] extends [0] ? never : T[number] : never; //#endregion //#region src/type-conversion/TypeReplace.d.ts /** * **TypeReplace**`` * * @deprecated use `ReplaceType` instead */ type TypeReplace = ReplaceType; //#endregion //#region src/type-conversion/UnionArrayToTuple.d.ts type UnionToIntersection$2 = (U extends unknown ? (arg: U) => 0 : never) extends ((arg: infer I) => 0) ? I : never; type LastInUnion$1 = UnionToIntersection$2 0 : never> extends ((x: infer L) => 0) ? L : never; type UnionToTuple$1> = [U] extends [never] ? [] : [...UnionToTuple$1>, Last]; /** * **UnionArrayToTuple**`` * * If you have a type which is an _array_ of a Union type but you want to * represent this as a Tuple, this utility will make this conversion for you. * * **Related:** `UnionToTuple` */ type UnionArrayToTuple = T extends any[] ? UnionToTuple$1> : never; //#endregion //#region src/type-conversion/UnionToIntersection.d.ts /** * **UnionToIntersection**`` * * Type utility which converts a union type to an intersection */ type UnionToIntersection = (U extends U ? (x: U) => unknown : never) extends ((x: infer R) => unknown) ? R : never; //#endregion //#region src/type-conversion/UnionToTuple.d.ts /** * UnionToIntersection<{ foo: string } | { bar: string }> = * { foo: string } & { bar: string }. */ type UnionToIntersection$1 = (U extends unknown ? (arg: U) => 0 : never) extends ((arg: infer I) => 0) ? I : never; /** * LastInUnion<1 | 2> = 2. */ type LastInUnion = UnionToIntersection$1 0 : never> extends ((x: infer L) => 0) ? L : never; /** * ExcludeExact - Excludes from T only members that are EXACTLY equal to U * (not just extending U). This prevents tuples like [1,2,3] from being excluded * when excluding number[], since [1,2,3] extends number[] but is not equal to it. */ type ExcludeExact = T extends U ? U extends T ? never : T : T; type PreserveBoolean = Contains extends true ? Contains extends true ? [...RemoveBoolean, boolean] : T : T; /** * **UnionToTuple**`<1 | 2> => [1, 2]` * * Converts union members into a tuple. * * **Related**: `UnionArrayToTuple`, `UnionToTuple__PreserveBoolean` */ type UnionToTuple> = [U] extends [never] ? [] : [...UnionToTuple>, Last]; /** * **UnionToTuple__PreserveBoolean**`<1 | 2 | boolean> => [1, 2, boolean]` * * Converts union members into a tuple and makes sure if both `true` and `false` * are found in the resulting tuple that this is replaced with just `boolean`. * * - ensuring that the `boolean` type is _preserved_ adds a small amount of * type complexity and often doesn't matter. * - if you don't care about preserving the wide `boolean` type then use * `UnionToTuple` instead. * * **Related**: `UnionArrayToTuple`, `UnionToTuple` */ type UnionToTuple__PreserveBoolean = PreserveBoolean>; //#endregion //#region src/type-conversion/UnionWithAll.d.ts /** * **UnionWithAll**`` * * Type utility which iterates through each element of `TList` and creates a * a union between the current value and `TUnion`. * ```ts * type Arr = [1,2,"foo"]; * // [1,2, "foo" | number] * type Num = UnionWithAll; * ``` */ type UnionWithAll = { [K in keyof TList]: TList[K] | TUnion }; //#endregion //#region src/type-conversion/ValueOrReturnValue.d.ts type Process$47 = { [K in keyof T]: T[K] extends TypedFunction ? ReturnType : T[K] }; /** * **ValueOrReturnValue**`` * * Takes a value or a tuple of values in `TEval` and evaluates what * the item's _return type_ is when an element is a function; otherwise it just proxies * the element's type forward. * * ### Example * ```ts * // [true, "foo", "bar"] * type T = ValueOrReturns<[true, "foo", () => "bar"]>; * ``` */ type ValueOrReturnValue = TEval extends readonly unknown[] ? Process$47 : Process$47<[TEval]>[0]; //#endregion //#region src/type-conversion/Widen.d.ts /** * **WidenScalar**`` * * Widens any _scalar_ type `T`. */ type WidenScalar = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends bigint ? bigint : T extends symbol ? symbol : T extends null ? null : T extends undefined ? undefined : never; type Process$46 = T extends Scalar ? WidenScalar : T extends AnyFunction ? T extends TypedFunction ? WidenFunc : AnyFunction : T extends readonly unknown[] ? WidenTuple : T extends Dictionary ? WidenDictionary> : T; type WidenDictionary, readonly ObjectKey[]>, TResults extends Dictionary = EmptyObject> = K extends [infer Head extends ObjectKey, ...infer Rest extends ObjectKey[]] ? WidenDictionary>> : ExpandRecursively; type WidenTuple = { [K in keyof T]: IsLiteralLike extends true ? WidenLiteral : Process$46 }; /** * **WidenUnion** * * Widens all the elements in the union type. */ type WidenUnion = WidenTuple>[number]; type WidenLiteral = T extends Scalar ? WidenScalar : IsUnion extends true ? WidenUnion : T extends readonly unknown[] ? WidenTuple : T extends Dictionary ? WidenDictionary> : never; /** * Widens each element of a _fixed-length_ tuple, accumulating into `R`. * * The recursion peels elements with a **readonly** head/rest pattern so it * matches both mutable and `readonly` tuples (a mutable-only pattern would * fail to match a `readonly` tuple and collapse the result to `[]`). */ type WidenArrayInner = T extends readonly [infer Head, ...infer Rest] ? WidenArrayInner]> : R; /** * Widens the elements of an array/tuple `T` by one level while preserving its * structure. _Wide_ (variadic-length) arrays pass through untouched; a * fixed-length tuple has each element widened and its `readonly` modifier * re-applied so that, e.g., `readonly [string, 1 | 2 | 3]` widens to * `readonly [string, number]` (not the narrower mutable form). */ type WidenArray = number extends T["length"] ? T : [IsReadonlyArray] extends [true] ? readonly [...WidenArrayInner] : WidenArrayInner; type WidenFnProps = [] extends TKeys ? ExpandDictionary : WidenFnProps, First$1 extends keyof TObj ? TResult & Record, TObj[First$1] extends Scalar ? WidenScalar]> : TObj[First$1]> : TResult>; /** * Widens the parameter tuple of a function. * * Delegates to `WidenArray`, which already passes _wide_ tuples through * untouched and otherwise widens each parameter via `Widen`. */ type WidenFunctionParams = WidenArray; /** * Widens a function's return type. * * A function's return is frequently a _scalar_ (or a scalar union) and is * often supplied via the built-in `ReturnType`. For a **generic** * function that produces a lazy template-literal union (e.g. the return of * `(name: T) => `hi ${T}``, i.e. * `` `hi ${"Bob" | "Nancy"}` ``), routing straight through `Widen` forces the * expensive `UnionToTuple` materialization and can blow past TypeScript's * instantiation limits. * * To stay cheap we first test scalar assignability with a **non-distributive** * `[TReturn] extends [...]` check — this widens the common scalar cases * without ever materializing the union — and only fall back to the full * `Widen` for genuinely structural returns (objects, tuples, mixed unions). */ type WidenFunctionReturn = [TReturn] extends [string] ? string : [TReturn] extends [number] ? number : [TReturn] extends [boolean] ? boolean : [TReturn] extends [bigint] ? bigint : [TReturn] extends [symbol] ? symbol : [TReturn] extends [null] ? null : [TReturn] extends [undefined] ? undefined : Widen; /** * Widens the intersection props stored alongside a function, collapsing * to `EmptyObject` when there are none. */ type WidenFunctionProps = [IsNonEmptyContainer] extends [true] ? WidenFnProps> : EmptyObject; interface WidenFn { narrowing: IsNarrowingFn; literal: StaticFn; parameters: Parameters; returns: TFn extends ((...args: T) => infer R) ? R : never; props: FnKeyValue; } /** * Recovers a function's return type **without** the `any`-collapse that the * built-in `ReturnType` suffers for a _union_-constrained generic whose type * parameter is woven into a template literal (e.g. * `` (name: T) => `hi ${T}` ``). Re-inferring `R` * through a fresh call signature keeps the concrete (often _union_) return. */ type RecoverFnReturn = T extends { (...args: infer _A): infer R; } ? R : never; /** * Widens a _recovered_ function return value. * * For string (or string-union) returns we collapse to the widest template * literal that still preserves the shared prefix — e.g. * `"hi Bob" | "hi Nancy"` becomes `` `hi ${string}` ``. Non-string returns * defer to the ordinary `Widen`. */ type WidenFnReturnValue = [R] extends [string] ? LongestCommonPrefix> extends infer TPrefix extends string ? [TPrefix] extends [""] ? string : `${TPrefix}${string}` : string : Widen; /** * **WidenFunc**`` * * Widens a function `T` while preserving its _narrowing_ vs _static_ character: * * - a **narrowing** function keeps its generic input constraint and widens * only its return value; a single-parameter narrowing function is rebuilt * in the ergonomic `` (x: X) => R `` form. * - a **static** function widens through `FnFrom`. * * Unlike the (now deprecated) `WidenFunction`, `WidenFunc` receives the whole * function and can therefore _recover_ template-literal returns that * `ReturnType` would otherwise collapse to `any`. * * The widened pieces are computed **once** in the `_Params`/`_Return`/`_Props` * helper parameters; hoisting `FnMeta["params"]` into an eager type * parameter is also what keeps the rebuilt parameter tuple at the correct * _arity_ (passing it lazily lets TypeScript collapse `[P]` to `P[]`). */ type WidenFunc["params"] : []), _Return = (T extends TypedFunction ? WidenFnReturnValue> : never), _Props extends Dictionary = (T extends TypedFunction ? ExpandDictionary> : EmptyObject)> = Function extends T ? Function : T extends TypedFunction ? [IsNarrowingFn] extends [true] ? _Params extends readonly [infer P0] ? [IsNonEmptyContainer<_Props>] extends [true] ? ((x: X) => _Return) & _Props : (x: X) => _Return : FnFrom<_Params, _Return, _Props> : FnFrom<_Params, _Return, _Props> : never; /** * **WidenFunction**`` * * @deprecated Prefer {@link WidenFunc}, which receives the whole function * rather than its pre-split constituent parts. Because `WidenFunction` is * handed `TReturn` (typically `ReturnType`) it cannot recover a * template-literal return that TypeScript has already collapsed to `any` * (which happens for _union_-constrained generics), so the shared prefix of * the return is lost. `WidenFunc` re-infers the return directly from the * function and preserves it. * * Widens a Function from its constituent parts (parameters, return value, * and any props hung off the function), producing a _narrowing_ function * when `TNarrowing` is `true` and a _static_ function otherwise. * * The widened pieces are computed **once** via the `_P`/`_R`/`_Props` helper * parameters rather than inline in each branch. `TNarrowing` is commonly a * _deferred_ boolean (e.g. `IsNarrowingFn`), and inlining the widening * into both branches makes TypeScript instantiate it twice — needless work * that pushes complex signatures toward the instantiation limit. */ type WidenFunction< /** whether the functioning is a "narrowing function" or not */TNarrowing extends boolean, /** parameters */TParams extends readonly unknown[], /** return value */TReturn, /** key/value props stored at same level as function */TProps extends Dictionary, _P extends readonly unknown[] = WidenFunctionParams, _R = WidenFunctionReturn, _Props extends Dictionary = WidenFunctionProps> = [TNarrowing] extends [true] ? AsNarrowingFn<_P, _R, _Props> : AsStaticFn<_P, _R, _Props>; type WidenContainer = [T] extends [readonly unknown[]] ? TForce extends true ? readonly unknown[] : WidenArray : [T] extends [Dictionary] ? TForce extends true ? Dictionary : WidenDictionary : [T] extends [Map] ? TForce extends true ? AnyMap : Map> : [T] extends [WeakMap] ? TForce extends true ? AnyWeakMap : WeakMap> : [T] extends [Set] ? TForce extends true ? AnySet : Set> : T; /** * **Widen**`` * * Converts a literal type to a _wider_ type. * * - for _scalar values_ `T` will just become wide variant (e.g., `5` → `number`) * - for _union types_ all elements of the union will be made wide * - for _container values_ it will widen the items inside the container * * **Note:** should you want the container values to be fully widened you * can set `TForce` to true. */ type Widen = [IsUnion] extends [true] ? WidenUnion : [T] extends [TypedFunction] ? FnFrom> extends true ? Parameters : WidenArray>, Widen>, WidenDictionary>> : [T] extends [Scalar] ? WidenScalar : [T] extends [Container] ? WidenContainer : T extends Scalar ? WidenScalar : Process$46; //#endregion //#region src/type-conversion/WidenValues.d.ts type ProcessArr = { [K in keyof T]: Widen }; type ProcessObj$1 = [] extends TKeys ? TResults : ProcessObj$1, TResults & Record, TObj[First$1]>>; /** * **WidenValues**`` * * Type utility which _widens_ the values of a container. * * **Related:** `Widen` */ type WidenValues = T extends readonly unknown[] ? ProcessArr : T extends Dictionary ? ProcessObj$1 extends readonly (keyof T)[] ? Keys$1 : never> : never; //#endregion //#region src/type-conversion/WithDefault.d.ts /** * **WithDefault**`` * * Provided a type `TVal`, this utility will proxy any value which is * _not_ `null` or `undefined` through as `TVal`; otherwise it will * substitute in `TDef`. * * **Note:** you may optionally set the criteria for using the default * value from `null` or `undefined` to any _falsy_ value. * * ### Examples * ```ts * // "foo" * type T1 = WithDefault<"foo","bar">; * // "bar" * type T2 = WithDefault; * // "bar" * type T3 = WithoutDefault<"", "bar", "falsy">; * ``` */ type WithDefault = TPolicy extends "nothing" ? If, TDef, TVal> : TPolicy extends "falsy" ? If, TDef, TVal> : never; //#endregion //#region src/interpolation/IsTemplateLiteral.d.ts type CountTemplates = string extends T ? 1 : T extends `${infer First}${infer Rest}` ? Or<[string extends First ? true : false, `${number}` extends First ? true : false]> extends true ? CountTemplates : CountTemplates : C["length"]; /** * **isTemplateLiteral**`` * * A boolean operator which evaluates if `T` has dynamic types * like `${string}`, `${number}`, or `${boolean}` included in * it. * * - Note a wide `string` and a `${string}` type will result in `false` as they * are both equivalent to a wide string in the type system. */ type IsTemplateLiteral = IsUnion extends true ? Every, "containsSome", ["true", "false"]> : T extends string ? string extends T ? false : T extends "" ? false : [CountTemplates<`|${T}|`>] extends [0] ? false : true : false; //#endregion //#region src/interpolation/ReplaceInterpolation.d.ts /** * determine replacement type */ type R$1 = T extends string ? T : T extends readonly (string | number | boolean)[] ? T["length"] extends 0 ? D : First$1 : never; type Next$1 = T extends string ? T : T extends readonly (string | number | boolean)[] ? AfterFirst : never; /** * **ReplaceStringInterpolation**`` * * Replaces all instances of `${string}` in `TContent` with `TReplace` */ type ReplaceStringInterpolation = TContent extends `${infer First}${infer Rest}` ? [IsEqual] extends [true] ? ReplaceStringInterpolation, `${TResult}${R$1}`> : ReplaceStringInterpolation : [TContent] extends [""] ? TResult : [IsEqual] extends [true] ? `${TResult}${R$1}` : `${TResult}${TContent}`; /** * **ReplaceNumericInterpolation**`` * * Replaces all instances of `${number}` in `TContent` with `TReplace` * * - when `TReplace` is single string then all instances are replaced with * this value * - when `TReplace` is an array of strings then strings are pulled off in a FIFO * manner to replace * * **Related:** `ReplaceStringInterpolation` */ type ReplaceNumericInterpolation = TContent extends `${infer First}${infer Rest}` ? [IsEqual] extends [true] ? ReplaceNumericInterpolation, `${TResult}${R$1}`> : ReplaceNumericInterpolation : [TContent] extends [""] ? TResult : [IsEqual] extends [true] ? `${TResult}${R$1}` : `${TResult}${TContent}`; type ReplaceTrueFalse = [] extends T ? TResult[number] : ReplaceTrueFalse, R, [...TResult, ReplaceAll, "true" | "false", R>]>; /** * **ReplaceBooleanInterpolation**`` * * Replaces all instances of `${boolean}` in `TContent` with `TReplace` * * **Note:** * - the `${boolean}` type is far more difficult to work with then * the `${string}` and `${number}` template literals. * - this is due to the fact that Typescript immediately converts a `${boolean}` into a union type * * **Related:** `ReplaceStringInterpolation`, `ReplaceNumericInterpolation` */ type ReplaceBooleanInterpolation = IsUnion extends true ? UnionToTuple["length"] extends number ? IsLessThan["length"], 10> extends true ? UnionToTuple extends readonly string[] ? ReplaceTrueFalse, TReplace> : TContent : TContent : TContent : TContent; //#endregion //#region src/interpolation/StartsWithTemplateLiteral.d.ts type UnionStartsBoolean = And<{ [K in keyof T]: T[K] extends string ? StartsWith : never }>; /** * **HasLeadingTemplateLiteral**`` * * tests whether `T` _starts with_ a leading template literal * such as `${string}`, `${number}`, or `${boolean}` */ type StartsWithTemplateLiteral = T extends string ? [IsUnion] extends [true] ? [UnionToTuple] extends [readonly string[]] ? UnionStartsBoolean> : never : T extends `${infer First}${infer _Rest}` ? IsEqual<`${string}`, First> extends true ? true : IsEqual<`${number}`, First> extends true ? true : false : false : false; //#endregion //#region src/interpolation/StaticTemplateSections.d.ts type Finalize = TWithType extends true ? { [K in keyof TResults]: StringLiteralTemplate } : TResults; type Section = TWithType extends null ? THead : `${THead}${TBlock}`; type Scan = TTemplate extends `{{string}}${infer Rest}` ? Scan]> : TTemplate extends `{{number}}${infer Rest}` ? Scan]> : TTemplate extends `{{boolean}}${infer Rest}` ? Scan]> : TTemplate extends `{{true}}${infer Rest}` ? Scan]> : TTemplate extends `{{false}}${infer Rest}` ? Scan]> : TTemplate extends `${infer Head}${infer Rest}` ? Scan : TResults; /** * **StaticTemplateSections**`` * * Segments the various static sections defined in the `TTemplate`. * * - if you optionally set the `TWithType` generic to `true` then the * string literal templates will be added * - if you set `TWithType` generic to `false` then the template blocks * like `{{string}}`, etc. will be added. */ type StaticTemplateSections = Finalize extends infer Template extends string ? As, readonly string[]> : [], TWithType>; //#endregion //#region src/interpolation/StringLiteralTemplate.d.ts type _StringLiteralTemplate = T extends number ? `${number}` : T extends boolean ? `${boolean}` : T extends `${infer Before}{{string}}${infer After}` ? StringLiteralTemplate<`${Before}${string}${After}`> : T extends `${infer Before}{{number}}${infer After}` ? StringLiteralTemplate<`${Before}${number}${After}`> : T extends `${infer Before}{{boolean}}${infer After}` ? StringLiteralTemplate<`${Before}${boolean}${After}`> : T extends `${infer Before}{{true}}${infer After}` ? StringLiteralTemplate<`${Before}${true}${After}`> : T extends `${infer Before}{{false}}${infer After}` ? StringLiteralTemplate<`${Before}${false}${After}`> : T; /** * **StringLiteralTemplate**`` * * Converts a string literal into a "template" by replacing tokens * like `{{string}}`, `{{number}}`, or `{{boolean}}` with the * corresponding string literal equivalent. * * **Related:** `EachAsStringLiteralTemplate`, `ObjectValuesAsStringLiteralTemplate` */ type StringLiteralTemplate = IsStringLiteral extends true ? _StringLiteralTemplate : never; /** * **EachAsStringLiteralTemplate**`` * * Convert a tuple of values which are easily made into string literal types * into a tuple of literal template strings. * * **Related:** `StringLiteralTemplate` */ type EachAsStringLiteralTemplate = [] extends T ? R : EachAsStringLiteralTemplate, [...R, StringLiteralTemplate>]>; /** * **ObjectValuesAsStringLiteralTemplate**`` * * Convert the values of an object into String Literal Templates. * * **Related:** `StringLiteralTemplate`, `EachAsStringLiteralTemplate` */ type ObjectValuesAsStringLiteralTemplate> = { [K in keyof T]: T[K] extends string ? StringLiteralTemplate : never }; //#endregion //#region src/interpolation/StripLeadingTemplate.d.ts type Check$3 = [K] extends ["all"] ? Or<[IsEqual, IsEqual]> : [K] extends ["string"] ? IsEqual : [K] extends ["number"] ? IsEqual : false; type FixUnion = IsUnion extends true ? First$1> extends `${"true" | "false"}${infer Rest}` ? Rest : T : T; /** * **StripLeadingTemplate**`` * * Strips a dynamic segment (e.g., `${string}`, `${number}`, `${boolean}`) * out of `T` if it exists. Otherwise proxies `T` through. */ type StripLeadingTemplate = [IsWideString] extends [true] ? string : [T] extends [`${infer First}${infer Rest}`] ? [Check$3] extends [true] ? Rest : FixUnion : ""; //#endregion //#region src/interpolation/StripSurroundingStringTemplate.d.ts /** * **StripLeadingStringTemplate**`` * * Strips any existing `${string}` type when it starts the type T. * * ```ts * // `FooBar${string}` * type Foobar = StripLeadingStringTemplate<`${string}Foobar${string}`> * ``` */ type StripLeadingStringTemplate = T extends `${infer First}${infer Rest}` ? IsEqual extends true ? StripLeadingStringTemplate : T : never; /** * **StripTrailingStringTemplate**`` * * Strips any existing `${string}` type when ity terminates the type T. * * ```ts * // `${string}FooBar` * type Foobar = StripTailingStringTemplate<`${string}Foobar${string}`> * ``` */ type StripTrailingStringTemplate = IsStringLiteral extends true ? Join> : never; /** * **StripSurroundingStringTemplate**`` * * Strips any existing `${string}` type when it _leads_ or _terminates_ the type T. * * ```ts * // `FooBar` * type Foobar = StripTailingStringTemplate<`${string}Foobar${string}`> * ``` */ type StripSurroundingStringTemplate = IsStringLiteral extends true ? StripTrailingStringTemplate> : never; //#endregion //#region src/interpolation/template-maps.d.ts interface TemplateMap__Basic { string: "string"; number: "number"; boolean: "boolean"; } type AddGeneric = { [K in keyof G | T["name"]]: K extends T["name"] ? T["token"] : K extends keyof G ? G[K] : never }; /** * **TemplateMap__Generics**`` * * Provides a static template based on the generic types provided. It also * always includes the basics for `string`, `number`, and `boolean`. */ type TemplateMap__Generics = T extends [infer Head extends GenericParam, ...infer Rest extends readonly GenericParam[]] ? TemplateMap__Generics> : G; /** * **TemplateMap**`<[T]>` * * By default it provides the basics of _string_, _number_, and _boolean_ but when * you set the generic `T` using a `DefineObject` this map will be combined with the * basics. */ type TemplateMap = MergeObjects, As>; //#endregion //#region src/interpolation/TemplateBlock.d.ts type Blocks = Mutable; /** * **DefaultTemplateBlocks** * * A static string which represents a _future_ dynamic segment * (of the specified type). */ type DefaultTemplateBlocks = Blocks[number]; /** * A `TemplateBlock` with the curly braces surrounding it stripped off. */ type TemplateBlock__BARE = { [K in keyof Blocks]: Blocks[K] extends `{{${infer Bare extends string}}}` ? Bare : never }[number]; //#endregion //#region src/interpolation/TemplateBlocks.d.ts /** * **TemplateBlocks**`` * * Given a template string `T`, this utility will extract all of the * dynamic blocks -- in the correct order -- found in the template string. * * @deprecated use `GetTemplateBlocks` instead */ type TemplateBlocks = string extends T ? DefaultTemplateBlocks[] : As, string>, DefaultTemplateBlocks, "inline">, "extends", [DefaultTemplateBlocks]>, readonly DefaultTemplateBlocks[]>; /** * **GetTemplateBlocks**`` * * A more flexible variant of `TemplateBlocks` where by default the "blocks" which are * used are the standard blocks used for interpolation: `{{string}} | {{number}} | {{boolean}}`. * * - if you want to define your own block vocabulary you can simply express it as a union type * and pass into the optional `B` parameter. */ type GetTemplateBlocks = As extends infer Elements extends readonly string[] ? Filter : never, readonly string[]>; //#endregion //#region src/interpolation/TemplateParams.d.ts interface Map$1 { "{{string}}": string; "{{number}}": number; "{{boolean}}": boolean; } /** * **TemplateParams**`` * * Extracts a tuple of wide types which are needed to complete a given literal template. * * @deprecated use `GetTemplateParams` instead */ type TemplateParams> = { [K in keyof B]: B[K] extends keyof Map$1 ? Map$1[B[K]] : never }; type StripCurly = T extends `{{${infer Inner}}}` ? Inner : T; type AsMap = T extends [infer Head extends string | DefineObject, ...infer Rest extends readonly (string | DefineObject)[]] ? Head extends string ? AsMap, FromInputToken__String>>> : Head extends DefineObject ? AsMap> : never : ExpandRecursively; /** * converts all union members into a DefineObject where the _keys_ * represent the dynamic segments and the _values_ are the type * this segment needs to extend. */ type SegmentMap = IsUnion extends true ? UnionToTuple extends infer Config extends readonly (string | DefineObject)[] ? AsMap : never : T extends string ? string extends T ? { string: string; number: number; boolean: boolean; } : Record : T extends DefineObject ? FromDefineObject : never; type AsDynamicSegment> = As extends infer Keys extends readonly string[] ? { [K in keyof Keys]: `{{${Keys[K]}}}` }[number] : never, string>; type Lookup$25> = T extends keyof M ? M[T] : unknown; /** * **GetTemplateParams**`` * * Extracts the _types_ of the dynamic segments from left to right found in the template. * * ```ts * // [string, number] * type T = GetTemplateParams<"Hi {{string}}, you're age is {{number}}">; * ``` * * However, you can also add your own dynamic segments by providing a dictionary who's _keys_ * represent the segment name (you don't need to surround with curly braces) and the _values_ * are the **type** you would like to map to (in the form of a string `InputToken`). * * ```ts * // [ string, `${string}@`${string}.${string}` ] * type T = GetTemplateParams< * "Hi {{string}}, you're email is {{email}}", * { string: "string", email: `${string}@`${string}.${string}` } * >; * ``` * * **Note:** * - when creating your own segments, consider using one of the helper utils: * - `TemplateMap` - adds your definition from `T` to the standard set of segments * - `TemplateMap__Generics` - provided a tuple of `GenericParam`'s, this will use the generic's types * as part of the template. * * **Related:** `TemplateBlocks`, `IntoTemplate`, `Interpolate` */ type GetTemplateParams = SegmentMap, TFoundSegments extends readonly string[] = GetTemplateBlocks>> = { [K in keyof TFoundSegments]: Lookup$25, TMap> }; //#endregion //#region src/boolean-logic/operators/datetime/IsBefore.d.ts type IsSameDateDifferentPrecision = A extends `${infer DatePart}T00:00:00Z` ? B extends DatePart ? true : false : B extends `${infer DatePart}T00:00:00Z` ? A extends DatePart ? true : false : false; type IsCharGreater = A extends "0" ? false : A extends "1" ? B extends "0" ? true : false : A extends "2" ? B extends "0" | "1" ? true : false : A extends "3" ? B extends "0" | "1" | "2" ? true : false : A extends "4" ? B extends "0" | "1" | "2" | "3" ? true : false : A extends "5" ? B extends "0" | "1" | "2" | "3" | "4" ? true : false : A extends "6" ? B extends "0" | "1" | "2" | "3" | "4" | "5" ? true : false : A extends "7" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" ? true : false : A extends "8" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" ? true : false : A extends "9" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" ? true : false : A extends ":" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ? true : false : A extends "T" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-" | ":" ? true : false : A extends "Z" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "-" | ":" | "T" ? true : false : A extends "-" ? B extends "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ? true : false : false; type LexicographicCompare = A extends B ? false : IsSameDateDifferentPrecision extends true ? false : [A] extends [never] ? false : [B] extends [never] ? false : [A, B] extends [string, string] ? A extends `${infer AFirst}${infer ARest}` ? B extends `${infer BFirst}${infer BRest}` ? AFirst extends BFirst ? LexicographicCompare : IsCharGreater : true : false : false; /** * **IsBefore**`` * * Tests whether `A` is _before_ (in time) `B`. */ type IsBefore = A extends object ? boolean : B extends object ? boolean : string extends A ? boolean : string extends B ? boolean : IsTemplateLiteral extends true ? boolean : IsTemplateLiteral extends true ? boolean : number extends A ? boolean : number extends B ? boolean : A extends number ? B extends number ? IsLessThan : boolean : A extends string ? B extends string ? LexicographicCompare : boolean : boolean; //#endregion //#region src/boolean-logic/operators/datetime/IsDateLike.d.ts type Member$1 = { [K in keyof T]: IsIsoDate }; /** * **IsDateLike**`` * * Boolean operator which tests whether `T` is truly `DateLike` * * - this includes testing any number to be sure it is an Integer number * - the static _type_ `DateLike` is an approximation but allows for "false positives" * so this utility will get you to a literal `true`/`false`. */ type IsDateLike = [IsAny] extends [true] ? false : [IsNever] extends [true] ? false : [IsUnknown] extends [true] ? boolean : [IsUnion] extends [true] ? Every>, "equals", true> extends true ? true : Some>, "equals", true> extends true ? boolean : false : [T] extends [object] ? [IsJsDate] extends [true] ? true : [IsMoment] extends [true] ? true : [IsLuxonDateTime] extends [true] ? true : [IsDayJs] extends [true] ? true : false : [number] extends [T] ? boolean : [T] extends [number] ? IsNegativeNumber extends true ? false : IsInteger extends true ? true : false : [IsString] extends [true] ? [IsIsoFullDate] extends [true] ? true : [IsIsoYear] extends [true] ? true : [IsIsoMonthDate] extends [true] ? true : [IsIsoYearMonth] extends [true] ? true : [IsIsoDateTime] extends [true] ? true : false : false; //#endregion //#region src/boolean-logic/operators/datetime/IsDayJs.d.ts interface Shape$4 { add: AnyFunction; clone: AnyFunction; date: AnyFunction; endOf: AnyFunction; isAfter: AnyFunction; isBefore: AnyFunction; daysInMonth: AnyFunction; millisecond: AnyFunction; calendar: unknown; } /** * **IsDayJs**`` * * Boolean utility to test whether `T` is DayJS date object. */ type IsDayJs = [IsAny] extends [true] ? false : [IsNever] extends [true] ? false : [IsUnknown] extends [true] ? boolean : [IsUnion] extends [true] ? true extends (T extends Shape$4 ? true : false) ? T extends Shape$4 ? true : boolean : false : IsDictionary extends true ? T extends Shape$4 ? true : false : false; //#endregion //#region src/datetime/AsDateMeta.d.ts type ParsedDateType = T extends [infer Year, infer Month, infer Date, infer Time] ? Date extends null ? Month extends null ? "year" : "year-month" : Year extends null ? "year-independent" : Time extends null ? "date" : "datetime" : never; type HasTime = ParsedDateType extends "datetime" ? T[3] extends [infer Hour, infer Minute, infer Second, infer MS, infer TZ] ? Hour extends "00" ? Minute extends "00" ? Or<[Extends, IsNull]> extends true ? Or<[Extends, IsNull]> extends true ? Or<[Extends, IsNull]> extends true ? false : true : true : true : true : true : never : false; type Hour$1 = T extends null ? null : T extends ParsedTime ? T[0] : never; type Minute$1 = T extends null ? null : T extends ParsedTime ? T[1] : never; type Second$2 = T extends null ? null : T extends ParsedTime ? T[2] : never; type Millisecond = T extends null | undefined ? null : T extends ParsedTime ? T[3] : never; type Offset = T extends null ? null : T extends ParsedTime ? T[4] : never; type SetParsed = { dateType: ParsedDateType; hasTime: HasTime; year: T[0]; month: T[1]; date: T[2]; hour: Hour$1; minute: Minute$1; second: Second$2; ms: Millisecond; timezone: Offset; }; /** * **AsDateMeta**`` * * Tests to see if `T` can be parsed into a `DateMeta` type. * * - a valid ISO string _or_ a `ParsedData` array should be * able to be parsed. * - if it can then `DateMeta` is returned * - if not then an `Error` will be returned * * Note: if the value passed in as `T` is a `ParsedDate` type * then this utility will never return an error as the validation * has already been done. */ type AsDateMeta = T extends ParsedDate ? SetParsed : ParseDate extends infer P ? P extends Error ? P : P extends ParsedDate ? SetParsed

: never : never; //#endregion //#region src/datetime/AsFourDigitYear.d.ts type Digit$8 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; type IsDigits = T extends "" ? false : T extends `${Digit$8}${infer Rest}` ? Rest extends "" ? true : IsDigits : false; type IsFourDigits = T extends `${Digit$8}${Digit$8}${Digit$8}${Digit$8}` ? true : false; type BrandYear = IsTrue extends true ? FourDigitYear> : T; type ConvertNumericString = T extends `-${string}` ? Err<`year-invalid/negative`, `The generic passed into AsFourDigitYear was a NEGATIVE number. This is not allowed!`, { T: T; }> : T extends `${string}.${string}` ? TNumberInput extends true ? Err<`year-invalid/float`, `The generic passed into AsFourDigitYear was a number but not an integer!`, { T: T; }> : Err<"year-invalid/type"> : IsDigits extends true ? PadStart extends infer Padded extends string ? IsFourDigits extends true ? BrandYear : TNumberInput extends true ? Err<`year-invalid/too-large`, `The generic passed into AsFourDigitYear was an integer number but it was larger than 9999 so it will not fit into the ISO FourDigitYear format!`, { T: T; }> : Err<"year-invalid/type"> : Err<"year-invalid/type"> : Err<"year-invalid/type">; type Convert$5 = T extends string ? IsBranded extends true ? Convert$5, B> : ConvertNumericString : T extends number ? number extends T ? IsTrue extends true ? FourDigitYear<"branded"> | Error : FourDigitYear | Error : ConvertNumericString<`${T}`, B, true> : Err<`year-invalid/wrong-type`, `The type passed in as T to AsFourDigitYear was an invalid type! T must be a number or a string literal that can be converted into a number`, { T: T; }>; /** * **AsFourDigitYear**`` * * A type conversion utility which tries to convert `T` into a valid `FourDigitYear` type. * * - by default the conversion is done but the type returned is _not_ a branded type * - to switch this behavior then pass in `true` to the generic `B` * * If there is no way to convert `T` to a `FourDigitYear` then an Error will be returned. */ type AsFourDigitYear = [IsAny] extends [true] ? IsTrue extends true ? FourDigitYear<"branded"> | Error : FourDigitYear | Error : As, IsTrue extends true ? FourDigitYear<"branded"> | Error : FourDigitYear | Error>; //#endregion //#region src/errors/Err.d.ts /** * **TypedError** * * An `Error` which is guaranteed to have a `type` property * and may optionally have a `subType` property. */ type TypedError = Expand; type _Err = EmptyObject> = TType extends `${infer Type}/${infer Subtype}` ? Expand<{ name: PascalCase extends string ? RetainUntil : never>; type: KebabCase; subType: Subtype extends string ? KebabCase : undefined; message: TMsg extends "" ? string : TMsg; cause?: unknown; stack?: string; } & TCtx> & Error : Expand<{ name: PascalCase>; message: TMsg extends "" ? string : TMsg; type: TType; cause?: unknown; stack?: string; } & TCtx> & Error; /** * handles when the "type" is a wide string */ type WideErrType = EmptyObject> = string extends TMsg ? IsEqual extends true ? Error : _Err : _Err; /** * **Err**`` * * Create a strongly typed error with type and subType information. * * - TType assigns the type to the errors `type` property until a `/` character is found * - the `subType` property is the string literal portion of `TType` after the `/` character * - any key/value pairs on `TCtx` will be available on the error too * * **Related:** * - `err(type, msg, ctx)` mirrors same functionality for runtime * - `ErrContext` allows _adding_ context to an existing Error * - `WhenErr` allows conditionally adding context to an Error * when/if `T` extends Error. Otherwise proxies `T` through "as is" */ type Err = EmptyObject> = string extends TType ? WideErrType : _Err; /** * Adds "context" to an existing `Error`. */ type ErrContext = Expand & C> extends Error ? Expand & C> & Error : never; /** * **WhenErr**`` * * When `T` extends **Error** then the "context" of `C` will be added to the **Error**. * * - if `T` is _not_ an error then it will be proxied through "as is". */ type WhenErr = T extends Error ? ErrContext & Error : T; //#endregion //#region src/errors/ErrMsg.d.ts type ErrMsg = TContext extends string ? TType & { desc: TContext; kind: "ErrMsg"; } : TType & ExpandDictionary; //#endregion //#region src/errors/ErrType.d.ts /** * **ErrType**`` * * Return the `type` property of `T` if: * * - T is an Error * - T has the property `type` * * **Related:** `Err`, `ErrSubType` */ type ErrType = T extends Error ? "type" extends keyof T ? T["type"] extends infer Type ? Type : undefined : undefined : undefined; //#endregion //#region src/errors/HasErrors.d.ts type CheckArray$1 = T extends [infer Head, ...infer Rest] ? U extends string ? Head extends Err ? true : CheckArray$1 : Head extends Error ? true : CheckArray$1 : false; type CheckDictionary$1 = CheckArray$1, U>; /** * **HasErrors**`` * * Checks whether a container `T` has _values_ which extend Error. */ type HasErrors = T extends readonly unknown[] ? CheckArray$1 : T extends Dictionary ? CheckDictionary$1 : never; //#endregion //#region src/errors/IsolateErrors.d.ts /** * The results produced by the `IsolateErrors` utility */ interface IsolatedResults { successes: readonly unknown[]; errors: readonly Error[]; otherErrors: readonly Error[]; } type CheckArray = T extends readonly [infer Head, ...infer Rest] ? Head extends Error ? U extends string ? CheckArray ? { successes: R["successes"]; errors: [...R["errors"], Head]; otherErrors: R["otherErrors"]; } : { successes: R["successes"]; errors: R["errors"]; otherErrors: [...R["otherErrors"], Head]; }, IsolatedResults>> : CheckArray> : CheckArray> : R; type CheckDictionary = CheckArray, U>; /** * **IsolateErrors**`` * * Isolates error's from successful outcomes in the _values_ of `T`. * * - When `U` is unset then you will be returned a dictionary with `successes` and `errors` properties. * - When `U` **is** set then it represents a type/subtype of the error. The result this utility * returns is `successes`, `errors`, and `otherErrors` (for errors which were found but not errors * of the specified type) */ type IsolateErrors = T extends readonly unknown[] ? CheckArray : T extends Dictionary ? CheckDictionary : never; //#endregion //#region src/errors/ProxyError.d.ts /** * **ProxyErr**`` * * Tests `TError` to see if it extends the Javascript `Error` class * and if so it proxies it forward. If it is not then TElse is returned in * it's place. */ type ProxyErr = TError extends Error ? As>, TypedError> : TElse; //#endregion //#region src/errors/StackTrace.d.ts type SymbolKind = "function" | "method"; interface StackFrame { type: string; fn_name: string; method_name: string; filename: string; line_number: number; col_number: number; is_native: boolean; is_constructor: boolean; } type StackTrace = StackFrame[]; //#endregion //#region src/string-literals/AsTypeSubtype.d.ts type AsTypeSubtype = IsWideString extends true ? [string, string | undefined] : T extends `${infer Type}/${infer Subtype}` ? [Type, Subtype] : [T, undefined]; //#endregion //#region src/string-literals/BackTick.d.ts /** * The unicode representation of a back tick character (e.g., `\`). */ type BackTick = "\u005C"; //#endregion //#region src/string-literals/Cardinality.d.ts type OneToOne = `1:1`; type OneToMany = `1:M`; type OneToZero = `1:0`; type ZeroToOne = `0:1`; type ZeroToMany = `0:M`; type ZeroToZero = `0:0`; type ManyToMany = "M:M"; type ManyToOne = "M:1"; type ManyToZero = "M:0"; type CardinalityNode = "0" | "1" | "M"; /** * Cardinality which expects a singular input and requires * 1 or many outputs. * * Note: choose `CardinalityFilter1` if you want to allow output * to have no outputs. */ type Cardinality1 = OneToOne | OneToMany; /** * Cardinality which expects a singular input and maps to 0, * 1, or many outputs. */ type CardinalityFilter1 = OneToOne | OneToMany | OneToZero; /** * Cardinality which expects a singular input which is allowed to be * _undefined_ or the expected type. */ type Cardinality0 = ZeroToOne | ZeroToMany | OneToOne | OneToMany; /** * Cardinality which expects a singular input -- which is allowed to be * _undefined_ -- and maps to 0, * 1, or many outputs. */ type CardinalityFilter0 = ZeroToOne | ZeroToMany | OneToOne | OneToMany | OneToZero | ZeroToZero; type CardinalityExplicit = `${number}:${number}`; /** * Cardinality of any sort between two types */ type Cardinality = CardinalityFilter0 | CardinalityFilter1 | ManyToMany | ManyToOne | ManyToZero | CardinalityExplicit; /** * The first or _input_ part of the Cardinality relationship */ type CardinalityIn = T extends `${infer IN}:${string}` ? IN : never; /** * The second or _output_ part of the Cardinality relationship */ type CardinalityOut = T extends `${string}:${infer OUT}` ? OUT : never; type CardinalityInput = UnionToTuple extends readonly unknown[] ? First$1> extends 1 ? T : T[] : T | undefined; //#endregion //#region src/string-literals/casing/AllCaps.d.ts type Process$45 = { [K in keyof TChars]: Capitalize }; /** * **AllCaps**`` * * Type utility which converts all alphabetic characters to their * UPPERCASE variant. */ type AllCaps = If, Chars extends readonly string[] ? Process$45> extends readonly string[] ? Concat>> : never : Chars, string>; //#endregion //#region src/string-literals/casing/CamelCase.d.ts /** * Direct camelCase conversion that leverages optimized PascalCase */ type CamelCaseSimple = IsAllCaps extends true ? Uncapitalize>>> : Uncapitalize>>; /** * **CamelCase**`` * * Converts a string to `CamelCase` format. */ type CamelCase = string extends T ? string : T extends string ? CamelCaseSimple : T extends readonly unknown[] ? { [K in keyof T]: T[K] extends string ? CamelCase : T[K] } : never; //#endregion //#region src/string-literals/casing/CapFirstAlpha.d.ts /** * Strips the non-alpha characters that lead a string */ type StripLeftNonAlpha = S extends `${infer First}${infer Rest}` ? First extends NonAlphaChar ? StripLeftNonAlpha : S : never; /** * identifies the leading characters which are _not_ alphabetical */ type LeadingNonAlpha = Replace, "">; /** * Capitalize the first alphabetical character in the string */ type CapFirstAlpha = LeadingNonAlpha extends string ? `${LeadingNonAlpha}${Capitalize, "">>}` : Capitalize; //#endregion //#region src/string-literals/casing/CapitalizeWords.d.ts /** * Capitalize all words in a string */ type CapitalizeWords = S extends `${infer L} ${infer R}` ? `${CapitalizeWords} ${CapitalizeWords}` : S extends `${infer L},${infer R}` ? `${CapitalizeWords},${CapitalizeWords}` : S extends `${infer L}.${infer R}` ? `${CapitalizeWords}.${CapitalizeWords}` : Capitalize; //#endregion //#region src/string-literals/casing/DashToSnake.d.ts type DashToSnake = T extends `${infer HEAD}-${infer TAIL}` ? DashToSnake<`${HEAD}_${TAIL}`> : T; //#endregion //#region src/string-literals/casing/DashUppercase.d.ts type _DU = T extends Lowercase ? T : `-${Lowercase}`; /** * Converts uppercase characters to a dash and then the lowercase equivalent * * ```ts * // "one-two-three" * type T = DashUppercase<"oneTwoThree">; * ``` * * _Intended to be used as a lower level utility; prefer `Dasherize` for more full-fledged * dash solution_. */ type DashUppercase = HasUppercase extends false ? T : T extends `${infer C0}${infer C1}${infer R}` ? `${_DU}${_DU}${DashUppercase}` : T extends `${infer C0}${infer R}` ? `${_DU}${DashUppercase}` : ""; //#endregion //#region src/string-literals/casing/KebabCase.d.ts type Process$44 = TPreserve extends true ? Concat<[LeftWhitespace, KebabCase, RightWhitespace]> : string extends TString ? string : DashUppercase>> extends `${infer Begin}${"_" | " "}${infer Rest}` ? KebabCase<`${Lowercase}-${Rest}`> : Replace>>>>, "--", "-">; /** * **KebabCase**`` * * Converts a string literal into a `kebab-case` format while optionally * allowing surrounding whitespace. * * ```ts * // "foo-bar" * type Dash = Dasherize<"foo_bar">; * type Dash = Dasherize<"fooBar">; * type Dash = Dasherize<"FooBar">; * // "\n foo-bar \t" * type Dash = Dasherize<"\n foo bar \t">; * ``` */ type KebabCase = TInput extends string ? Process$44 extends string ? Process$44 : never : TInput extends readonly unknown[] ? As<{ [K in keyof TInput]: TInput[K] extends string ? KebabCase : TInput[K] }, readonly unknown[]> : never; //#endregion //#region src/string-literals/casing/LowerAllCaps.d.ts /** * **LowerAllCaps**` * * Type utility which will convert an "all caps" string to a string where all characters are lowercase; in * all other cases it will do nothing and simply return `T` as `T`. * * **Related:** `RaiseAllLowercase` */ type LowerAllCaps = IsAllCaps extends true ? Lowercase : T; //#endregion //#region src/string-literals/casing/NamingConvention.d.ts /** * **NamingConvention**`<[T]>` * * A type union between all common naming conventions for * variables in programming. * * **Related:** `NamingModifier` */ type NamingConvention = "camelCase" | "PascalCase" | "kebab-case" | "snake_case"; //#endregion //#region src/string-literals/casing/PascalCase.d.ts /** * Limited depth PascalCase - processes up to 20 segments to avoid deep recursion */ type LimitedPascalCase = Depth["length"] extends 20 ? T : T extends `${infer Before}-${infer After}` ? `${Capitalize}${LimitedPascalCase}` : T extends `${infer Before}_${infer After}` ? `${Capitalize}${LimitedPascalCase}` : T extends `${infer Before} ${infer After}` ? `${Capitalize}${LimitedPascalCase}` : Capitalize; /** * Recursive PascalCase for strings with delimiters * Processes one character at a time to handle mixed delimiters correctly */ type RecursivePascalCase = T extends `${string}${"-" | "_" | " "}${string}` ? LimitedPascalCase : T extends `${infer First}${infer Rest}` ? First extends "-" | "_" | " " ? RecursivePascalCase : CapNext extends true ? `${Uppercase}${RecursivePascalCase}` : `${Lowercase}${RecursivePascalCase}` : ""; /** * Handles camelCase strings by detecting uppercase letters as word boundaries */ type HandleCamelCase = T extends `${infer First}${infer Rest}` ? Uppercase extends First ? Lowercase extends First ? HandleCamelCase : Result extends "" ? HandleCamelCase : HandleCamelCase : Rest extends `${infer Next}${string}` ? Uppercase extends Next ? Lowercase extends Next ? HandleCamelCase}`> : HandleCamelCase}-`> : HandleCamelCase}`> : `${Result}${Lowercase}` : Result; /** * Simplified PascalCase conversion that uses recursive approach for delimited strings */ type PascalCaseSimple = T extends `${string}-${string}` | `${string}_${string}` | `${string} ${string}` ? RecursivePascalCase : T extends `${infer _First}${infer Rest}` ? Rest extends `${string}${Uppercase}${string}` ? RecursivePascalCase> : Capitalize : Capitalize; /** * Converts a string literal type to a **PascalCase** representation. * ```ts * // "FooBar" * type T = PascalCase<"fooBar">; * type T = PascalCase<"foo-bar">; * type T = PascalCase<"foo_bar">; * type T = PascalCase<"\n foo_bar \t">; * ``` */ type PascalCase = string extends T ? string : T extends string ? IsAllCaps extends true ? PascalCaseSimple>> : PascalCaseSimple> : T extends readonly unknown[] ? { [K in keyof T]: T[K] extends string ? PascalCase : T[K] } : never; //#endregion //#region src/string-literals/casing/SnakeCase.d.ts /** * Direct snake_case conversion in a single pass * Handles camelCase, PascalCase, kebab-case, spaces, and existing snake_case */ type SnakeCaseCore = T extends `${infer First}${infer Rest}` ? First extends "-" | " " ? SnakeCaseCore : First extends "_" ? SnakeCaseCore : Uppercase extends First ? Lowercase extends First ? SnakeCaseCore : PrevWasLower extends true ? SnakeCaseCore}`, false> : SnakeCaseCore}`, false> : SnakeCaseCore}`, true> : Result; /** * Limited depth snake_case to avoid deep recursion on very long strings */ type LimitedSnakeCase = Depth["length"] extends 25 ? T : T extends `${infer Before}-${infer After}` ? `${Lowercase}_${LimitedSnakeCase}` : T extends `${infer Before} ${infer After}` ? `${Lowercase}_${LimitedSnakeCase}` : Lowercase; /** * Optimized SnakeCase that tries fast paths first */ type SnakeCaseSimple = T extends `${string}${"-" | " "}${string}` ? LimitedSnakeCase : IsAllCaps extends true ? Lowercase : SnakeCaseCore; /** * **SnakeCase**`` * * Converts a string literal type to _snake_case_. * ```ts * // "foo_bar" * type T = SnakeCase<"fooBar">; * type T = SnakeCase<"foo bar">; * type T = SnakeCase<"foo-bar">; * ``` */ type SnakeCase = string extends T ? string : T extends string ? SnakeCaseSimple> : T extends readonly unknown[] ? { [K in keyof T]: T[K] extends string ? SnakeCase : T[K] } : never; //#endregion //#region src/string-literals/character-sets/AlphaChar.d.ts /** * **AlphaChar** * * Alphabetical character (both upper and lowercase). * * **Related:** `UpperAlphaChar`, `LowerAlphaChar`, `Alpha` */ type AlphaChar = UpperAlphaChar | LowerAlphaChar; //#endregion //#region src/string-literals/character-sets/AlphanumericChar.d.ts /** * **AlphanumericChar** * * A character which is either a letter (upper or lower) or a number. */ type AlphanumericChar = AlphaChar | NumericChar; //#endregion //#region src/string-literals/character-sets/BCP.d.ts /** * The [BCP47 standard](https://en.wikipedia.org/wiki/IETF_language_tag) is * used to specify a country or region. * * Notes: * * - it is also used heavily in Javascript, such as the for Locale strings, etc. * - this type is not exhaustive but rather just suggests some and allows all */ type BCP47 = Suggest<"af" | "be" | "bg" | "cy" | "en" | "es" | "fi" | "ga" | "it" | "ja" | "ko" | "hy" | "nl" | "no" | "pl" | "pt" | "sa" | "sv" | "ru" | "th" | "tr" | "uk" | "ur" | "zh">; //#endregion //#region src/string-literals/character-sets/brackets/Brackets.d.ts /** * Opening and closing brackets. Where brackets are parenthesis, square brackets, and curly brackets. * * **Related:** `OpeningBracket`, `ClosingBracket` */ type Bracket = "(" | "[" | "{" | "<" | ")" | "]" | "}" | ">"; //#endregion //#region src/string-literals/character-sets/brackets/ClosingBracket.d.ts /** * **ClosingBracket** */ type ClosingBracket = ")" | "]" | "}" | ">"; //#endregion //#region src/string-literals/character-sets/brackets/OpeningBracket.d.ts /** * **OpeningBracket** */ type OpeningBracket = "(" | "[" | "{" | "<"; //#endregion //#region src/string-literals/character-sets/CarriageReturn.d.ts /** The **carriage return** character */ type Cr = "\n"; /** An _optional_ **carriage return** character */ type OptCr = "\n" | ""; /** * a **carriage return** character followed by indentation * * **Related:** `OptCrThenIndent`, `Cr`, `OptCr` */ type CrThenIndent = `${Cr}${Indent}`; /** * an _optional_ **carriage return** character followed by indentation * * **Related:** `CrThenIndent`, `Cr`, `OptCr` */ type OptCrThenIndent = CrThenIndent | ""; //#endregion //#region src/string-literals/character-sets/Char.d.ts /** * **Char** * * Meant to represent a single character. Includes: * * - Alphanumeric characters * - Punctuation ( . , ; ! ? ) * - Whitespace ( " " "\t" "\n" "\b" ) * - Bracket characters ( { [ ( ) ] } ) * - Quote characters ( " ' ` ) * - Currency characters ( $ ¢ £ € ฿ ¥ ₹ ₽ ) * - Math characters ( + - * / ^ ✕ ÷ = ≄ > < ) * - Special Chars ( @ ~ # & | \ # ) */ type Char$1 = AlphanumericChar | Punctuation | Whitespace | Bracket | SpecialChar | QuoteCharacter | PlusMinus | NBSP | CurrencyChar | MatchChar | EscapeCodeChars; //#endregion //#region src/string-literals/character-sets/CodePointOf.d.ts interface CharCodeMap { "A": 65; "B": 66; "C": 67; "D": 68; "E": 69; "F": 70; "G": 71; "H": 72; "I": 73; "J": 74; "K": 75; "L": 76; "M": 77; "N": 78; "O": 79; "P": 80; "Q": 81; "R": 82; "S": 83; "T": 84; "U": 85; "V": 86; "W": 87; "X": 88; "Y": 89; "Z": 90; "a": 97; "b": 98; "c": 99; "d": 100; "e": 101; "f": 102; "g": 103; "h": 104; "i": 105; "j": 106; "k": 107; "l": 108; "m": 109; "n": 110; "o": 111; "p": 112; "q": 113; "r": 114; "s": 115; "t": 116; "u": 117; "v": 118; "w": 119; "x": 120; "y": 121; "z": 122; "0": 48; "1": 49; "2": 50; "3": 51; "4": 52; "5": 53; "6": 54; "7": 55; "8": 56; "9": 57; " ": 32; "!": 33; "\"": 34; "#": 35; "$": 36; "%": 37; "&": 38; "'": 39; "(": 40; ")": 41; "*": 42; "+": 43; ",": 44; "-": 45; ".": 46; "/": 47; ":": 58; ";": 59; "<": 60; "=": 61; ">": 62; "?": 63; "@": 64; "[": 91; "\\": 92; "]": 93; "^": 94; "_": 95; "`": 96; "{": 123; "|": 124; "}": 125; "~": 126; } type CodePointsTuple = T extends [infer H extends string, ...infer R extends string[]] ? H extends keyof CharCodeMap ? [CharCodeMap[H], ...CodePointsTuple] : [1, ...CodePointsTuple] : []; /** * **CodePointOf**`` * * A type utility which will convert a single character passed in * to a numeric code point for that character. * * - if you pass in _more_ than just a single character then it will * return a tuple of code points * - if you pass in an empty string literal or a wide string type * you will get an `invalid-value/empty` or `invalid-value/wide-string` * error back respectively. */ type CodePointOf = IsWideString extends true ? Err<`invalid-value/wide-string`, `Call to the type utility CodePointOf with a wide string value is not allowed!`> : Chars extends [infer Char extends string] ? Char extends keyof CharCodeMap ? CharCodeMap[Char] : 1 : Chars["length"] extends 0 ? Err<`invalid-value/empty`, `Call to the type utility CodePointOf with an empty string literal value!`> : CodePointsTuple>; //#endregion //#region src/string-literals/character-sets/Consonants.d.ts /** * **Consonants** * * An array of all consonant characters/letters. * * **Related:** `Consonant` */ type Consonants = typeof CONSONANTS; /** * **Consonant** * * A union type that includes all _consonants_. * * **Related:** `Consonants` */ type Consonant = typeof CONSONANTS[number]; //#endregion //#region src/string-literals/character-sets/Country.d.ts type Iso3166_1_Lookup = typeof ISO3166_1; type Props = "alpha2" | "alpha3" | "countryCode" | "name"; /** * **Iso3166_1_Alpha2** * * A union of all 2 character country codes defined by the ISO3166-1 * standard. */ type Iso3166_1_Alpha2 = { [K in keyof Iso3166_1_Lookup]: "alpha2" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["alpha2"] : never }[number]; /** * **Iso3166_1_Alpha3** * * A union of all 2 character country codes defined by the ISO3166-1 * standard. */ type Iso3166_1_Alpha3 = { [K in keyof Iso3166_1_Lookup]: "alpha3" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["alpha3"] : never }[number]; /** * **Iso3166_1_Alpha3** * * A union of all 2 character country codes defined by the ISO3166-1 * standard. */ type Iso3166_1_CountryCode = { [K in keyof Iso3166_1_Lookup]: "countryCode" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["countryCode"] : never }[number]; /** * **Iso3166_1_Alpha3** * * A union of all 2 character country codes defined by the ISO3166-1 * standard. */ type Iso3166_1_CountryName = { [K in keyof Iso3166_1_Lookup]: "name" extends keyof Iso3166_1_Lookup[K] ? Iso3166_1_Lookup[K]["name"] : never }[number]; /** * Any identifying aspect of an ISO3166-1 country (alpha2, alpha3, code, name) */ type Iso3166_1_Token = Iso3166_1_Alpha2 | Iso3166_1_Alpha3 | Iso3166_1_CountryCode | Iso3166_1_CountryName; type LookupAlpha2 = [] extends Lookup ? undefined : T extends First$1["alpha2"] ? First$1[`${Prop}`] : LookupAlpha2, Prop>; type LookupAlpha3 = [] extends Lookup ? undefined : T extends First$1["alpha3"] ? First$1[`${Prop}`] : LookupAlpha3, Prop>; type LookupCountryCode = [] extends Lookup ? undefined : T extends First$1["countryCode"] ? First$1[`${Prop}`] : LookupCountryCode, Prop>; type LookupCountryName = [] extends Lookup ? undefined : T extends First$1["name"] ? First$1[`${Prop}`] : LookupCountryName, Prop>; /** * **Iso3166Country**`` * * Provides the ISO3166-1 **country name** if provided a valid lookup value ( * aka, a alpha-2, alpha-3, or country code). If not valid returns _undefined_. */ type Iso3166CountryLookup = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2 : T extends Iso3166_1_Alpha3 ? LookupAlpha3 : T extends Iso3166_1_CountryCode ? LookupCountryCode : T extends Iso3166_1_CountryName ? LookupCountryName : IsStringLiteral extends true ? undefined : If, Iso3166_1_CountryCode | undefined, undefined> : undefined : undefined; /** * **Iso3166Alpha2Lookup**`` * * Provides the ISO3166-1 **Alpha 2** code if provided a valid lookup value ( * aka, a alpha-3, country code, or country name). If not valid returns _undefined_. */ type Iso3166Alpha2Lookup = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2 : T extends Iso3166_1_Alpha3 ? LookupAlpha3 : T extends Iso3166_1_CountryCode ? LookupCountryCode : T extends Iso3166_1_CountryName ? LookupCountryName : IsStringLiteral extends true ? undefined : If, Iso3166_1_Alpha2 | undefined, undefined> : undefined : undefined; /** * **Iso3166Alpha33Lookup**`` * * Provides the ISO3166-1 **Alpha 3** code if provided a valid lookup value ( * aka, a alpha-3, country code, or country name). If not valid returns _undefined_. */ type Iso3166Alpha3Lookup = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2 : T extends Iso3166_1_Alpha3 ? LookupAlpha3 : T extends Iso3166_1_CountryCode ? LookupCountryCode : T extends Iso3166_1_CountryName ? LookupCountryName : IsStringLiteral extends true ? undefined : If, Iso3166_1_Alpha3 | undefined, undefined> : undefined : undefined; /** * **Iso3166Alpha33Lookup**`` * * Provides the ISO3166-1 **Alpha 3** code if provided a valid lookup value ( * aka, a alpha-3, country code, or country name). If not valid returns _undefined_. */ type Iso3166CodeLookup = T extends number ? Iso3166CountryLookup<`${T}`> : T extends string ? IsStringLiteral extends true ? T extends Iso3166_1_Alpha2 ? LookupAlpha2 : T extends Iso3166_1_Alpha3 ? LookupAlpha3 : T extends Iso3166_1_CountryCode ? LookupCountryCode : T extends Iso3166_1_CountryName ? LookupCountryName : IsStringLiteral extends true ? undefined : If, Iso3166_1_CountryCode | undefined, undefined> : undefined : undefined; //#endregion //#region src/string-literals/character-sets/css/absolute.d.ts interface CssAbsolutionPositioningProperties { /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/top) */ "top"?: CssSizing; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/bottom) */ "bottom"?: CssSizing; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/left) */ "left"?: CssSizing; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/right) */ "right"?: CssSizing; /** * The inset CSS property is a shorthand that corresponds to the top, right, bottom, * and/or left properties. It has the same multi-value syntax of the margin shorthand. * * This inset properties, including inset, have no effect on non-positioned elements. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/inset) */ "inset"?: CssSizing | `${CssSizing} ${string}`; /** * The `inset-block` CSS property defines the logical block start and end offsets of an * element, which maps to physical offsets depending on the element's writing mode, * directionality, and text orientation. It corresponds to the top and bottom, or * right and left properties depending on the values defined for writing-mode, direction, * and text-orientation. * * This inset property has no effect on non-positioned elements. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-block) */ "inset-block"?: CssSizing | `${CssSizing} ${string}`; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-block-end) */ "inset-block-end"?: CssSizing; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-block-start) */ "inset-block-start"?: CssSizing; /** * The `inset-inline` CSS property defines the logical start and end offsets of an element * in the inline direction, which maps to physical offsets depending on the element's * * writing mode, directionality, and text orientation. It corresponds to the top and * bottom, or right and left properties depending on the values defined for writing-mode, * direction, and text-orientation. * * This inset property has no effect on non-positioned elements. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline) */ "inset-inline"?: CssSizing | `${CssSizing} ${string}`; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-end) */ "inset-inline-end"?: CssSizing; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-start) */ "inset-inline-start"?: CssSizing; } //#endregion //#region src/string-literals/character-sets/css/align.d.ts type Positions$1 = "normal" | "start" | "center" | "end" | "flex-start" | "flex-end" | "baseline" | "first baseline" | "space-between" | "space-around" | "space-evenly" | "stretch" | "safe center" | "unsafe center" | CssGlobal; type CssAlignContent = Positions$1; type CssAlignItems = Positions$1 | "anchor-center"; type CssAlignSelf = Positions$1 | "anchor-center"; interface CssAlignProperties { /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content) */ "align-content"?: CssAlignContent; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) */ "align-items"?: CssAlignItems; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/align-self) */ "align-self"?: CssAlignSelf; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) */ "vertical-align"?: "baseline" | "top" | "middle" | "bottom" | "sub" | "text-top"; } //#endregion //#region src/string-literals/character-sets/css/animation.d.ts type CssAnimationDelay = CssTiming; type Direction$1 = "normal" | "reverse" | "alternate" | "alternate-reverse"; type CssAnimationDirection = Direction$1 | `${Direction$1}${Opt$1<`, ${Direction$1}`>}` | `${Direction$1}${Opt$1<`, ${Direction$1}`>}${Opt$1<`, ${Direction$1}`>}${string}`; type CssAnimationDuration = CssTiming; type FillMode = "none" | "forwards" | "backwards" | "both"; type CssAnimationFillMode = FillMode | `${FillMode}${Opt$1<`, ${FillMode}`>}` | `${FillMode}${Opt$1<`, ${FillMode}`>}${Opt$1<`, ${FillMode}`>}${string}`; type Count$2 = `${number}` | "infinite"; type CssAnimationIterationCount = Count$2 | `${Count$2}${Opt$1<`, ${Count$2}`>}` | `${Count$2}${Opt$1<`, ${Count$2}`>}${Opt$1<`, ${Count$2}`>}${string}`; type Composition = "replace" | "add" | "accumulate"; type CssAnimationComposition = Composition | `${Composition}${Opt$1<`, ${Composition}`>}` | `${Composition}${Opt$1<`, ${Composition}`>}${Opt$1<`, ${Composition}`>}${string}`; type TimingFunction = "ease" | "ease-in" | "ease-out" | "ease-in-out" | "linear" | "step-start" | "step-end" | `cubic-bezier(${string})` | `linear(${string})` | `steps(${string})`; type CssAnimationTimingFunction = TimingFunction | `${TimingFunction}${Opt$1<`, ${TimingFunction}`>}${string}`; type PlayState = "paused" | "running"; type CssAnimationPlayState = PlayState | `${PlayState}${Opt$1<`, ${PlayState}`>}` | `${PlayState}${Opt$1<`, ${PlayState}`>}${Opt$1<`, ${PlayState}`>}${string}`; type CssAnimation = `${CssAnimationDuration} ${CssAnimationTimingFunction}${string}` | `${string} ${CssAnimationTimingFunction}${string}`; interface CssAnimationProperties { /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation) */ "animation"?: string; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-composition) */ "animation-composition"?: CssAnimationComposition | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-delay) */ "animation-delay"?: CssAnimationDelay | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction) */ "animation-direction"?: CssAnimationDirection | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-fill-mode) */ "animation-fill-mode"?: CssAnimationFillMode | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-name) */ "animation-name"?: string; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-play-state) */ "animation-play-state"?: CssAnimationPlayState | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-range) */ "animation-range"?: string; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-range-end) */ "animation-range-end"?: string; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-range-start) */ "animation-range-start"?: string; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timeline) */ "animation-timeline"?: string; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function) */ "animation-timing-function"?: CssAnimationTimingFunction | CssGlobal; } //#endregion //#region src/string-literals/character-sets/css/aria.d.ts /** * [**Document Structure Aria Roles**]([**Aria Role**](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#1._document_structure_roles) */ type AriaDocStructureRoles = "alert" | "toolbar" | "tooltip" | "feed" | "math" | "presentation" | "none" | "note"; type AriaWidgetRoles = "scrollbar" | "searchbox" | "separator" | "slider" | "spinbutton" | "switch" | "tab" | "tabpanel" | "treeitem" | "combobox" | "grid" | "menu" | "menubar" | "tablist" | "tree" | "treegrid"; type AriaLandmarkRoles = "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "region" | "search"; type AriaLiveRegionRoles = "alert" | "log" | "marquee" | "status" | "timer"; type AriaWindowRoles = "alertdialog" | "dialog"; /** * [**Aria Role**](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles) * Includes roles from: * - `AriaDocStructureRoles` * - `AriaWidgetRoles` * - `AriaLandmarkRoles` * - `AriaLiveRegionRoles` * * > [Role definitions](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#roles_defined_on_mdn). */ type AriaRole = AriaDocStructureRoles | AriaWidgetRoles | AriaLandmarkRoles | AriaLiveRegionRoles | AriaWindowRoles; //#endregion //#region src/string-literals/character-sets/css/background.d.ts interface CssBackgroundProperties { "background"?: string; "background-attachment"?: string; "background-blend-mode"?: string; "background-clip"?: string; "background-color"?: Suggest; "background-image"?: string; "background-origin"?: string; "background-position"?: string; "background-position-x"?: string; "background-position-y"?: string; "background-repeat"?: string; "background-size"?: CssSizing; } //#endregion //#region src/string-literals/character-sets/css/border.d.ts /** * CSS Border Styles * ([reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-style)) */ type CssBorderStyle = "none" | "hidden" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset"; /** * CSS Border Width * ([reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-width)) */ type CssBorderWidth = "thin" | "medium" | "thick" | CssSizing; type CssBorderImageSource = `url(${string})` | `url(${string}) ${number}` | `url(${string}) ${number} space` | `linear-gradient(${string},${string}) ${number} / ${CssSizing}` | `url(${string}) ${number} ${number} / ${CssSizing} ${string} / ${string}` | CssGlobal; /** * **CssBorderCollapse** * * The border-collapse CSS property sets whether cells inside a have shared * or separate borders. * * - [reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse) */ type CssBorderCollapse = "collapse" | "separate" | CssGlobal; /** * The border-image-repeat CSS property defines how the edge regions and * middle region of a source image are adjusted to fit the dimensions of * an element's border image. The middle region can be displayed by using * the keyword "fill" in the border-image-slice property. */ type CssBorderImageRepeat = "stretch" | "repeat" | "round" | "space"; type CssBorderInlineSizing = CssBorderStyle | CssSizing | `${CssSizing} ${CssBorderStyle}` | `${CssSizing} ${CssBorderStyle} ${string}`; type CssBorderProperties = { "border"?: string; /** * The border-spacing CSS property sets the distance between the borders of * adjacent cells in a
. * This property applies only when border-collapse is separate. */ "border-spacing"?: CssSizing | `${CssSizing} ${string}`; "border-radius"?: CssSizing | `${CssSizing} ${string}`; "border-collapse"?: CssBorderCollapse; /** * Formats: * - single * - two: `[top & bottom, left & right]` * - three: `[top, left & right, bottom]` * - four: `[top, left, right, bottom]` */ "border-style"?: CssBorderStyle | `${CssBorderStyle} ${CssBorderStyle}` | `${CssBorderStyle} ${CssBorderStyle} ${string}`; /** * Formats: * - single * - two: `[top & bottom, left & right]` * - three: `[top, left & right, bottom]` * - four: `[top, left, right, bottom]` */ "border-width"?: CssBorderWidth | `${CssBorderWidth} ${string}`; "border-image"?: CssBorderImageSource; /** * The `border-image-outset` CSS property sets the distance by which an * element's border image is set out from its border box. * * The parts of the border image that are rendered outside the element's * border box with `border-image-outset` do not trigger overflow scrollbars * and don't capture mouse events. */ "border-image-outset"?: CssSizing; /** * The border-image-repeat CSS property defines how the edge regions and * middle region of a source image are adjusted to fit the dimensions of * an element's border image. The middle region can be displayed by using * the keyword "fill" in the border-image-slice property. * * Format: * - use once for all edges * - use two -- `CssBorderImageRepeat` x 2 - for: `[ top & bottom, left & right ]` */ "border-image-repeat"?: CssBorderImageRepeat | `${CssBorderImageRepeat} ${CssBorderImageRepeat}`; /** * The `border-image-slice` CSS property divides the image specified by * `border-image-source` into regions. These regions form the components * of an element's border image. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-image-slice) */ "border-image-slice"?: `${number}` | `${number} fill`; "border-image-source"?: CssBorderImageSource | "none"; /** * The `border-end-end-radius` CSS property defines a logical border * radius on an element, which maps to a physical border radius * that depends on the element's writing-mode, direction, and * text-orientation. This is useful when building styles to work * regardless of the text orientation and writing mode. */ "border-end-end-radius"?: CssSizing; /** * The `border-end-start-radius` CSS property defines a logical border * radius on an element, which maps to a physical border radius depending * on the element's writing-mode, direction, and text-orientation. This is * useful when building styles to work regardless of the text orientation * and writing mode. */ "border-end-start-radius"?: CssSizing; /** * Formats: * - single * - two: `[top & bottom, left & right]` * - three: `[top, left & right, bottom]` * - four: `[top, left, right, bottom]` */ "border-color"?: CssColor | `${CssColor} ${string}`; /** * The border-block-color CSS property defines the color of the logical * block borders of an element, which maps to a physical border color * depending on the element's writing mode, directionality, and text * orientation */ "border-block-color"?: CssColor; /** * The border-block-end-color CSS property defines the color of the logical * block-end border of an element, which maps to a physical border color * depending on the element's writing mode, directionality, and text orientation. */ "border-block-end-color"?: CssColor; /** * The border-block-end-color CSS property defines the color of the logical * block-end border of an element, which maps to a physical border color * depending on the element's writing mode, directionality, and text * orientation. */ "border-block-start-color"?: CssColor; /** * The border-inline CSS property is a shorthand property for setting * the individual logical inline border property values in a single place * in the style sheet. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-inline) */ "border-inline"?: `${CssBorderWidth} ${string}` | `${CssColor} ${string}` | `${CssBorderStyle} ${string}`; "border-inline-style"?: CssBorderStyle; /** * The `border-inline-width` CSS property defines the width of the logical inline * borders of an element, which maps to a physical border width depending on the * element's writing mode, directionality, and text orientation. It corresponds to the * border-top-width and border-bottom-width, or border-left-width, and border-right-width * property depending on the values defined for writing-mode, direction, and text-orientation. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-inline-width) */ "border-inline-width"?: CssBorderWidth | `${CssBorderWidth} ${string}`; "border-inline-color"?: CssColor; "border-inline-start-style"?: CssBorderStyle; "border-inline-start-color"?: CssColor; "border-inline-start-width"?: CssBorderWidth; "border-inline-end-style"?: CssBorderStyle; "border-inline-end-color"?: CssColor; "border-inline-end-width"?: CssBorderWidth; "border-left"?: `${CssColor} ${string}` | `${CssBorderStyle} ${string}` | `${CssBorderWidth} ${string}`; "border-left-style"?: CssBorderStyle; "border-left-color"?: CssColor; "border-left-width"?: CssBorderWidth; "border-left-top-radius"?: CssSizing; "border-left-bottom-radius"?: CssSizing; "border-right"?: `${CssColor} ${string}` | `${CssBorderStyle} ${string}` | `${CssBorderWidth} ${string}`; "border-right-style"?: CssBorderStyle; "border-right-color"?: CssColor; "border-right-width"?: CssBorderWidth; "border-right-top-radius"?: CssSizing; "border-right-bottom-radius"?: CssSizing; "border-bottom"?: `${CssColor} ${string}` | `${CssBorderStyle} ${string}` | `${CssBorderWidth} ${string}`; "border-bottom-style"?: CssBorderStyle; "border-bottom-color"?: CssColor; "border-bottom-width"?: CssBorderWidth; "border-bottom-left-radius"?: CssSizing; "border-bottom-right-radius"?: CssSizing; "border-top"?: `${CssColor} ${string}` | `${CssBorderStyle} ${string}` | `${CssBorderWidth} ${string}`; "border-top-style"?: CssBorderStyle; "border-top-color"?: CssColor; "border-top-width"?: CssBorderWidth; "border-top-left-radius"?: CssSizing; "border-top-right-radius"?: CssSizing; /** * The `border-inline-end` CSS property is a shorthand property for setting the * individual logical inline-end border property values in a single place in * the style sheet. * * - [Refererence](https://developer.mozilla.org/en-US/docs/Web/CSS/border-inline-end) */ "border-inline-end"?: CssBorderInlineSizing; /** * The `border-inline-start` CSS property is a shorthand property for setting the * individual logical inline-start border property values in a single place in * the style sheet. * * - [Refererence](https://developer.mozilla.org/en-US/docs/Web/CSS/border-inline-start) */ "border-inline-start"?: CssBorderInlineSizing; } | { [key: `border-${string}`]: string; }; //#endregion //#region src/string-literals/character-sets/css/box.d.ts type CssBoxAlign = "start" | "center" | "end" | "baseline" | "stretch" | CssGlobal; /** * [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/box-decoration-break) */ type CssBoxDecorationBreak = "slice" | "clone" | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow) */ type CssBoxShadow = "none" | `inset ${string}${CssColorLight}` | `${CssSizingLight}${string}${CssColorLight}` | `${CssSizingLight}${string},${string}` | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing) */ type CssBoxSizing = "border-box" | "content-box" | CssGlobal; interface CssBoxProperties { "box-decoration-break"?: CssBoxDecorationBreak; "box-shadow"?: CssBoxShadow; "box-sizing"?: CssBoxSizing; } //#endregion //#region src/string-literals/character-sets/css/break.d.ts type CssBreak = "auto" | "avoid" | "always" | "all" | "avoid-page" | "page" | "left" | "right" | "recto" | "verso" | "avoid-column" | "region" | CssGlobal; type CssBreakInside = "auto" | "avoid" | "avoid-page" | "avoid-column" | "avoid-region" | CssGlobal; interface CssBreakProperties { /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/break-after) */ "break-after"?: CssBreak; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/break-before) */ "break-before"?: CssBreak; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/break-inside) */ "break-inside"?: CssBreakInside; } //#endregion //#region src/string-literals/character-sets/css/color.d.ts type CssNamedColor = typeof CSS_NAMED_COLORS[number]; /** * Type lookup table with _keys_ of CSS Named Colors and _values_ * being the string `RgbColor` definition. */ type CssNamedColorLookup = typeof CSS_COLOR_LOOKUP; type CssColorModel = "rgb" | "hsl" | "hsb" | "lab" | "oklch"; type CssColorSpace = "srgb" | "srgb-linear" | "display-p3" | "rec2020" | "a98-rgb" | "prophoto-rgb" | "xyz" | "xyz-d50" | "xyz-d65" | "hsl" | "hwb" | "lch" | "oklch"; type CssColorSpacePrimary = "srgb" | "display-p3" | "rec2020" | "hsl" | "hwb" | "lch" | "oklch"; /** * **CssRgb** * * CSS RGB colors (e.g., `rgb(123,86,255)`) */ type CssRgb = `rgb(${OptionalSpace}${number} ${number} ${number}${OptionalSpace})` | `rgb(${OptionalSpace}${number},${OptionalSpace}${number},${OptionalSpace}${number}${OptionalSpace})`; type CssRgba = `rgba(${number} ${number} ${number} ${number})` | `rgba(${number},${OptionalSpace}${number},${OptionalSpace}${number},${OptionalSpace}${number})`; /** * Hue, Saturation, and Lightness level (**HSL** color model) */ type CssHsl = `hsl(${number} ${number} ${number})` | `hsl(${number},${OptionalSpace}${number},${OptionalSpace}${number})`; /** * Hue, Saturation, and Brightness (**HSB** color model) */ type CssHsb = `hsb(${number} ${number} ${number})` | `hsb(${number},${OptionalSpace}${number},${OptionalSpace}${number})`; type OptionalPercent = "%" | ""; /** * [**CssOkLch**](https://oklch.com/)`(lightness, chroma, hue)` * * - Lightness is critical to **contrast** between _background_ and _foreground_ elements * - Saturation levels are seen in _chroma_ values. * - Hue distinguishes the actual color you're viewing */ type CssOkLch = `oklch(${number}${OptionalPercent} ${number}${OptionalPercent} ${number})`; /** * a hexadecimal color representation for CSS */ type CssHexColor = `#${HexadecimalChar}${HexadecimalChar}${string}`; type ColorFnValue = `${number}` | `${number}%` | "none"; type ColorFnOptOpacity = "" | ` / ${number}`; /** * **CssColor** * * Intended to represent _any_ CSS color value. */ type CssColor = CssNamedColor | CssHexColor | CssRgb | CssRgba | CssOkLch | CssHsb | CssHsl | "currentcolor" | `color(${string})`; type CssColorLight = CssNamedColor | `#${number}` | "currentcolor" | `${"rgb" | "rgba" | "hsb" | "hsl"}(${string})` | `color(${string})`; /** * The new CSS 4 `color(colorspace v1 v2 v3 [/ alpha])` function. * * **Related:** `CssColorSpace`, `ColorFnValue`, `ColorFnOptOpacity` */ type CssColorFn = `color(${TColorSpace} ${TV1} ${TV2} ${TV3})${TOp}` | `color(${CssColor} from ${TColorSpace} ${TV1} ${TV2} ${TV3})${TOp}`; type CssColorMix = `color-mix(in ${CssColorSpace}, ${CssColor}${string})`; type CssColorMixLight = `color-mix(in ${CssColorSpacePrimary}, ${string})`; /** * **ColorParam** * * A union of color options which might be presented as user input. It includes: * * - all CSS named colors * - any valid CSS hex color * - any Tailwind Color/Luminosity pairing * - a `color-mix(...)` color */ type ColorParam = CssNamedColor | CssHexColor | TwColorWithLuminosity | CssColorMixLight; //#endregion //#region src/string-literals/character-sets/css/definition.d.ts /** * **CssDefinition** * * Provides a means to define a CSS selector in a type strong manner. * * - each _key_ is a possible CSS property with a type definition provided to constrain it * - it is also indexed so that any property without a strong type definition can still be * added as a string value. */ type CssDefinition = { /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/appearance) */"appearance"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter) */ "backdrop-filter"?: Suggest; /** * The valid values for the * [**display**](https://developer.mozilla.org/en-US/docs/Web/CSS/display) * property in CSS. */ "display"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/position) */ "position"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio) */ "aspect-ratio"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/opacity) */ "opacity"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) */ "gap"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex) */ "flex"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow) */ "flex-grow"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-shrink) */ "flex-shrink"?: CssFlexShrink; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction) */ "flex-direction"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-flow) */ "flex-flow"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis) */ "flex-basis"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/float) */ "float"?: Suggest; /** * a union of valid values for the **CSS** [`list-style`](https://developer.mozilla.org/en-US/docs/Web/CSS/list-style) property. * * The list-style CSS shorthand property allows you to set all the list style properties * at once. */ "list-style"?: Suggest; /** * The block-size CSS property defines the horizontal or vertical size of an element's block, * depending on its writing mode. It corresponds to either the width or the height property, * depending on the value of writing-mode. * * If the writing mode is vertically oriented, the value of block-size relates to the width of * the element; otherwise, it relates to the height of the element. A related property is * inline-size, which defines the other dimension of the element. * /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/block-size) */ "block-size"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/border-size) */ "border-size"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/content) */ "content"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/color) */ "color"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor) */ "cursor"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/height) */ "height"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/width) */ "width"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/perspective) */ "perspective"?: Suggest; "perspective-origin"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) */ "mix-blend-mode"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing) */ "letter-spacing"?: Suggest; /** * The lighting-color CSS property defines the color of the light source for the * and SVG lighting filter primitives within an * SVG . If present, it overrides the element's lighting-color attribute. * * - [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/lighting-color) */ "lighting-color"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) */ "object-fit"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) */ "object-position"?: Suggest; "order"?: Suggest<`${number}` | CssGlobal>; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation) */ "image-orientation"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering) */ "image-rendering"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/image-resolution) */ "image-resolution"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/hanging-punction) */ "hanging-punctuation"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/min-height) */ "min-height"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width) */ "min-width"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/min-block-size) */ "min-block-size"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/min-inline-size) */ "min-inline-size"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/stop-color) */ "stop-color"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/stop-opacity) */ "stop-opacity"?: Suggest<`${number}` | `${number}%` | CssGlobal>; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size) */ "tab-size"?: Suggest<`${number}` | CssSizingLight | CssGlobal>; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout) */ "table-layout"?: Suggest<"auto" | "fixed" | CssGlobal>; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/translate) */ "translate"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/quotes) */ "quotes"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/r) */ "r"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events) */ "pointer-events"?: string; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/resize) */ "resize"?: Suggest<"both" | "horizontal" | "vertical" | "none" | CssGlobal>; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/rotate) */ "rotate"?: Suggest; "row-gap"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/rx) */ "rx"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/ry) */ "ry"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/x) */ "x"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/y) */ "y"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space) */ "white-space"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space-collapse) */ "white-space-collapse"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/widows) */ "widows"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/will-change) */ "will-change"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/word-break) */ "word-break"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/word-spacing) */ "word-spacing"?: Suggest<"normal" | CssSizing>; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode) */ "writing-mode"?: Suggest; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/z-index) */ "z-index"?: Suggest<`${number}` | "auto" | CssGlobal>; /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/zoom) */ "zoom"?: Suggest<`${number}` | `${number}%` | "normal" | "reset" | CssGlobal>; } & CssBorderProperties & CssBackgroundProperties & CssAbsolutionPositioningProperties & CssOffsetProperties & CssBreakProperties & CssBoxProperties & CssTextProperties & CssStrokeProperties & CssJustifyProperties & CssAlignProperties & CssPlaceProperties & CssAnimationProperties & CssMarginProperties & CssPaddingProperties & CssOutlineProperties & CssOverflowProperties & CssOffsetProperties & CssTransformProperties & CssFontProperties & { [key: string]: string; }; //#endregion //#region src/string-literals/character-sets/css/display-position.d.ts type Ratio = `${number}${OptionalSpace}/${OptionalSpace}${number}`; type One = `1`; type Special = "inherit" | "initial" | "revert" | "revert-layer" | "unset"; type Auto = "auto" | `auto ${Ratio}` | `${Ratio} auto`; /** * **CssAspectRatio** * * Allowed values for CSS's `aspect-ratio` property. */ type CssAspectRatio = Ratio | One | Special | Auto; /** * **CssPosition** * * The valid values for the `position` property in CSS. */ type CssPosition = "static" | "relative" | "absolute" | "fixed" | "sticky" | "inherit" | "initial" | "revert" | "revert-layer" | "unset"; /** * **CssDisplay** * * The valid values for the [**display**](https://developer.mozilla.org/en-US/docs/Web/CSS/display) * property in CSS. */ type CssDisplay = "block" | "flex" | "inline" | "inline-block" | "inline-flex" | "inline-grid" | "grid" | "flow-root" | "none" | "contents" | "block flex" | "block flow" | "block flow-root" | "block grid" | "inline flex" | "inline flow" | "inline flow-root" | "inline-grid" | "table" | "table-row" | "list-item" | CssGlobal; //#endregion //#region src/string-literals/character-sets/css/font.d.ts type CssFontFamily = `"${string}"` | "serif" | "san-serif" | "monospace" | "cursive" | "fantasy" | "system-ui" | "ui-serif" | "ui-sans-serif" | "ui-monospace" | "ui-rounded" | "emoji" | "math" | "fansong"; type CssFontFeatureSetting = "normal" | "liga" | "tnum" | "smcp"; type CssFontKerning = "auto" | "normal" | "none" | CssGlobal; type CssFontPalette = "normal" | "light" | "dark" | `--${string}` | `palette-mix(in ${ColorGamut},${string})`; type CssFontWidth = "normal" | "ultra-condensed" | "extra-condensed" | "condensed" | "semi-condensed" | "expanded" | "extra-expanded" | "ultra-expanded" | `${number}%` | CssGlobal; type CssFontStyle = "normal" | "italic" | "oblique" | `oblique ${CssRotation}` | CssGlobal; type CssFontSynthesis = "none" | "weight" | "style" | "position" | "small-caps"; type CssFontWeight = "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | "lighter" | "bolder" | CssGlobal; /** * The font-language-override CSS property controls the use of language-specific glyphs in a typeface. * * By default, HTML's lang attribute tells browsers to display glyphs designed specifically * for that language. For example, a lot of fonts have a special character for the digraph * fi that merge the dot on the "i" with the "f." However, if the language is set to Turkish * the typeface will likely know not to use the merged glyph; Turkish has two versions of * the "i," one with a dot (i) and one without (ı), and using the ligature would incorrectly * transform a dotted "i" into a dotless "i." * * The font-language-override property lets you override the typeface behavior for a specific * language. This is useful, for example, when the typeface you're using lacks proper support * for the language. For instance, if a typeface doesn't have proper rules for the Azeri * language, you can force the font to use Turkish glyphs, which follow similar rules. */ type CssFontLanguageOverride = string; interface CssFontProperties { "font-family"?: CssFontFamily | `${CssFontFamily}, ${CssFontFamily}${string}` | CssGlobal; "font-feature-settings"?: CssFontFeatureSetting | `${CssFontFeatureSetting} ${number | "on" | "off"}` | `${CssFontFeatureSetting} ${number | "on" | "off"},${string}`; "font-kerning"?: CssFontKerning; "font-language-override"?: CssFontLanguageOverride; "font-size"?: CssSizing | "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large" | "xx-large" | "xxx-large"; /** * The font-size-adjust CSS property provides a way to modify the size of lowercase * letters relative to the size of uppercase letters, which defines the overall * font-size. This property is useful for situations where font fallback can * occur. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size-adjust) */ "font-size-adjust"?: CssSizingLight | "none" | `${number}` | `from-font${Opt$1<` ${CssSizingLight}`>}` | `cap-height${Opt$1<` ${CssSizingLight}`>}` | `ex-height${Opt$1<` ${CssSizingLight}`>}` | `ch-width${Opt$1<` ${CssSizingLight}`>}` | `ic-width${Opt$1<` ${CssSizingLight}`>}` | `ic-height${Opt$1<` ${CssSizingLight}`>}`; /** * The font-palette CSS property allows specifying one of the many palettes contained in a * color font that a user agent may use for the font. Users can also override the values in * a palette or create a new palette by using the @font-palette-values at-rule. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-palette) */ "font-palette"?: CssFontPalette; /** * An alias for `font-width` */ "font-stretch"?: CssFontWidth; /** * The font-stretch CSS property selects a normal, condensed, or expanded face from a font. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-width) */ "font-width"?: CssFontWidth; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style) */ "font-style"?: CssFontStyle; /** * The `font-synthesis` shorthand CSS property lets you specify whether or not the browser * may synthesize the bold, italic, small-caps, and/or subscript and superscript typefaces * when they are missing in the specified font-family. * * - [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-synthesis) */ "font-synthesis"?: CssFontSynthesis | `${CssFontSynthesis} ${CssFontSynthesis}` | `${CssFontSynthesis} ${CssFontSynthesis} ${CssFontSynthesis}${string}` | CssGlobal; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight) */ "font-weight"?: CssFontWeight; } //#endregion //#region src/string-literals/character-sets/css/functions.d.ts type CssVar = `var(--${string})`; /** * A CSS variable declaration with a [fallback](https://developer.mozilla.org/en-US/docs/Web/CSS/var#syntax) * choice or choices. */ type CssVarWithFallback = `var(--${string}, ${CssVar | CssColor})`; /** * The CSS `translate()` function */ type CssTranslateFn = `translate(${CssSizing})` | `translate(0)` | `translate(${CssSizing}, ${CssSizing})`; /** * The CSS [`round()`](https://developer.mozilla.org/en-US/docs/Web/CSS/round) function */ type CssRound = `round(${CssVar}, ${CssSizing})` | `round(${"up" | "down" | "nearest" | "to-zero"}, ${CssVar | CssSizing}, ${string})`; /** * The CSS [clamp](https://developer.mozilla.org/en-US/docs/Web/CSS/clamp) function */ type CssClamp = `clamp(${CssSizing}, ${string}, ${string})`; /** * The CSS [calc()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc) function. * * ```css * calc(100% - 80px) * calc(100px * sin(pi / 2)) * calc(var(--hue) + 180) * lch(from aquamarine l c calc(h + 180)) * ``` */ type CssCalc = `calc(${CssSizing | CssVarWithFallback}${string})`; //#endregion //#region src/string-literals/character-sets/css/global.d.ts type CssGlobal = "inherit" | "initial" | "revert" | "unset" | "revert-layer"; //#endregion //#region src/string-literals/character-sets/css/html-element.d.ts type OldSchoolHtmlElement = "b" | "center" | "u" | "big" | "small" | "strong"; type EsotericHtmlElement = OldSchoolHtmlElement | "base" | "bdi" | "bdo" | "datalist" | "dd" | "del" | "dir" | "dl" | "dt" | "fencedframe" | "ins" | "kbd" | "nobr" | "noembed" | "rb" | "rt" | "rtc" | "ruby" | "s" | "samp" | "map" | "marquee" | "meter" | "noframes" | "object" | "param" | "portal" | "q" | "sub" | "sup" | "tt" | "track" | "var" | "wbr" | "xmp"; type HtmlTableElement = "col" | "colgroup" | "hgroup" | "table" | "tbody" | "td" | "tfoot" | "th" | "thead" | "time" | "tr"; type HtmlSymantecElement = "abbr" | "acronym" | "address" | "area" | "article" | "aside" | "blockquote" | "caption" | "cite" | "details" | "dfn" | "dialog" | "fieldset" | "figure" | "figcaption" | "header" | "footer" | "legend" | "nav" | "menu" | "search" | "summary" | "section"; type HtmlInputElement = "button" | "form" | "label" | "optgroup" | "option" | "select" | "input" | "textarea"; type HtmlFunctionalElement = "a" | "br" | "canvas" | "code" | "data" | "embed" | "em" | "font" | "hr" | "i" | "iframe" | "img" | "mark" | "strike" | "progress" | "p" | "picture" | "plaintext" | "pre"; type HtmlMediaElement = "audio" | "video"; type HtmlFrameworkElement = "template" | "slot"; type HtmlStructuralElement = "div" | `h${"1" | "2" | "3" | "4" | "5" | "6"}` | "frame" | "frameset" | "html" | "head" | "span"; type HtmlListElement = "li" | "ol" | "ul"; type HtmlHeaderElement = "meta" | "link" | "noscript" | "script" | "title" | "style" | "source"; type HtmlBodyElement = "body" | "main" | HtmlListElement | HtmlStructuralElement | HtmlSymantecElement | HtmlMediaElement | HtmlInputElement | HtmlFunctionalElement | HtmlFrameworkElement | HtmlTableElement; /** * Combines all _common_ HTML tags for both * the header and body of an HTML page. * * **Related:** * - `HtmlElement` _(all including esoteric)_ * - `HtmlHeaderElement` * - `HtmlBodyElement` */ type CommonHtmlElement = HtmlHeaderElement | HtmlBodyElement; /** * All HTML elements. * * **Related:** * - `CommonHtmlElement` _(just the most common elements)_ * - `HtmlHeaderElement`, `HeaderBodyElement` */ type HtmlElement = CommonHtmlElement | EsotericHtmlElement; //#endregion //#region src/string-literals/character-sets/css/justify.d.ts type CssJustifyContent = "center" | "start" | "end" | "flex-start" | "flex-end" | "left" | "right" | "normal" | "space-between" | "space-around" | "space-evenly" | "stretch" | "safe center" | "unsafe center" | CssGlobal; type Positions = "stretch" | "center" | "start" | "end" | "flex-start" | "flex-end" | "self-start" | "self-end" | "left" | "right" | "anchor-center" | "baseline" | "first baseline" | "last baseline" | "safe center" | "unsafe center" | "legacy left" | "legacy right" | "legacy center" | CssGlobal; type CssJustifyItems = Positions; type CssJustifySelf = Positions; interface CssJustifyProperties { /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */ "justify-content"?: CssJustifyContent; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) */ "justify-items"?: CssJustifyItems; /** [Reference](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self) */ "justify-self"?: CssJustifySelf; } //#endregion //#region src/string-literals/character-sets/css/keyframe.d.ts /** * The _timestamp_ of a [CSS keyframe animation](https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes) * (e.g., "from", "to", "50%") */ type CssKeyframeTimestamp = "from" | "to" | `${number}%` | `${number}%${string},${number}%`; type CssKeyframeTimestampSuggest = Suggest<"from" | "to" | "10%" | "20%" | "30%" | "40%" | "50%" | "60%" | "70%" | "80%" | "90%" | "100%" | "45%, 55%">; //#endregion //#region src/string-literals/character-sets/css/margin.d.ts type CssMargin = CssSizingLight | `${CssSizingLight}, ${CssSizingLight}${Opt$1<`, ${CssSizingLight}`>}${string}`; type CssMarginBlock = `${CssSizingLight}${Opt$1<`, ${CssSizingLight}`>}${string}`; type CssMarginBlockEnd = CssSizingLight; type CssMarginBlockStart = CssSizingLight; type CssMarginInline = `${CssSizingLight}${Opt$1<`, ${CssSizingLight}`>}${string}`; type CssMarginInlineEnd = CssSizingLight; type CssMarginInlineStart = CssSizingLight; type CssMarginLeft = CssSizingLight; type CssMarginRight = CssSizingLight; type CssMarginTop = CssSizingLight; type CssMarginBottom = CssSizingLight; interface CssMarginProperties { "margin"?: CssMargin; "margin-block"?: CssMarginBlock; "margin-block-end"?: CssMarginBlockEnd; "margin-block-start"?: CssMarginBlockStart; "margin-inline"?: CssMarginInline; "margin-inline-end"?: CssMarginInlineEnd; "margin-inline-start"?: CssMarginInlineStart; "margin-left"?: CssMarginLeft; "margin-right"?: CssMarginRight; "margin-top"?: CssMarginTop; "margin-bottom"?: CssMarginBottom; "margin-trim"?: string; } //#endregion //#region src/string-literals/character-sets/css/object.d.ts /** * **CssObjectFit** * * The [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property sets how the * content of a replaced element, such as an or
= TD extends TypeDefn ? Type$1 extends true ? "required" : IsFalse extends true ? "not-required" : "required", IsStringLiteral extends true ? Desc : "", IsArray extends true ? Exclude : "no-underlying", As, IsUnion]>, "no-default-value", "with-default-value">, TypeHasDefaultValue>, As, IsUnion]>, "no-validations", "with-validations">, TypeHasValidations>> : never; type TypeHasDefaultValue = "no-default-value" | "with-default-value"; type TypeHasValidations = "no-validations" | "with-validations"; type TypeHasUnderlying = "no-underlying" | "literals" | "children"; /** * A function which is provided a value `T` and must either return * `true` or an `ErrorCondition` which describes the issue. */ type ValidationFunction = (value: T) => true | Err; /** * A type definition which retains valuable runtime characteristics */ interface Type$1 { _type: "Type"; /** * **kind** * * The _type_ / _category_ of the type (e.g., string, stringLiteral, number, etc). */ kind: TKind; /** * **type** * * The fully expressed _type definition_. * * **Note:** do not use this for anything in the runtime environment */ type: ToType$1; /** * **isRequired** * * Whether or not this type is _required_ to exist or if it's type * should be a union with `undefined`; will default to `required` */ isRequired: TRequired extends "not-required" ? false : true; /** * Whether the given runtime type is a narrow literal type */ isLiteral: TKind extends TypeKindLiteral ? true : false; /** * This can be an array of _type literals_ or a container * type (e.g., object, union, intersection, tuple, etc.). * * In all cases, the _underlying_ types represent the type * definition using the _logical operand_ of the `underlying_operand` * property. */ underlying: TUnderlying; /** * **underlying_operand** * * In cases where a runtime type has _underlying_ types, this property * expresses how they should be merged together into a type. In most cases * this is an `OR` operand but not all. */ underlying_operand: TUnderlying extends "no-underlying" ? "NA" : TKind extends "intersection" ? "AND" : "OR"; /** * **defaultValue** * * A default value to set this variable to at runtime; * defaults to not being set but when it is said then * certain additional runtime operations are possible. */ defaultValue: TWithDefault extends "no-default-value" ? NoDefaultValue : Box>; /** * **isUnion** * * Whether or not the type represents a _union_ type. This can be true in * obvious cases like a `union` _type_ but **any** type which is not required * is also in effect a union type too. */ isUnion: boolean; /** * **is**`(input: unknown): input is T` * * a **type guard** function which helps users to ensures type safety * for the given type. */ is: TypeGuard>; /** * **validate**`(val) => boolean` * * Runs any runtime configurations which were provided to the runtime type. */ validate: >(val: V) => boolean; /** * **validations** * * An optional array of runtime validations which can be performed on the * runtime type. When the `validate()` function is called these functions * along with any _underlying_ types which have validators will be run to ensure * the validity at all levels of the type. */ validations: TWithValidations extends "no-validations" ? readonly [] : readonly ValidationFunction[]; identity: ToType$1 | NotApplicable<"some types do not have an identity value for concat/sum">; /** Description of the type */ description: TDesc; } //#endregion //#region src/runtime-types/type-defn/DefineObjectWith.d.ts type Convert$2, TMap extends TokenMapper, TKeys extends readonly string[] = StringKeys, TResult extends Record = EmptyObject> = TKeys extends [infer Head extends string & keyof TDefn, ...infer Rest extends readonly string[]] ? TDefn[Head] extends keyof TMap ? Convert$2> : Err<`invalid-key/define-object-with`, `The TokenMapper provided to DefineObjectWith was unable to map the token type '${Head}'`> : ExpandRecursively; /** * **DefineObjectWith**`` * * * **Related:** `DefineObject`, `TokenMapper` */ interface DefineObjectWith, TMap extends TokenMapper, TKeys extends readonly string[] = StringKeys> { /** a object created with the `DefineObjectWith` utility */ kind: "define-object-with"; /** the token based definition of the type */ defn: TDefn; /** the type which the tokens represent */ type: Convert$2; } //#endregion //#region src/runtime-types/type-defn/FromDefn.d.ts type ProcessUnion = T extends Tuple$1 ? TupleToUnion : T extends ShapeCallback ? HandleDoneFn> : never; type IterateUnion = { [K in keyof T]: ProcessUnion }; /** * **AsUnion** * * Receives a `UnionTokenSet`, a `ShapeCallback` or just a tuple of values * and makes this into _union type_. */ type AsUnionToken = T extends UnionElDefn[] ? TupleToUnion> : T extends UnionElDefn ? ProcessUnion : never; type IsDictionaryDefinition = T extends Dictionary ? Contains, readonly unknown[]>, ShapeCallback> : false; /** * converts non-tuple definition types to actual type */ type ToType = T extends ShapeCallback ? FromShapeCallback : T extends SimpleToken ? FromSimpleToken : T extends RecordKeyWideTokens ? FromSimpleRecordKey : T extends WideTokenNames | WideContainerNames ? FromWideTokens : T extends RecordKeyWideTokens ? FromSimpleRecordKey : TElse; /** * iterates over tuple definition types to convert into real types */ type IterateOverDefinitions = { [K in keyof T]: ToType }; type TypeDefinition = NarrowableScalar | ShapeCallback; /** * converts a `ShapeCallback` into the _type_ which it is defining */ type FromShapeCallback = TAsToken extends false ? ReturnType> : string; /** * converts a `SimpleToken` into the _type_ which it is defining */ type FromSimpleToken = SimpleType; /** * **FromDefn**`` * * Takes either a singular `T` or a tuple of values for `T` and * looks for any cases where a `ShapeCallback` is found: * * - where it is found, it will resolve the type * - if the type is a `SimpleToken` then this too is resolved * - in other cases it simply proxies the values through * - if `TElse` is set you can redirect values which don't use * the ShapeCallback API to a specific type. * * Note: when dictionary objects are found the _values_ will be * interrogated for ShapeCallback's. */ type FromDefn = T extends DefineObject ? FromDefineObject : T extends SimpleToken ? SimpleType : T extends readonly unknown[] ? IterateOverDefinitions : IsUnset extends true ? T : ToType; //#endregion //#region src/runtime-types/type-defn/input-tokens/AsInputToken.d.ts type AsUnion$1 = Join<{ [K in keyof T]: AsInputToken }, " | ">; /** * **AsInputToken**`` * * Converts any type `T` into the _string based_ `InputToken` representing that type. */ type AsInputToken = [IsAny] extends [true] ? "any" : [IsNever] extends [true] ? "never" : [T] extends [string] ? [string] extends [T] ? "string" : [IsUnion] extends [true] ? AsUnion$1> : `'${AsStaticTemplate}'` : [T] extends [number] ? [number] extends [T] ? "number" : [IsUnion] extends [true] ? AsUnion$1> : `${T}` : [T] extends [boolean] ? [IsTrue] extends [true] ? "true" : [IsFalse] extends [true] ? "false" : "boolean" : [IsNull] extends [true] ? "null" : [IsUndefined] extends [true] ? "undefined" : [T] extends [void] ? "void" : [IsEqual] extends [true] ? "unknown" : [IsLiteralLikeArray] extends [true] ? [IsVariadicArray>] extends [true] ? "variadic" : ToStringLiteral : [T] extends [(infer Type)[]] ? [IsUnion] extends [true] ? AsUnion$1> extends infer U extends string ? `(${U})[]` : never : AsInputToken extends string ? `${AsInputToken}[]` : never : "xxx"; //#endregion //#region src/runtime-types/type-defn/input-tokens/DefineObject.d.ts /** * **DefineObject** * * A dictionary which defines the _type_ of a dictionary. * * - values can be: * - a string based `InputToken` * - another `DefineObject` definition * - a tuple of * * **Example:** * ```ts * const myObject: DefineObject = { * foo: "string", * bar: "Opt", * baz: p => p.string().zipCode() * } * ``` * * - typically used `FromDefn` or `FromDefineObject` utilities */ interface DefineObject { [key: string]: InputToken; } /** * **DefineObjectApi** * * Provides a function which takes a `DefineObject` and converts it to the * type that it defines. * * **Example:** * ```ts * const api: DefineObjectApi = ...; * // { foo: string; bar: string | undefined; baz: ZipCode } * const myObject = api({ * foo: "string", * bar: "Opt", * baz: p => p.string().zipCode() * }); * ``` */ type DefineObjectApi = (defn: T) => FromDefn; //#endregion //#region src/runtime-types/type-defn/input-tokens/DefineTuple.d.ts /** * A tuple who's elements are all `InputToken`'s * * - this type is meant to be used with utilities like * `FromDefineTuple`, `FromInputToken`, etc. */ type DefineTuple = readonly InputToken[]; //#endregion //#region src/runtime-types/type-defn/input-tokens/FromDefineObject.d.ts /** * **FromDefineObject**`` * * Converts a `DefineObject` _definition_ into the **type** which it * it defines. * * **Note:** * - this is just an alias of `FromInputToken__Object` but with a * cooler name */ type FromDefineObject = FromInputToken__Object; //#endregion //#region src/runtime-types/type-defn/input-tokens/FromDefineTuple.d.ts type FromDefineTuple = { [K in keyof T]: T[K] extends string ? FromInputToken__String : T[K] extends DefineObject ? FromInputToken__Object : T[K] extends DefineTuple ? FromInputToken__Tuple : never }; //#endregion //#region src/runtime-types/type-defn/input-tokens/FromInputToken.d.ts /** * **FromInputToken**`` * * Converts an input token to a type, or produces an error with type * of `invalid-token` and a "subType" of whichever type structure caught * the error. * * InputToken's consist primarily as _string_ tokens of one of the following * variants: * * - an _atomic_ token (e.g., true, null, undefined, boolean, etc.) * - a _literal_ token (e.g., String(v), Number(v), Boolean(v), Record(k,v)) * - an _object_ token (e.g., `{ ... }`) * - a _tuple_ token (e.g., `[ ... ]`) * - a _function_ token (e.g., `fn(...) => token` _or_ `async fn() => token ) * - a _generator_ token (e.g., `gen(...) => token`) * * **Related:** `FromStringInputToken` */ type FromInputToken = T extends string ? FromInputToken__String : T extends readonly InputToken[] ? FromInputToken__Tuple : T extends DefineObject ? FromInputToken__Object : never; /** * **FromInputToken__String**`` * * A type utility responsible for _receiving_ string-based input tokens and * converting them into the _type_ which the token represents. * * **Related:** * - `FromInputToken` * - `FromInputToken__Tuple`, `FromInputToken__Object`, `FromInputToken__Tuple` * - `GetInputToken`, */ type FromInputToken__String = GetInputToken extends Error ? GetInputToken : GetInputToken extends infer Success extends IT_Token ? Success["type"] : never; /** * Takes a tuple of `InputTokens` to create a **Tuple** type. */ type FromInputToken__Tuple = { [K in keyof T]: T[K] extends InputTokenSuggestions ? FromInputToken__String : T[K] extends DefineObject ? FromDefineObject : T[K] extends DefineTuple ? FromDefineTuple : never }; type _FromInputToken__Object_Props = { [K in keyof T]: T[K] extends string ? FromInputToken__String : T[K] extends DefineObject ? FromDefineObject : T[K] extends DefineTuple ? FromDefineTuple : never }; type _HasErrorProp = { [K in keyof T]: T[K] extends Error ? K : never }[keyof T]; type _ExtractErrorFromProps = _HasErrorProp extends never ? T : _HasErrorProp extends infer PropKey extends keyof T ? T[PropKey] extends infer OrigErr extends Error ? OrigErr extends { type: infer EType extends string; subType?: infer ESubType; } ? ESubType extends string ? Err<`${EType}/${ESubType}`, `Property "${PropKey & string}" has a malformed token`, { property: PropKey; token: TOriginal; originalError: OrigErr; }> : Err : OrigErr : T[PropKey] : never; type _FromInputToken__Object = _ExtractErrorFromProps<_FromInputToken__Object_Props, T>; /** * Takes a tuple of `InputTokens` to create a **Tuple** type. */ type FromInputToken__Object = _FromInputToken__Object> extends infer Result ? Result extends Error ? Result : Result extends Dictionary ? Mutable> extends readonly ObjectKey[] ? UnionToTuple> : never>> : never : never; //#endregion //#region src/runtime-types/type-defn/input-tokens/GetInputToken.d.ts /** * Narrows the return type to: * * - `Err<"malformed-token">` if handler tried to parse but hit an error while parsing * - note: if the value is `never` it will also convert this to a `Err<"malformed-error">` * because while this is NOT expected it does represent an unexpected failure of the take function * - `IT_Token` if handler was successful at parsing the head of the string * - `null` if a `wrong-handler` error was found */ type Process$4 = IsNever extends true ? Err<"unexpected-error/never", `A take function returned 'never'; this should not happen!`> : T extends IT_TakeOutcome ? IsInputTokenSuccess extends true ? T extends infer Token extends IT_Token ? Token : IT_Token : T extends Error ? ErrType extends "malformed-token" ? T : null : null : Err<"unexpected-error", `A take function returned an unexpected type!`, { type: T; }>; type TryTake = TProcessed extends infer R ? R extends Error ? R : R extends infer Success extends IT_Token ? Iterate : TFallback : never; /** * **Iterate**`` * * Iterates over all of the known _take_ functions for InputToken's * and parses to as much as possible. * * - if `TToken` is able to be reduced to "" then the job is considered * to be complete and the results will be passed to `Finalize` * - if `TToken` still has content in it after all take functions have * had a chance to reduce it, then one of two errors will result: * * - `incomplete-parse` is returned when at least _some_ of the original * token string has been parsed * - the `parsedType` property will provide the _type_ up to the point * of reaching this incomplete state * - the `rest` property exposes what is left _unparsed_ * * - `unparsed` is returned when no parsing was possible */ type Iterate> = TRemaining extends "" ? TToken extends IT_Token ? TToken : Err<"empty-parse", `The token string was an empty string so there is nothing to parse!`> : TryTake>, "atomic", TryTake>, "literal", TryTake>, "literal", TryTake>, "kv", TryTake>, "array", TryTake>, "promise", TryTake>, "set", TryTake>, "generator", TryTake>, "function", TryTake>, "literal-array", TryTake>, "object-literal", TryTake>, "group", TryTake>, "union", TryTake>, "intersection", TToken extends IT_Token ? Err<"incomplete-parse", `The token string was not fully parsed; the text '${TRemaining}' remains unparsed`, { underlying: readonly [TToken]; parsedType: As["type"]; rest: TRemaining; combinator: "none"; }> : Err<"unparsed", `The token string -- ${TRemaining} -- was unable to be parsed!`>>>>>>>>>>>>>>>; /** * **GetInputToken**`` * * Passing in a valid string `InputToken`, this utility will provide * you back an `IT_Token` which provides meta data about the token * including the _type_ which this token represents. * * - if all you want back is the _type_ then you're better off using * the `FromInputToken` or `FromInputToken__String` utilities. * * Possible error variants from this utility include: * * 1. `unparsed` - unable to parse the token string at all! * 2. `incomplete-parse` - part of the token _was_ parsed but there * is remaining text which can not be parsed. * 3. `invalid-union` - when the parser has detected the _combinator_ * to be a union type, then the number of underlying types must be at * least two * 4. `invalid-intersection` - when the parser has detected the _combinator_ * to be an intersection type, then the number of underlying types must * be at least two * * However, the most common Error type is `malformed-token` which will * be returned anytime the parsing process is mid-stream in parsing a * known type and some portion of that token is invalid. These errors * should have lots of contextual properties to help the caller understand * where the error is occurring. */ type GetInputToken = string extends T ? IT_Token | Error : Iterate; //#endregion //#region src/runtime-types/type-defn/input-tokens/InputToken.d.ts /** * **InputToken** * * The set of valid inputs which can be converted from a "token" to an inferred _type_ * at runtime with utilities like `GetInputToken`, `FromInputToken`, etc. * * **Note:** * - the possible set of variants of input tokens is _unbounded_ so this type will * allow in some _false positives_ but you can explicitly check whether a given value is * an `InputToken` with the `IsInputToken` boolean operator. * * - the `InputTokenSuggestions` type represents a suggested set of _string_ tokens that * are known to be valid and are helpful to developers by giving some guidance on valid * shape patterns without limiting the choice of strings not on the suggested list. * * - beyond the "pure" string based input tokens, however, this type allows -- _for convenience_ * -- using dictionary or tuple structures to define a type too: * * ```ts * { foo: "number"; bar: "string" } // Dictionary example * [ "string", "string", "boolean" ] // Tuple example * ``` * * - the dictionary based variant of an `InputToken` is the defined by the type `DefineObject` * - the tuple based variant of an `InputToken` is the defined by the type `DefineTuple` * - both of these types have corresponding _runtime_ builders: `defineObject()`, `defineTuple()` * * ### Related Utilities * * - `FromToken` / `FromInputToken` / `FromInputToken__String` * * - converts a "token" to the _tokens_ **type** it represents * - if `T` is not a valid type then an Error of the type `invalid-token` will * be returned * * - `AsType` * * - same as the `From...` utilities except that if `T` isn't a token then * it will _proxy_ through **T**'s existing type "as is" * * - `AsString` / `ToStringInputToken` * - `AsString` is a general purpose utility for ensuring that types passed in are * converted to an "appropriate" string type * - for _string-based_ input tokens this utility will simply proxy the type through * "as is" * - for dictionary or tuples which are valid input tokens, it will convert this to the * string-based equivalent `InputToken` * - any dictionaries or tuples which are not valid input tokens, their types will be taken * at face value and converted to a string representation: * * ```ts * // "{ foo: number; bar: string }" * type Token = AsString<{ foo: "number", bar: "string" }>; * // "{ foo: number; bar: string }" * type NotToken = AsString<{ foo: number, bar: string }>; * ``` * - `ToStringInputToken` is a targeted utility for ensuring that `T`, if a valid input token, * is a _string_ representation of an input token. * * - `IT_Token` * - typically used in the token parsing process * - this type represents a token's meta characteristics including: * - the string `token` * - the `type` the token represents * - any remaining text still left to be parsed after this token (`rest`) * - depending the type, there may be other characteristics too * * - `GetInputToken` * - this is the core _lookup_ utility which other utilities use to convert a "token" to * meta information (aka, a derivative of `IT_Token`) * - this utility, unlike most others, only takes _string-based_ input tokens * - if you need to convert a dictionary or tuple based token to string you can do so * with the `AsStringInputToken` utility */ type InputToken = InputTokenSuggestions | Record> | readonly (InputTokenSuggestions | Record | readonly InputTokenSuggestions[])[]; //#endregion //#region src/runtime-types/type-defn/input-tokens/InputTokenSuggestions.d.ts type BaseSuggest = `${IT_AtomicToken}` | `string | undefined` | `number | undefined` | `boolean | undefined` | `string | number` | `string | boolean` | `string | undefined` | `string | number | undefined`; type LiteralSuggest = `String(foo)` | `String(bar)` | `Number(1)` | `Number(42)` | `Boolean(true)` | `Boolean(false)` | `"foo" | "bar"`; /** * A set of fairly simple `InputTokens` which can be used as a type * or a suggested type. */ type InputToken__SimpleTokens = BaseSuggest | `Array` | `Array` | `Array` | `Array` | `Array` | `Array` | `Array` | `Array` | `Array boolean>` | `string[]` | `string[][]` | `number[]` | `boolean[]` | `(string | number)[]`; /** * The actual variants for a string based input token are _unbounded_ but * in order to help people understand acceptable syntax and patterns this * list of suggestions will provide autocomplete for */ type InputTokenSuggestions = Suggest` | `Map<${BaseSuggest}, ${BaseSuggest}>` | `WeakMap` | `Set<${BaseSuggest}>` | `Record` | `Record`>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IsInputToken.d.ts /** * **IsInputToken**`` * * Tests whether `T` is a valid `InputToken` (string or otherwise) */ type IsInputToken = T extends InputToken ? T extends string ? GetInputToken extends Error ? false : true : T extends readonly string[] ? Every<{ [K in keyof T]: IsInputToken }, "true", []> : T extends Dictionary ? IsWideObject extends true ? boolean : Values extends infer ObjValues extends readonly string[] ? Every<{ [K in keyof ObjValues]: IsInputToken }, "true", []> : false : false : false; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_Base.d.ts type IT_TakeKind = "atomic" | "array" | "literal" | "kv" | "set" | "group" | "union" | "intersection" | "function" | "generator" | "promise" | "literal-array" | "object-literal"; type IT_Combinators = "union" | "intersection" | "none"; type IT_KvType = "Record" | "Map" | "WeakMap"; interface IT_Generics { generics: GenericParam[]; rest: string; } interface IT_Parameter { /** the _name_ of the parameter */ name: string; /** * a _string-based_ token for the parameter's **type** which is * either: * - an `InputToken` * - a `GenericParam` */ token: string; /** * **fromGeneric** * * returns `false` if the _type_ of this variable is NOT derived from a generic, * returns a string value mapping to the `name` of the generic involved. */ fromGeneric: false | string; /** * the _type_ this parameter **extends** (if derived from a generic) or * the _type_ it **is** otherwise. */ type: unknown; } interface IT_ParameterResults { parameters: readonly IT_Parameter[]; generics: readonly GenericParam[]; rest: string; } interface IT_Token_Base { __kind: "IT_Token"; /** * The category/kind of token this is (atomic, kv, literal, etc.). * * - Depending on the _kind_ additional properties may be exposed */ kind: T; /** * the string token _representing_ the type */ token: string; /** * the _type_ which the **token** represents */ type: any; /** * the _remaining_ text string to be parsed */ rest: string; } interface IT_Token_Atomic extends IT_Token_Base<"atomic"> {} interface IT_Token_Promise extends IT_Token_Base<"promise"> {} interface IT_Token_Set extends IT_Token_Base<"set"> {} interface IT_Token_Group extends IT_Token_Base<"group"> { underlying: IT_Token; } interface IT_Token_Literal extends IT_Token_Base<"literal"> {} interface IT_Token_Array extends IT_Token_Base<"array"> {} interface IT_Token_Literal_Array extends IT_Token_Base<"literal-array"> {} interface IT_Token_Object_Literal extends IT_Token_Base<"object-literal"> { /** * A tuple of `KeyValue` elements which define the object literal. */ keyValues: readonly KeyValue[]; } interface IT_Token_Union extends IT_Token_Base<"union"> { /** all members of the union type */ members: readonly unknown[]; } interface IT_Token_Intersection extends IT_Token_Base<"intersection"> { /** all members of the intersection type */ members: readonly unknown[]; } interface IT_Token_Kv extends IT_Token_Base<"kv"> { /** the KV container type */ container: IT_KvType; /** the token for a KV container's "key" */ keyToken: unknown; /** the token for a KV container's "value" */ valueToken: unknown; } interface IT_Token_Function extends IT_Token_Base<"function"> { /** the name of the function; `null` if anonymous */ name: string | null; /** the generics used for the parameters of the function */ generics: readonly GenericParam[]; /** a tuple representing the parameters in the function */ parameters: readonly IT_Parameter[]; /** * whether the function is shaped as a _narrowing_ function * with generics (`true`) or a _static_ function (`false`). */ narrowing: boolean; /** the tokenized representation of the return */ returnToken: string; /** * the _return type_ of the function */ returnType: unknown; /** * whether or not the function is asynchronous */ isAsync: boolean; } interface IT_Token_Generator extends IT_Token_Base<"generator"> { /** the name of the generator; `null` if anonymous */ name: string | null; /** the generics used for the parameters of the generator */ generics: readonly GenericParam[]; /** a tuple representing the parameters in the generator function */ parameters: readonly IT_Parameter[]; /** * whether the generator is shaped as a _narrowing_ function * with generics (`true`) or a _static_ generator (`false`). */ narrowing: boolean; /** the tokenized representation of the return */ returnToken: string; /** * the return type of the generator function (i.e., the Generator/AsyncGenerator type) */ returnType: unknown; /** whether or not the generator is asynchronous */ isAsync: boolean; } /** * **IT_Token**`` * * When a take utility for input tokens attempts to parse the token string * it can result in one of two conditions: * * 1. utility can not _take_ from the head of the token string and returns * an Error * 2. utility returns a `IT_Token` dictionary * * The generic `T` represents the _kind_ of token that was parsed and depending * on what it's set to, certain properties particular to that _kind_ will be * exposed. */ type IT_Token = IsUnion extends true ? IT_Token_Base : T extends "atomic" ? IT_Token_Atomic : T extends "literal" ? IT_Token_Literal : T extends "set" ? IT_Token_Set : T extends "kv" ? IT_Token_Kv : T extends "group" ? IT_Token_Group : T extends "literal-array" ? IT_Token_Literal_Array : T extends "object-literal" ? IT_Token_Object_Literal : T extends "array" ? IT_Token_Array : T extends "union" ? IT_Token_Union : T extends "function" ? IT_Token_Function : T extends "generator" ? IT_Token_Generator : T extends "promise" ? IT_Token_Promise : T extends "intersection" ? IT_Token_Intersection : never; /** * a validation utility to make sure `T` is of the type `IT_TakeSuccess` */ type IsInputTokenSuccess = IsDictionary extends true ? "kind" extends keyof T ? T["kind"] extends IT_TakeKind ? "rest" extends keyof T ? T["rest"] extends string ? true : false : false : false : false : false; /** * the error _types_ associated with trying to parse input tokens */ type IT_Failure = "invalid-token" | "malformed-token" | "wrong-handler" | "unparsed"; /** * a string literal (aka, `foo`, `bar`, etc.) */ type IT_StringLiteralToken = `String(${string})` | `"${string}"` | `'${string}'` | `\`${string}\``; /** * a numeric literal (aka, `1`, `42`, `99`, etc.) */ type IT_NumericLiteralToken = `Number(${number})` | `${number}`; /** * a literal value of `true` or `false` */ type IT_BooleanLiteralToken = `Boolean(${"true" | "false"})` | "true" | "false"; type IT_TakeOutcome = IT_Token | (Error & { type: IT_Failure; }); //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeArray.d.ts /** * matches on tokens like `string[]`, `number[]`, etc. */ type IT_TakeArray_Postfix = T extends `${infer Block extends string}[][]${infer Rest extends string}` ? ErrType> extends "malformed-token" ? Err<`malformed-token/array`, `the token has the shape of a two-dimensional array of '${Block}' but the type of array could not be parsed into a type!`, { token: T; block: Block; rest: Rest; }> : GetInputToken extends infer Token extends IT_Token ? { __kind: "IT_Token"; kind: "array"; token: `${Token["token"]}[][]`; type: (Token["type"])[][]; rest: Rest; } : never : T extends `${infer Block extends string}[]${infer Rest extends string}` ? ErrType> extends "malformed-token" ? Err<`malformed-token/array`, `the token has the shape of an array of type '${Block}' but the type of array could not be parsed into a type!`, { token: T; block: Block; rest: Rest; }> : GetInputToken extends infer Token extends IT_Token ? { __kind: "IT_Token"; kind: "array"; token: `${Token["token"]}[]`; type: (Token["type"])[]; rest: Rest; } : Err<"wrong-handler/array"> : Err<"wrong-handler/array">; /** * matches on tokens like `(string)[]`, `(string | number)[]`, etc. */ type IT_TakeArray_Postfix_Grouped = T extends `(${infer Rest}` ? NestedSplit"; "(": ")"; "=": ">"; }> extends [infer Block extends string, ...infer Rest extends [string, ...string[]]] ? GetInputToken> extends infer Token extends IT_Token ? { __kind: "IT_Token"; kind: "array"; token: `(${Token["token"]})[][]`; type: (Token["type"])[][]; rest: Trim>; } : Err<"malformed-token/array", `The token '${T}' appeared to be a grouped two-dimensional array but the interior block '${Block}' could not be parsed as a valid type!`, { token: T; block: Block; rest: Rest; }> : NestedSplit"; "(": ")"; "=": ">"; }> extends [infer Block extends string, ...infer Rest extends readonly [string, ...string[]]] ? GetInputToken extends infer Token extends IT_Token ? { __kind: "IT_Token"; kind: "array"; token: `(${Token["token"]})[]`; type: (Token["type"])[]; rest: Trim>; } : Err<"malformed-token/array", `The token '${T}' appeared to be a grouped array but the interior block '${Block}' could not be parsed as a valid type!`, { token: T; block: Block; rest: Rest; }> : Err<"wrong-handler/array", `The grouped function matcher could not parse the string token.`, { token: T; rest: Rest; }> : Err<"wrong-handler/array">; /** * matches on tokens like `Array`, etc. */ type IT_TakeArray_Bracket = T extends `Array<${infer Rest extends string}` ? NestedSplit", { "{": "}"; "[": "]"; "<": ">"; "(": ")"; "=": ">"; }> extends [infer Block extends string, ...infer Rest extends readonly string[]] ? Rest extends [] ? Err<"malformed-token/array", `The Array< signature indicates a bracketed array syntax but no terminating '>' character was found!`, { token: T; block: Block; rest: Rest; }> : GetInputToken extends infer Token extends IT_Token ? { __kind: "IT_Token"; kind: "array"; token: `Array<${Token["token"]}>`; type: Array; rest: Trim">>; } : Err<"malformed-token/array", `The token '${T}' appeared to be a bracketed array (e.g., Array<...>) but the interior block '${Block}' could not be parsed as a valid type!`, { token: T; block: Block; rest: Rest; }> : Err<"malformed-token/array", `The token '${T}' appears to be a bracketed array type (e.g., Array<...>) but the terminal '>' character was not found!`, { token: T; rest: T; }> : Err<"wrong-handler/array", `The string token does not start with 'Array<' so the bracketed array take function is not the right handler for this token`, { token: T; }>; type Select$3 = T extends [infer Head, ...infer Rest extends readonly unknown[]] ? Head extends infer Success extends IT_Token<"array"> ? Success : Head extends infer Fail extends Err<"malformed-token"> ? Fail : Select$3 : Err<"wrong-handler", `The IT_TakeArray handler is unable to parse the head of: '${TToken}'`, { token: TToken; }>; /** * **IT_TakeArray**`` * * Tries to take wide array signatures off the head of the string token. * * - **PostFix**: `string[]`, `string[][]`, `number[]`, etc. * - **PostFix Grouped**: `(string | number)[]`, `(number | boolean)[][]` * - **Bracketed**: `Array`, `Array` */ type IT_TakeArray = Select$3<[IT_TakeArray_Postfix_Grouped, IT_TakeArray_Postfix, IT_TakeArray_Bracket], T>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeArrayLiteral.d.ts type GetElementTypes = { [K in keyof T]: T[K] extends `${infer ReqToken}?` ? FromInputToken__String : FromInputToken__String }; /** * attempts to take any array with at least one fixed type */ type IT_TakeLiteralArray = T extends `[${infer Rest extends string}` ? NestedSplit extends [infer Block extends string, ...infer Rest extends string[]] ? NestedSplit extends infer Elements extends readonly string[] ? TrimEach extends infer Elements extends readonly string[] ? Elements["length"] extends 0 ? { __kind: "IT_Token"; kind: "array-literal"; elements: []; token: "[]"; type: []; rest: Trim>; } : { __kind: "IT_Token"; kind: "literal-array"; token: `[ ${Join} ]`; type: GetElementTypes; rest: Trim>; } : never : Err<`malformed-token`> : Err<"wrong-handler/array-literal"> : Err<"wrong-handler/array-literal">; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeAtomic.d.ts /** * token to type mapping for atomics */ interface AtomicMap { string: string; number: number; bigint: bigint; boolean: boolean; true: true; false: false; null: null; undefined: undefined; void: void; unknown: unknown; any: any; object: object; Object: object; } /** * **IT_AtomicToken** * * The input tokens categorized as "atomic" based on their only having one state with * no variants. */ type IT_AtomicToken = StringKeys[number]; /** * **IT_TakeAtomic**`` * * Tries to locate atomic tokens at the _head_ of the token string * and extract them. */ type IT_TakeAtomic> = As<[RetainUntil, RetainAfter] extends [infer Atom extends string, infer Rest extends string] ? Atom extends keyof AtomicMap ? As<{ __kind: "IT_Token"; kind: "atomic"; token: Trim; type: AtomicMap[Atom]; rest: Trim; }, IT_Token<"atomic">> : Err<`wrong-handler/atomic`, `The candidate token '${Atom}' is not an atomic token.`> : Err<`wrong-handler/atomic`>, IT_TakeOutcome<"atomic">>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeFunction.d.ts /** * **GetReturnType**`` * * Determines the return type for a given function by matching the `TToken` on (in order): * * 1. Generic Name * 2. String Literal with reference to `TToken` * 3. parse as a normal InputToken */ type StripSurroundingQuotes$1 = T extends `"${infer R}"` ? R : T extends `'${infer R}'` ? R : T extends `\`${infer R}\`` ? R : T; type GetReturnType = Trim extends `Promise<${infer Inner extends string}>` ? Promise, TGenerics>> : Find$1]> extends infer Generic extends GenericParam ? Generic["type"] : IsStaticTemplate, TemplateMap__Generics> extends true ? AsLiteralTemplate, TemplateMap__Generics>, TemplateMap__Generics> : Contains, "\${"> extends true ? AsLiteralTemplate, TemplateMap__Generics>, TemplateMap__Generics> : FromInputToken__String; type NamedSyncFunction = Trim extends `function ${infer AfterFunction extends string}` ? Trim extends `${infer Leading extends string}(${infer AfterParen extends string}` ? Leading extends `${infer Name extends string}<${infer GenericsBlock extends string}` ? Trim extends "" ? Err<"wrong-handler", `The function did not appear to have a name and therefore is not a named function.`, { token: T; }> : IT_TakeParameters<`<${GenericsBlock}(${AfterParen}`> extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnToken extends string}` ? FnFrom, GetReturnType, Generics>, { name: Trim; }> extends infer FnType extends TypedFunction ? { __kind: "IT_Token"; kind: "function"; name: Trim; generics: Generics; parameters: Parameters; narrowing: true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: GetReturnType, Generics>; token: Trim; type: FnType; isAsync: Extends, Generics>, Promise>; rest: ""; } : never : Err<"malformed-token", `After successfully parsing the parameters of a named function, the return type was unable to be parsed because we couldn't find the expected ':' character used to separate the parameters from the return type`, { token: T; rest: Trim; parameter: Parameters; generics: Generics; }> : Err<"malformed-token", `Failed to parse the parameters of what appeared to be a named function!`, { token: T; rest: `<${GenericsBlock}(${AfterParen}`; attempt: IT_TakeParameters<`<${GenericsBlock}(${AfterParen}`>; }> : Trim extends infer Name extends string ? Trim extends "" ? Err<"wrong-handler", `The function did not appear to have a name and therefore is not a named function.`, { token: T; }> : IT_TakeParameters<`(${AfterParen}`> extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnTok}` ? AsStaticTemplate, TemplateMap__Generics> extends infer ReturnToken extends string ? FnFrom, GetReturnType, Generics>, EmptyObject> extends infer FnType extends TypedFunction ? { __kind: "IT_Token"; kind: "function"; name: Trim; generics: Generics; parameters: Parameters; returnToken: ReturnToken; returnType: GetReturnType, Generics>; narrowing: false; token: Trim; type: FnType & { name: Trim; }; isAsync: Extends>, Promise>; rest: ""; } : never : never : Err<"malformed-token", `After successfully parsing the parameters of a named function, the return type was unable to be parsed because we couldn't find the expected ':' character used to separate the parameters from the return type`, { token: T; rest: Trim; parameter: Parameters; generics: Generics; }> : Err<"malformed-token", `Failed to parse the parameters of what appeared to be a named function!`, { token: T; rest: `(${AfterParen}`; attempt: IT_TakeParameters<`(${AfterParen}`>; }> : never : Err<"wrong-handler"> : Err<"wrong-handler">; type NamedAsyncFunction = T extends `async ${infer Rest}` ? NamedSyncFunction> extends Err<"malformed-token"> ? NamedSyncFunction> : NamedSyncFunction> extends infer Token extends IT_Token<"function"> ? IsTrue extends true ? Token : Err<"malformed-token"> : Err<"wrong-handler"> : Err<`wrong-handler`, `The NamedAsyncFunction can not parse the token '${T}'`>; type AnonSyncFunction = Trim extends `function ${infer Rest}` ? IT_TakeParameters> extends infer P extends IT_ParameterResults ? P extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer Rest extends string; } ? Rest extends `:${infer ReturnToken extends string}` ? GetReturnType, Generics> extends Error ? Err<`malformed-token`, `The arrow function -- '${Trim}' -- has a return type '${Trim}' which could not be parsed to a type!`, { generics: Generics; parameters: Parameters; returnToken: AsStaticTemplate, TemplateMap__Generics>; }> : FnFrom, GetReturnType, Generics>, EmptyObject> extends infer FnType extends TypedFunction ? { __kind: "IT_Token"; kind: "function"; name: null; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: GetReturnType, Generics>; token: Trim; type: FnType; isAsync: Extends, Generics>, Promise>; rest: ""; } : never : Err<"malformed-token", `Expected return type after ':' in an anonymous function`> : never : Err<"wrong-handler", `Unable to parse parameters for async anonymous function: '${T}'`> : Err<"wrong-handler", `Not a valid async anonymous function: '${T}'`>; type AnonAsyncFunction = T extends `async ${infer Rest extends string}` ? AnonSyncFunction> extends Error ? AnonSyncFunction> : AnonSyncFunction> extends infer Token extends IT_Token<"function"> ? IsTrue extends true ? Token : Err<"malformed-token", `An asynchronous function MUST return a Promise!`, { token: Trim; returnType: Token["returnType"]; }> : never : Err<"wrong-handler">; type CalcParams = { [K in keyof T]: T[K]["type"] }; type ArrowSyncFunction = IT_TakeParameters extends infer P extends IT_ParameterResults ? P extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer Rest extends string; } ? Trim extends `=>${infer ReturnToken extends string}` ? GetReturnType, Generics> extends Error ? Err<`malformed-token`, `The arrow function -- '${Trim}' -- has a return type '${Trim}' which could not be parsed to a type!`, { generics: Generics; parameters: Parameters; returnToken: AsStaticTemplate, TemplateMap__Generics>; }> : FnFrom, GetReturnType, Generics>, EmptyObject> extends infer FnType extends TypedFunction ? { __kind: "IT_Token"; kind: "function"; name: null; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; isAsync: GetReturnType, Generics> extends Promise ? true : false; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: GetReturnType, Generics>; token: T; type: FnType; rest: ""; } : never : Err<"malformed-token", `An arrow function requires the '=>' operator but it was not found, got: '${Rest}'`> : never : Err<"wrong-handler", `The token passed in can not be parsed as a synchronous Arrow function: '${Trim}'`>; type ArrowAsyncFunction = T extends `async ${infer Rest extends string}` ? ArrowSyncFunction> extends Error ? ArrowSyncFunction> : ArrowSyncFunction> extends infer Token extends IT_Token<"function"> ? IsTrue extends true ? Omit & Record<"token", Trim> : Err<`malformed-token`, `An async function must always return a promise!`, { token: T; }> : never : Err<"wrong-handler", `The token passed in can not be parsed as an asynchronous Arrow function: '${Trim}'`>; type OptGenerics = `<${string}>` | ""; /** * iterates over the various function signatures and returns when: * * 1. a variant returns an Error of the type "malformed-token" * 2. a variant returns a successful outcome which _extends_ `IT_Token<"fn">` */ type Select$2 = T extends [infer Head, ...infer Rest extends readonly unknown[]] ? Head extends Err<"malformed-token"> ? Head : Head extends Error ? Select$2 : Head : Err<"wrong-handler", `None of the variants for functions was able to parse the token: '${TToken}'`, { token: TToken; utility: "IT_TakeFunction"; variants: TVariants; }>; type InvalidNamedFunction = Err<`malformed-token/named-function`, `The token started with the text '${A}function' and thereby clearly indicated a function definition but the remaining text -- ${T} -- was not parsable! Remember that when using the 'function' keyword the return type is delimited by a ':' character and NOT an arrow. You CAN use an arrow function but that should NOT include the 'function' keyword.`, { token: `${A}function ${T}`; }>; /** * **IT_TakeFunction**`` * * Attempts to find a function (note: not a _generator_ function) at the head of a token string. * Will find the following variants: * * - **named** _synchronous_ and _asynchronous_ functions * - **anonymous** _synchronous_ and _asynchronous_ functions * - **arrow** _synchronous_ and _asynchronous_ functions * * **Note:** _all variants also account for the possible use of **generics**_ * * For **Generator** functions use `IT_TakeGeneratorFunction`. */ type IT_TakeFunction = Select$2<[T extends `function ${string}(${string}):${string}` ? NamedSyncFunction : Error, T extends `async function ${string}(${string}):${string}` ? NamedAsyncFunction : Error, T extends `function ${OptGenerics}(${string}):${string}` ? AnonSyncFunction : Error, T extends `async function ${OptGenerics}(${string}):${string}` ? AnonAsyncFunction : Error, T extends `${OptGenerics}(${string}) => ${string}` ? ArrowSyncFunction : Error, T extends `async ${OptGenerics}(${string}) => ${string}` ? ArrowAsyncFunction : Error, T extends `function ${infer Rest extends string}` ? InvalidNamedFunction : Error, T extends `async function ${infer Rest extends string}` ? InvalidNamedFunction : Error], T>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeGenerator.d.ts type StripSurroundingQuotes = T extends `"${infer R}"` ? R : T extends `'${infer R}'` ? R : T extends `\`${infer R}\`` ? R : T; /** * Resolve a return token to its type with support for generics and * static template interpolation. */ type ResolveToken = Find$1]> extends infer Generic extends GenericParam ? Generic["type"] : IsStaticTemplate, TemplateMap__Generics> extends true ? AsLiteralTemplate, TemplateMap__Generics>, TemplateMap__Generics> : Contains, "\${"> extends true ? AsLiteralTemplate, TemplateMap__Generics>, TemplateMap__Generics> : FromInputToken__String; type ResolveGeneratorReturn = Trim extends `Generator<${infer Rest extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? TrimEach, readonly string[]>> extends infer Params extends readonly string[] ? Params["length"] extends 1 ? Generator, any, unknown> : Params["length"] extends 2 ? Generator, ResolveToken, unknown> : Generator, ResolveToken, ResolveToken> : Err<"malformed-token", `Failed to parse the payload Generator interior: '${Block}'.`, { token: TToken; block: Block; }> : Err<"malformed-token", `The Generator<...> token '${TToken}' is missing a terminating '>' character!`> : Trim extends `Iterator<${infer Rest extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? Iterator, TGenerics>> : Err<"malformed-token", `The Iterator<...> token '${TToken}' is missing a terminating '>' character!`> : Trim extends `IterableIterator<${infer Rest extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? IterableIterator, TGenerics>> : Err<"malformed-token", `The IterableIterator<...> token '${TToken}' is missing a terminating '>' character!`> : Trim extends `AsyncGenerator<${infer Rest extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? TrimEach, readonly string[]>> extends infer Params extends readonly string[] ? Params["length"] extends 1 ? AsyncGenerator, any, unknown> : Params["length"] extends 2 ? AsyncGenerator, ResolveToken, unknown> : AsyncGenerator, ResolveToken, ResolveToken> : Err<"malformed-token", `Failed to parse the payload AsyncGenerator interior: '${Block}'.`, { token: TToken; block: Block; }> : Err<"malformed-token", `The AsyncGenerator<...> token '${TToken}' is missing a terminating '>' character!`> : Trim extends `AsyncIterableIterator<${infer Rest extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? AsyncIterableIterator, TGenerics>> : Err<"malformed-token", `The AsyncIterableIterator<...> token '${TToken}' is missing a terminating '>' character!`> : Err<"malformed-token", `A generator function's return type must be a Generator/Iterator or AsyncGenerator/AsyncIterableIterator type!`, { token: TToken; }>; type NamedSyncGenerator = Trim extends `function* ${infer AfterFunction extends string}` ? Trim extends `${infer Leading extends string}(${infer AfterParen extends string}` ? Leading extends `${infer Name extends string}<${infer GenericsBlock extends string}` ? Trim extends "" ? Err<"wrong-handler", `The generator did not appear to have a name and therefore is not a named generator.`, { token: T; }> : IT_TakeParameters<`<${GenericsBlock}(${AfterParen}`> extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnToken extends string}` ? ResolveGeneratorReturn, Generics> extends infer RT ? Extends | IterableIterator | Iterator> extends true ? { __kind: "IT_Token"; kind: "generator"; name: Trim; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: RT; token: Trim; type: RT; isAsync: false; rest: ""; } : Err<"malformed-token", `A synchronous generator must return a Generator/Iterator type!`, { token: Trim; returnToken: Trim; resolved: RT; }> : never : Err<"malformed-token", `After successfully parsing the parameters of a named generator, the return type was unable to be parsed because we couldn't find the expected ':' character used to separate the parameters from the return type`, { token: T; rest: Trim; parameters: Parameters; generics: Generics; }> : Err<"malformed-token", `Failed to parse the parameters of what appeared to be a named generator!`, { token: T; rest: `<${GenericsBlock}(${AfterParen}`; attempt: IT_TakeParameters<`<${GenericsBlock}(${AfterParen}`>; }> : Trim extends infer Name extends string ? Trim extends "" ? Err<"wrong-handler", `The generator did not appear to have a name and therefore is not a named generator.`, { token: T; }> : IT_TakeParameters<`(${AfterParen}`> extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnToken extends string}` ? ResolveGeneratorReturn, Generics> extends infer RT ? Extends | IterableIterator | Iterator> extends true ? { __kind: "IT_Token"; kind: "generator"; name: Trim; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: RT; token: Trim; type: RT; isAsync: false; rest: ""; } : Err<"malformed-token", `A synchronous generator must return a Generator/Iterator type!`, { token: Trim; returnToken: Trim; resolved: RT; }> : never : Err<"malformed-token", `Expected return type after ':' in a named generator`> : Err<"malformed-token", `Failed to parse the parameters of what appeared to be a named generator!`, { token: T; rest: `(${AfterParen}`; attempt: IT_TakeParameters<`(${AfterParen}`>; }> : never : Err<"wrong-handler"> : Err<"wrong-handler">; type NamedAsyncGenerator = Trim extends `async function* ${infer AfterFunction extends string}` ? Trim extends `${infer Leading extends string}(${infer AfterParen extends string}` ? Leading extends `${infer Name extends string}<${infer GenericsBlock extends string}` ? Trim extends "" ? Err<"wrong-handler", `The generator did not appear to have a name and therefore is not a named generator.`, { token: T; }> : IT_TakeParameters<`<${GenericsBlock}(${AfterParen}`> extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnToken extends string}` ? ResolveGeneratorReturn, Generics> extends infer RT ? Extends | AsyncIterableIterator> extends true ? { __kind: "IT_Token"; kind: "generator"; name: Trim; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: RT; token: Trim; type: RT; isAsync: true; rest: ""; } : Err<"malformed-token", `An asynchronous generator MUST return an AsyncGenerator/AsyncIterableIterator!`, { token: Trim; returnToken: Trim; resolved: RT; }> : never : Err<"malformed-token", `After successfully parsing the parameters of a named generator, the return type was unable to be parsed because we couldn't find the expected ':' character used to separate the parameters from the return type`, { token: T; rest: Trim; parameters: Parameters; generics: Generics; }> : Err<"malformed-token", `Failed to parse the parameters of what appeared to be a named generator!`, { token: T; rest: `<${GenericsBlock}(${AfterParen}`; attempt: IT_TakeParameters<`<${GenericsBlock}(${AfterParen}`>; }> : Trim extends infer Name extends string ? Trim extends "" ? Err<"wrong-handler", `The generator did not appear to have a name and therefore is not a named generator.`, { token: T; }> : IT_TakeParameters<`(${AfterParen}`> extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnToken extends string}` ? ResolveGeneratorReturn, Generics> extends infer RT ? Extends | AsyncIterableIterator> extends true ? { __kind: "IT_Token"; kind: "generator"; name: Trim; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: RT; token: Trim; type: RT; isAsync: true; rest: ""; } : Err<"malformed-token", `An asynchronous generator MUST return an AsyncGenerator/AsyncIterableIterator!`, { token: Trim; returnToken: Trim; resolved: RT; }> : never : Err<"malformed-token", `Expected return type after ':' in a named generator`> : Err<"malformed-token", `Failed to parse the parameters of what appeared to be a named generator!`, { token: T; rest: `(${AfterParen}`; attempt: IT_TakeParameters<`(${AfterParen}`>; }> : never : Err<"wrong-handler"> : Err<"wrong-handler">; type AnonSyncGenerator = Trim extends `function* ${infer Rest}` ? IT_TakeParameters> extends infer P extends IT_ParameterResults ? P extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnToken extends string}` ? ResolveGeneratorReturn, Generics> extends infer RT ? Extends | IterableIterator | Iterator> extends true ? { __kind: "IT_Token"; kind: "generator"; name: null; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: RT; token: Trim; type: RT; isAsync: false; rest: ""; } : Err<"malformed-token", `A synchronous generator must return a Generator/Iterator type!`, { token: Trim; returnToken: Trim; resolved: RT; }> : never : Err<"malformed-token", `Expected return type after ':' in an anonymous generator`> : never : Err<"wrong-handler", `Unable to parse parameters for anonymous generator: '${T}'`> : Err<"wrong-handler", `Not a valid anonymous generator: '${T}'`>; type AnonAsyncGenerator = Trim extends `async function* ${infer Rest extends string}` ? IT_TakeParameters> extends infer P extends IT_ParameterResults ? P extends { parameters: infer Parameters extends readonly IT_Parameter[]; generics: infer Generics extends readonly GenericParam[] | []; rest: infer AfterParams extends string; } ? Trim extends `:${infer ReturnToken extends string}` ? ResolveGeneratorReturn, Generics> extends infer RT ? Extends | AsyncIterableIterator> extends true ? { __kind: "IT_Token"; kind: "generator"; name: null; generics: Generics; parameters: Parameters; narrowing: Generics extends [] ? false : true; returnToken: AsStaticTemplate, TemplateMap__Generics>; returnType: RT; token: Trim; type: RT; isAsync: true; rest: ""; } : Err<"malformed-token", `An asynchronous generator MUST return an AsyncGenerator/AsyncIterableIterator!`, { token: Trim; returnToken: Trim; resolved: RT; }> : never : Err<"malformed-token", `Expected return type after ':' in an anonymous generator`> : never : Err<"wrong-handler", `Unable to parse parameters for anonymous generator: '${T}'`> : Err<"wrong-handler", `Not a valid anonymous generator: '${T}'`>; /** * iterates over the various generator signatures and returns when: * 1. a variant returns an Error of the type "malformed-token" * 2. a variant returns a successful outcome which extends `IT_Token<"generator">` */ type Select$1 = T extends [infer Head, ...infer Rest extends readonly unknown[]] ? Head extends Err<"malformed-token"> ? Head : Head extends Error ? Select$1 : Head : Err<"wrong-handler", `None of the variants for generators was able to parse the token: '${TToken}'`, { token: TToken; utility: "IT_TakeGenerator"; variants: TVariants; }>; type InvalidNamedGenerator = Err<`malformed-token/named-generator`, `The token started with the text '${A}function*' and thereby clearly indicated a generator function definition but the remaining text -- ${T} -- was not parsable! Remember that when using the 'function*' keyword the return type is delimited by a ':' character and MUST be a Generator/Iterator type.`, { token: `${A}function* ${T}`; }>; /** * IT_TakeGenerator * * Attempts to find a generator function at the head of a token string. * Will find the following variants: * - named synchronous and asynchronous generators * - anonymous synchronous and asynchronous generators * - Note: arrow generators are not valid and thus not supported. * * All variants also account for possible use of generics for parameters. */ type IT_TakeGenerator = Select$1<[T extends `function* ${string}(${string}):${string}` ? NamedSyncGenerator : Error, T extends `async function* ${string}(${string}):${string}` ? NamedAsyncGenerator : Error, T extends `function* (${string}):${string}` | `function* <${string}>(${string}):${string}` ? AnonSyncGenerator : Error, T extends `async function* (${string}):${string}` | `async function* <${string}>(${string}):${string}` ? AnonAsyncGenerator : Error, T extends `function* ${infer Rest extends string}` ? InvalidNamedGenerator : Error, T extends `async function* ${infer Rest extends string}` ? InvalidNamedGenerator : Error], T>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeGroup.d.ts /** * **IT_TakeGroup**`` * * Attempts to parse a _group_ at the head of the parse string `T`. * * - a group starts with `(` character and is terminated with a `)` * which resides at the "root" level */ type IT_TakeGroup = As extends infer Parts extends readonly string[] ? Parts["length"] extends 1 ? Err<`malformed-token/group`, `The IT_TakeGroup failed to find the terminating ')' character in: '${Trim}'`, { token: T; }> : Parts extends [infer Block extends string, ...infer Rest extends readonly string[]] ? GetInputToken> extends Error ? Err<`malformed-token/group`, [IsNever>>] extends [true] ? `The group's interior token -- ${Trim} -- returned the 'never' type when trying to resolve This shouldn't happen and indicates an error in one of the Take utilities!` : `The IT_TakeGroup failed while trying to parse the group's interior: '${Trim}'. The underlying error was: ${GetInputToken>["message"]}`, { group: Trim; rest: Join; underlying: GetInputToken>; }> : GetInputToken> extends infer IT extends IT_Token ? As<{ __kind: "IT_Token"; kind: "group"; token: `(${Trim})`; underlying: IT; type: (IT["type"]); rest: Trim>; }, IT_Token<"group">> : never : Err<`wrong-handler/group`> : Err<`wrong-handler/group`> : Err<`wrong-handler/group`>, IT_TakeOutcome<"group">>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeIntersection.d.ts /** * **IT_TakeIntersection**`` * * Takes the _prior token_ (which has already been parsed) and the * remaining parse string and converts it into an intersection type. */ type IT_TakeIntersection = undefined extends T ? Err<`malformed-token/intersection`, `The intersection character '&' was found at the start of a parse string. This is invalid as the '&' operator must be inline with types on both sides!`, { parseString: P; }> : As

extends infer Tokens extends readonly string[] ? TrimEach extends infer SplitTokens extends readonly string[] ? { [K in keyof SplitTokens]: GetInputToken } extends infer SplitTokens extends readonly unknown[] ? HasErrors extends true ? IsolateErrors extends infer Outcome extends IsolatedResults ? Err<`malformed-token/intersection`, `Error occurred trying to parse the elements [${Increment>}] of an intersection type. The text prior to the first '&' character was valid but ${Outcome["errors"]["length"]} of the remaining ${Length} were in an error state.`, { token: P; splitTokens: TrimEach; firstError: First$1; underlying: [T, ...SplitTokens]; }> : Err<"shit"> : { __kind: "IT_Token"; kind: "intersection"; token: `${As["token"]}&${Rest}`; type: TupleToIntersection<[As["type"], ...As, readonly unknown[]>]>; members: [As["type"], ...As, readonly unknown[]>]; rest: ""; } : Err<"malformed-token/intersection", `An intersection type was detected and parsed into elements but at least one of these elements was unable to be parsed as an InputToken!`, { tokens: SplitTokens; }> : Err<"malformed-token/intersection"> : Err<`malformed-handler/intersection`, `The token string contained a '&' character indicating that this is an intersection type but `> : Err<"wrong-handler/intersection">, IT_TakeOutcome<"intersection">>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeKvObjects.d.ts type ParseRecord = NestedSplit", { "{": "}"; "[": "]"; "<": ">"; "(": ")"; "=": ">"; }> extends [infer Block extends string, ...infer Rest extends readonly string[]] ? NestedSplit, ",", { "{": "}"; "[": "]"; "<": ">"; "(": ")"; "=": ">"; }> extends [infer Key extends string, infer Value extends string] ? FromInputToken__String> extends Error ? Err<`malformed-token/record`, `while parsing a Record, the key token '${Trim}' was not parsable to a type!`> : FromInputToken__String> extends Error ? Err<`malformed-token/record`, `while parsing a Record, the value token '${Trim}' was not parsable to a type!`> : [GetInputToken>, GetInputToken>] extends [infer ParsedKey extends IT_Token, infer ParsedValue extends IT_Token] ? ParsedKey["type"] extends string ? { __kind: "IT_Token"; kind: "kv"; token: `Record<${Block}>`; type: Record; container: "Record"; keyToken: Trim; valueToken: Trim; rest: Trim">>; } : Err<`malformed-token/record`, `The key and value tokens for the record 'Record<${Block}>' were parsed to types but the key's type did not extend string!`> : never : Err<`malformed-token/record`, `The terminating '>' character was not found while parsing the record: 'Record<${T}>'`> : Err<"wrong-handler/record">; type ParseMap = NestedSplit", { "{": "}"; "[": "]"; "<": ">"; "(": ")"; "=": ">"; }> extends [infer Block extends string, ...infer Rest extends readonly string[]] ? NestedSplit, ",", { "{": "}"; "[": "]"; "<": ">"; "(": ")"; "=": ">"; }> extends [infer Key extends string, infer Value extends string] ? FromInputToken__String> extends Error ? Err<`malformed-token/map`, `while parsing a Map, the key token '${Trim}' was not parsable to a type!`> : FromInputToken__String> extends Error ? Err<`malformed-token/map`, `while parsing a Map, the value token '${Trim}' was not parsable to a type!`> : { __kind: "IT_Token"; kind: "kv"; token: `Map<${Block}>`; type: Map>, FromInputToken__String>>; container: "Map"; keyToken: Trim; valueToken: Trim; rest: Trim">>; } : Err<`malformed-token/map`, `The terminating '>' character was not found while parsing: 'Map<${T}'`> : Err<"wrong-handler/map">; type ParseWeakMap = NestedSplit", { "{": "}"; "[": "]"; "<": ">"; "(": ")"; "=": ">"; }> extends [infer Block extends string, ...infer Rest extends readonly string[]] ? NestedSplit, ",", { "{": "}"; "[": "]"; "<": ">"; "(": ")"; "=": ">"; }> extends [infer Key extends string, infer Value extends string] ? FromInputToken__String> extends Error ? Err<`malformed-token/weakmap`, `while parsing a WeakMap, the key token '${Trim}' was not parsable to a type!`> : FromInputToken__String> extends Error ? Err<`malformed-token/weakmap`, `while parsing a WeakMap, the value token '${Trim}' was not parsable to a type!`> : [GetInputToken>, GetInputToken>] extends [infer ParsedKey extends IT_Token, infer ParsedValue extends IT_Token] ? ParsedKey["type"] extends object ? { __kind: "IT_Token"; kind: "kv"; token: `WeakMap<${Block}>`; type: WeakMap; container: "WeakMap"; keyToken: Trim; valueToken: Trim; rest: Trim">>; } : Err<`malformed-token/weakmap`, `The key and value tokens for 'WeakMap<${Block}>' were parsed to the key's type did not extend object (which is required for a WeakMap)!`> : never : Err<`malformed-token/weakmap`, `The terminating '>' character was not found while parsing: 'WeakMap<${T}'`> : Err<"wrong-handler/weakmap">; type Select = T extends [infer Head, ...infer Rest extends readonly unknown[]] ? Head extends Err<"malformed-token"> ? Head : Head extends Error ? Select : Head : Err<"wrong-handler/kv", `None of the variants of KV containers matched on: '${TToken}'`, { token: TToken; utility: "IT_TakeKvObjects"; variants: TVariants; }>; /** * **IT_TakeKvObjects**`` * * Is intended for types like `Record`, `Map` and `WeakMap`, it will * take the _key_ and _value_ types as well as capture the container type. * * **Note:** the "object literal" type is taken separately from these more basic KV * forms. Use `IT_TakeObjectLiteral` for taking object literals. */ type IT_TakeKvObjects = Select<[T extends `Record<${infer Rest extends string}` ? ParseRecord : Error, T extends `Map<${infer Rest extends string}` ? ParseMap : Error, T extends `WeakMap<${infer Rest extends string}` ? ParseWeakMap : Error], T>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeNumericLiteral.d.ts type Break$2 = Whitespace | "|" | "&"; type TakeNumber = T extends `${infer Head}${infer Rest}` ? Head extends Break$2 ? R : TakeNumber : R; type Bare = StartsWith extends true ? TakeNumber extends `${number}` ? { __kind: "IT_Token"; kind: "literal"; token: `${TakeNumber}`; type: AsNumber>; rest: Trim>>; } : Err<`malformed-token/numeric-literal`, `A bare number was detected but the resultant token of '${TakeNumber}' can not be converted to a number!`, { parse: T; token: TakeNumber; }> : Err<`wrong-handler/numeric-literal`, `A bare number representing a numeric literal requires that the string passed in starts with a numeric literal.`, { token: T; }>; type NumberConstructor = T extends `Number(${infer Num extends number})${infer Rest extends string}` ? { __kind: "IT_Token"; kind: "literal"; token: `${Num}`; type: Num; rest: Trim; } : T extends `Number(${infer Rest extends string}` ? Contains extends true ? Err<`malformed-token/numeric-literal`, `A numeric literal with the 'Number(defn)' syntax provided an invalid numeric value of '${RetainUntil}'!`, { token: T; }> : Err<`malformed-token/numeric-literal`, `A numeric literal definition was detected by the 'Numeric(' but no terminating ')' character found!`, { token: T; }> : Err<"wrong-handler/numeric-literal">; /** * **IT_TakeNumericLiteral**`` * * Attempts to parse a numeric literal from the head of the parse string. */ type IT_TakeNumericLiteral = As extends IT_Token<"literal"> ? Bare : NumberConstructor extends IT_Token<"literal"> ? NumberConstructor : Bare extends Err<"malformed-token"> ? Bare : NumberConstructor extends Err<"malformed-token"> ? NumberConstructor : Err<"wrong-handler/numeric-literal">, IT_TakeOutcome<"literal">>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeObjectLiteral.d.ts type DetermineKeyType = T extends "string" ? string : StripTrailing extends "symbol" ? symbol : T extends string ? StripTrailing : Err<"malformed-token/object-literal", `A key '${T}' can not be converted to a type!`>; type GetKv> = [StripTrailing, Trim] extends [infer KeyToken extends string, infer ValueToken extends string] ? DetermineKeyType extends Error ? DetermineKeyType : GetInputToken extends Error ? Err<`malformed-token/object-literal`, `The value '${ValueToken}' in the key value pair '${TKey}: ${ValueToken}' could not be parsed into a type!`, { keyToken: KeyToken; valueToken: ValueToken; underlying: GetInputToken; }> : GetInputToken extends IT_Token ? { key: DetermineKeyType; value: GetInputToken["type"]; required: Not; } : Err<`malformed-token/object-literal`> : never; type ParseKv = IsolateErrors<{ [K in keyof T]: NestedSplit extends [infer KeyToken extends string, infer ValueToken extends string] ? GetKv, Trim> : never }>; /** * **ParseObjectLiteral**`` * * Tries to parse the head of the parse string for a string based object literal definition. * * - any parse string which _starts with_ `{${string}` will be assumed to be an attempt * to define an object literal */ type ParseObjectLiteral = NestedSplit extends infer Parts extends readonly string[] ? Parts["length"] extends 1 ? Err<"malformed-token/object-literal", `The terminating '}' character was not found in the token's object literal definition!`, { token: `{ ${T}`; }> : Parts extends [infer Block extends string, ...infer Rest extends readonly string[]] ? NestedSplit, [",", ";"]> extends infer KvPairs extends readonly string[] ? TrimEach extends infer KVs extends readonly string[] ? ParseKv extends infer Outcome extends IsolatedResults ? Length extends 0 ? Outcome["successes"] extends infer Success extends readonly KeyValue[] ? { __kind: "IT_Token"; kind: "object-literal"; token: `{ ${Trim} }`; type: FromKv; rest: Trim>; keyValues: Success; } : Err<"malformed-token/object-literal", `There were no errors detected in the key/value pairs but result type did not extends IT_Token: ${Block}`, { block: Block; split: NestedSplit, [",", ";"]>; }> : Err<"malformed-token/object-literal", `Error(s) occurred in parsing the key/value pairs of an object literal. The following errors were found: ${Join, "\n\t">}`, { token: `{ ${Trim} }`; block: Trim; split: NestedSplit, [",", ";"]>; errors: GetEach; }> : Err<`malformed-token/object-literal`, `Failed to parse the key values found in the object literal: '${T}'`, { token: T; block: Block; }> : Err<"malformed-token/object-literal", `The parsing of an object literal was started due to the presence of the '{' character but no matching '}' was detected: ${Block}`> : Err<"malformed-token/object-literal", `The terminating '}' character was not found in the token's object literal definition!`, { token: T; }> : Err<"oops"> : never; /** * **IT_TakeObjectLiteral**`` * * Parses object literal definitions at the head of the parse string. * * - Strings starting with `{` indicate the beginning of an object literal definition */ type IT_TakeObjectLiteral = As> : Err<`wrong-handler/object-literal"`, `The token ${T} did not start with '{' so this is not an object literal`>, IT_TakeOutcome<"object-literal">>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeParameters.d.ts type DetermineType< /** the string token for the parameter type */T extends string, U extends readonly GenericParam[]> = Find$1 extends infer Generic extends GenericParam ? { token: Generic["token"]; type: Generic["type"]; fromGeneric: Generic["name"]; } : Trim extends `Array<${infer Inner extends string}>` ? DetermineType, U> extends infer InnerInfo extends { type: unknown; } ? { token: Trim; type: Array; fromGeneric: false; } : Err<`malformed-token`, `While parsing an Array parameter, the interior token '${Trim}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Trim extends `${infer InnerA extends string}[][]` ? DetermineType, U> extends infer AInfo extends { type: unknown; } ? { token: Trim; type: AInfo["type"][][]; fromGeneric: false; } : Err<`malformed-token`, `While parsing a two-dimensional array parameter, the interior token '${Trim}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Trim extends `${infer InnerB extends string}[]` ? DetermineType, U> extends infer BInfo extends { type: unknown; } ? { token: Trim; type: BInfo["type"][]; fromGeneric: false; } : Err<`malformed-token`, `While parsing an array parameter, the interior token '${Trim}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Trim extends `Set<${infer InnerS extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? DetermineType, U> extends infer SInfo extends { type: unknown; } ? { token: `Set<${Trim}>`; type: Set; fromGeneric: false; } : Err<`malformed-token`, `While parsing a Set parameter, the interior token '${Trim}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The Set<...> token '${Trim}' is missing a terminating '>' character!`, { parameter: Trim; generics: U; }> : Trim extends `Promise<${infer InnerP extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? DetermineType, U> extends infer PInfo extends { type: unknown; } ? { token: `Promise<${Trim}>`; type: Promise; fromGeneric: false; } : Err<`malformed-token`, `While parsing a Promise parameter, the interior token '${Trim}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The Promise<...> token '${Trim}' is missing a terminating '>' character!`, { parameter: Trim; generics: U; }> : Trim extends `Map<${infer RestM extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? TrimEach, readonly string[]>> extends [infer KTok extends string, infer VTok extends string, ...infer _Extra extends readonly string[]] ? DetermineType extends infer KInfo extends { type: unknown; } ? DetermineType extends infer VInfo extends { type: unknown; } ? { token: `Map<${KTok}, ${VTok}>`; type: Map; fromGeneric: false; } : Err<`malformed-token`, `While parsing a Map parameter, the value token '${VTok}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `While parsing a Map parameter, the key token '${KTok}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The Map<...> parameter interior '${Block}' did not contain a valid 'key, value' pair!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The Map<...> token '${Trim}' is missing a terminating '>' character!`, { parameter: Trim; generics: U; }> : Trim extends `WeakMap<${infer RestW extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? TrimEach, readonly string[]>> extends [infer KTok extends string, infer VTok extends string, ...infer _Extra extends readonly string[]] ? DetermineType extends infer KInfo extends { type: unknown; } ? DetermineType extends infer VInfo extends { type: unknown; } ? { token: `WeakMap<${KTok}, ${VTok}>`; type: WeakMap, VInfo["type"]>; fromGeneric: false; } : Err<`malformed-token`, `While parsing a WeakMap parameter, the value token '${VTok}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `While parsing a WeakMap parameter, the key token '${KTok}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The WeakMap<...> parameter interior '${Block}' did not contain a valid 'key, value' pair!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The WeakMap<...> token '${Trim}' is missing a terminating '>' character!`, { parameter: Trim; generics: U; }> : Trim extends `Record<${infer RestR extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer _R extends readonly string[]] ? TrimEach, readonly string[]>> extends [infer KTok extends string, infer VTok extends string, ...infer _Extra extends readonly string[]] ? DetermineType extends infer KInfo extends { type: unknown; } ? DetermineType extends infer VInfo extends { type: unknown; } ? { token: `Record<${KTok}, ${VTok}>`; type: Record, VInfo["type"]>; fromGeneric: false; } : Err<`malformed-token`, `While parsing a Record parameter, the value token '${VTok}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `While parsing a Record parameter, the key token '${KTok}' was not parsable to a type!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The Record<...> parameter interior '${Block}' did not contain a valid 'key, value' pair!`, { parameter: Trim; generics: U; }> : Err<`malformed-token`, `The Record<...> token '${Trim}' is missing a terminating '>' character!`, { parameter: Trim; generics: U; }> : FromInputToken__String> extends Error ? Err<`malformed-token`, `The parameter token's boundaries were established but while iterating over the parameter definitions we found the parameter token: '${Trim}'`, { parameter: Trim; generics: U; }> : { token: Trim; type: FromInputToken__String>; fromGeneric: false; }; type AsParameters = TParams extends [infer Head extends string, ...infer Rest extends readonly string[]] ? Head extends `${infer Name extends string}:${infer Type extends string}` ? DetermineType, TGenerics> extends infer Info extends { type: any; fromGeneric: false | string; token: string; } ? AsParameters; token: Info["token"]; fromGeneric: Info["fromGeneric"]; type: Info["type"]; }, GenericParam>]> : Err<`malformed-token`, `function parsing failed in call to DetermineType<...>`, { parameters: TParams; generics: TGenerics; result: TResult; determineType: DetermineType, TGenerics>; }> : Err<`malformed-token`, `The parameter token '' can not be parsed to find any type information!`, { result: TResult; }> : TResult extends readonly IT_Parameter[] ? TResult : Err<`malformed-token`, `Failed while trying to parse the parameters of a function`, { results: TResult; params: TParams; }>; type TakeParameters< /** the token string after generics have been taken */T extends string, /** the list of available parameters */P extends readonly GenericParam[]> = T extends `(${infer Rest extends string}` ? [RetainUntil, Trim>] extends [infer Block extends string, infer Rest extends string] ? Trim extends "" ? { parameters: []; generics: P; rest: Rest; } : NestedSplit extends infer KV extends readonly string[] ? { parameters: AsParameters; generics: P; rest: Rest; } : Err<"malformed-token", `The function's parameter block -- ${Block} -- was not able to be parsed!`, { token: T; block: Block; rest: Rest; generics: P; }> : Err<"malformed-token", `The opening parenthesis indicated a parameter block should follow but was unable to find the closing parenthesis in: ${Rest}`, { token: T; rest: Rest; generics: P; }> : Err<`wrong-handler`, `parameter blocks expect the leading character to be an open parenthesis`, { token: T; generics: P; }>; /** * **IT_TakeParameters**`` * * A reusable utility for both _functions_ and _generators_ which takes: * * - **generics** _when found_ * - **parameters** _when found_ * * Like other **take** utilities, this utility returns: * - a `Err` when parameters could not be found at the * head of the token string. * - a `Err` when either the generics block (`<${string}>`) or * parameters block (`(${string})`) is _established_ but can not be parsed. * * On successful parsing of a parameter block it will return `IT_Parameters` type * which can be used to help complete the `IT_Token<"fn">` or `IT_Token<"generator">` * blocks required by the utilities `IT_TakeFunction` and `IT_TakeGenerator`. */ type IT_TakeParameters = IT_TakeTokenGenerics extends Err<"invalid-token"> ? IT_TakeTokenGenerics : IT_TakeTokenGenerics extends IT_Generics ? TakeParameters["rest"], IT_TakeTokenGenerics["generics"]> : TakeParameters; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakePromise.d.ts type IT_TakePromise = T extends `Promise<${infer Rest extends string}` ? NestedSplit"> extends [infer Block extends string, ...infer Rest extends readonly string[]] ? FromInputToken__String extends Error ? Err<`malformed-token`, `Failed to parse the payload Promise interior: '${Block}'. ${FromInputToken__String["message"]}`, { token: T; block: Block; }> : { __kind: "IT_Token"; kind: "promise"; token: `Promise<${Block}>`; type: Promise>; rest: Trim">>; } : never : Err<"wrong-handler">; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeSet.d.ts type IT_TakeSet = T extends `Set<${infer Rest}` ? NestedSplit"> extends [infer Block extends string, ...infer Rest extends readonly [string, ...string[]]] ? FromInputToken__String> extends Error ? Err<"malformed-token", `In Set, the token representing T -- '${Trim}' -- was not able to be parsed to a type. ${FromInputToken__String>["message"]}`> : { __kind: "IT_Token"; kind: "set"; token: `Set<${Trim}>`; type: Set>>; rest: Trim">>; } : never : Err<"wrong-handler/set">; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeStringLiteral.d.ts /** * Join all parts with the separator, including between a non-empty * part and a trailing empty string. This preserves a trailing separator * when the split produced a final empty string. */ type JoinAll = [] extends T ? R : T extends [infer H extends string, ...infer Rest extends readonly string[]] ? Rest["length"] extends 0 ? R extends "" ? H : `${R}${S}${H}` : JoinAll : R; type EmptyString$1 = T extends `''${infer Rest}` ? { __kind: "IT_Token"; kind: "literal"; token: T; type: `""`; rest: Rest; } : T extends `""${infer Rest}` ? { __kind: "IT_Token"; kind: "literal"; token: T; type: `""`; rest: Rest; } : T extends `\`\`${infer Rest}` ? { __kind: "IT_Token"; kind: "literal"; token: T; type: `""`; rest: Rest; } : Err<"wrong-handler/empty-string">; type Quoted = T extends `${infer Head}${infer Rest}` ? Head extends infer Quote extends QuoteCharacter ? Contains extends true ? NestedSplit extends [infer Block extends string, ...infer Rest extends string[]] ? Block extends "" ? Err<"malformed-token/string-literal"> : { __kind: "IT_Token"; kind: "literal"; token: `${Quote}${Block}${Quote}`; type: AsLiteralTemplate; rest: Trim>; } : Err<`malformed-token/string-literal`, `While parsing a string literal starting with quote character ${Quote}; there was no terminating quote character of the same type!`, { token: T; }> : Err<"malformed-token/string-literal", `While parsing a string literal starting with quote character ${Quote}; there was no terminating quote character of the same type!`, { token: T; }> : Err<`wrong-handler/quoted`, `The parse string did not start with a quote character`> : Err<`wrong-handler/quoted`, `The parse string only had a single character`>; /** * matches on string literals defined like `String(foo)` */ type StringConstructor = T extends `String(${infer Rest}` ? Contains extends true ? NestedSplit extends [infer Block extends string, ...infer Rest extends string[]] ? { __kind: "IT_Token"; kind: "literal"; token: `String(${Block})`; type: AsLiteralTemplate; rest: Trim>; } : never : Err<"malformed-token/string-literal", `While parsing a string literal using the String(literal) syntax; there was no terminating ')' character!`, { token: T; }> : Err<"wrong-handler/string-literal", `The token didn't match that a of a string literal using the constructor syntax (e.g., 'String(literal)')`, { token: T; }>; /** * **IT_TakeStringLiteral**`` * * Attempts to parse a string literal from the _head_ of the parse string. */ type IT_TakeStringLiteral = EmptyString$1 extends IT_Token<"literal"> ? EmptyString$1 : StringConstructor extends IT_Token<"literal"> ? StringConstructor : Quoted extends IT_Token<"literal"> ? Quoted : StringConstructor extends Err<"malformed-token"> ? StringConstructor : Quoted extends Err<"malformed-token"> ? Quoted : IsNever> extends true ? Err<`malformed-token`> : IsNever> extends true ? Err<`malformed-token`> : Err<"wrong-handler/string-literal", `The IT_TakeString handler is unable to parse the head of: '${T}'`, { token: T; }>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeTokenGenerics.d.ts /** * the successful results of evaluating a single generic parameter */ interface TokenParsed { name: string; token: string; type: unknown; } /** * all of the tokens found in a generics block plus the "rest" */ interface GenericsParsed { generics: TokenParsed[]; rest: string; } type IT_TakeTokenGeneric = T extends `${infer Name extends string} extends ${infer Type extends string}` ? Trim extends infer CleanName extends string ? Trim extends infer CleanType extends string ? FromInputToken extends infer ParsedType ? { name: CleanName; token: CleanType; type: ParsedType; } : never : never : never : IsAlphanumeric> extends true ? { name: Trim; token: "unknown"; type: unknown; } : Err<`malformed-token/generic`, `The string -- '${T}' -- passed to TakeTokenGeneric is invalid as a generic name!`>; /** * */ type ParseGenerics = TPairs extends [infer Head extends string, ...infer Rest extends readonly string[]] ? IT_TakeTokenGeneric extends infer Result ? Result extends Error ? ErrContext : Result extends TokenParsed ? ParseGenerics : Err<`malformed-token/generic`, `The ParseGenerics<..> utility ran into a string pair which it could not parse into a generic parameter!`, { result: Result; }> : Err<"malformed-token/generic", `This shouldn't really happen but is the outcome of not being able to infer a type for 'IT_TakeTokenGeneric'`, { head: Head; }> : P; /** * **TakeTokenGenerics**`` * * Parses what is meant to be expected to be a a comma delimited set of * generic parameters terminating with a `>` character. * * **Note:** * - since this utility starts by stripping a leading character of `<` * (if it exists) you can pass in a token string that has _already_ had * this stripped off and this utility will work in the same way. * * * ```ts * { * generics: [ * { name: "T", type: string }, * { name: "U", type: number | boolean } * ], * rest: "= ..." * type Generics = TakeTokenGenerics<" = ..."> * ``` * * **Related**: `TakeKeyValueTokens` */ type IT_TakeTokenGenerics> = string extends T ? GenericsParsed | Error : NestedSplit"> extends [infer Block extends string, ...infer Rest extends readonly string[]] ? NestedSplit extends Error ? ErrContext, { utility: "TakeTokenGeneric"; token: `<${TClean}`; block: Block; }> : NestedSplit extends infer GenericPairs extends readonly string[] ? TrimEach extends infer TrimmedPairs extends readonly string[] ? ParseGenerics extends infer ParsedResult ? ParsedResult extends Error ? ErrContext : ParsedResult extends readonly TokenParsed[] ? { generics: ParsedResult; rest: Trim">>; } : Err<"malformed-token", `The parsed generics appear to be of an invalid type!`, { generics: ParsedResult; rest: Trim">>; }> : never : never : never : Err<`wrong-handler/generic`, `The string token passed in could not be parsed as a Generics block`, { token: `<${TClean}`; utility: "TakeTokenGenerics"; }>; //#endregion //#region src/runtime-types/type-defn/input-tokens/IT_TakeUnion.d.ts type HasEmptyString = T extends [infer Head extends string, ...infer Rest extends readonly string[]] ? Trim extends "" ? true : HasEmptyString : false; type ParseParts = As> extends Error ? GetInputToken> : GetInputToken> extends IT_Token ? ParseParts>]> : Err<"malformed-token", `The token '${Head}' was unable to be parsed into a type!`, { result: FromInputToken__String>; }> : R, readonly IT_Token[] | Error>; type Parse = As extends Err<"malformed-token"> ? ValidateStructure : ValidateStructure extends readonly string[] ? (ValidateStructure extends [infer HeadTokenStr extends string, ...infer RestParts extends readonly string[]] ? (ValidateStructure extends infer ValidRest extends readonly string[] ? ParseParts extends infer TokensOrErr ? TokensOrErr extends Error ? Err<"malformed-token/union", `Attempt to parse members of a union type failed because one or more were unable to be parsed into a valid type. ${TokensOrErr["message"]}`, { parts: RestParts; }> : TokensOrErr extends infer RestTokens extends readonly IT_Token[] ? { __kind: "IT_Token"; kind: "union"; token: Trim], " | ">>; type: TupleToUnion<[FromInputToken__String>, ...FromInputToken__Tuple]>; rest: As["rest"], string>; members: [FromInputToken__String>, ...FromInputToken__Tuple]; } : never : never : never) : never) : Err<`malformed-token/union`>, IT_TakeOutcome<"union">>; /** * looks at the underlying tokens which will be part of the union; returns a `Err<"malformed-token">` if * an error is detected. * * - ensures no trailing empty string (which indicates | at end of string) * - ensure no interior members are empty strings (which indicates a duplicate '|' operator) * * If all passes then tokens are returned in a _trimmed_ form. */ type ValidateStructure = Trim> extends "" ? Err<`malformed-token/union`, `The union operator '|' was found at the end of the parse string. This is not allowed as the union operator is an inline operator and must have types on both sides of it!`, { parseString: T; }> : HasEmptyString extends true ? Err<`malformed-token/union`, `The union operator '|' was found next to another '|' operator. This is not allowed as the union operator is an inline operator and must have types on both sides of it!`, { parseString: T; }> : TrimEach; /** * **IT_TakeUnion**`` * * Takes a token (or undefined) and the remaining parse string. * * - if the remaining parse string starts with `|` then this utility will parse the remaining * string * - if the remaining parse string doesn't start with `|` then the Error "wrong-handler" is returned */ type IT_TakeUnion = As extends `|${infer Rest extends string}` ? TToken extends undefined ? Err<`malformed-token/union`, `The union operator '|' was found at the beginning of the parse string. This is not allowed as the union operator is an inline operator and must have types on both sides of it!`, { parseString: TToken; previousToken: TToken; }> : NestedSplit"; "(": ")"; "=": ">"; }> extends infer Parts extends readonly string[] ? Parse<[`${As["token"]}`, ...Parts]> : never : Err<"wrong-handler/union", `The union handler only takes parse strings which start with '|'`, { parse: TParse; token: TToken; }>, IT_TakeOutcome<"union">>; //#endregion //#region src/runtime-types/type-defn/TokenMapper.d.ts /** * **TokenMapper** * * A simple key value store where: * * - the _keys_ must be strings and they represent the "tokens" your * token mapping solution (with the use of `DefineObjectWith`) * - the _values_ are the _types_ which the **key** represents * * This is meant to be used with `DefineObjectWith` type utility. */ type TokenMapper = Record; //#endregion //#region src/runtime-types/TypeOf.d.ts /** * **TypeOf** * * The possible _types_ returned by the Javascript `typeof` command. * * - most types such as `string`, `number`, `boolean`, `undefined`, etc. have very * straight forward "types" * - the `object` type however translates into `null` and any array or object * - even though `function` _is_ clearly separated from `object` at runtime with **typeof** * it does allow dictionary properties to be attached along with being a function. This * contrasts with Typescript which models an intersection between a function signature * and an object signature. * * **Related:** `TypeOfExtended` */ type TypeOf = TupleToUnion; /** * **TypeOfExtended** * * The base data structures we tend think of in Javascript including some * like `null` and `array` which are not reported by the **typeof** operator. * * This set of operators, while not natively supported by **typeof** is supported * by type and runtime utilities in this library. * * **Related:** `TypeOf`, `TypeTokens` */ type TypeOfExtended = TypeOf | "null" | "array" | "function-with-props"; /** * **GetTypeOf**`` * * type utility which converts a type string literal which represents * the value of this type from the standpoint of Javascript's `typeof` * operator. */ type GetTypeOf = (T extends string ? "string" : [T] extends [number] ? "number" : [T] extends [boolean] ? "boolean" : [T] extends [AnyFunction] ? "function" : [T] extends [AnyObject] | null | unknown[] ? "object" : [T] extends [bigint] ? "bigint" : [IsUndefined] extends [true] ? "undefined" : [T] extends [symbol] ? "symbol" : never) & TypeOf; /** * **ConvertTypeOf**`` * * Type utility which receives a `TypeOf` value and converts into a * comparable type. * * - please keep in mind that `object` types are converted to: * ```ts * AnyObject | null | unknown[] * ``` * - any runtime type which is seen as a `function` is converted to the * `AnyFunction` type alias which includes allowing for functions which * have dictionary props. */ type ConvertTypeOf = T extends "string" ? string : T extends "number" ? number : T extends "object" ? AnyObject | null | unknown[] : T extends "undefined" ? undefined : T extends "function" ? AnyFunction : T extends "bigint" ? number : T extends "symbol" ? symbol : T extends "boolean" ? boolean : never; //#endregion //#region src/runtime-types/TypeToken.d.ts /** * **BaseTypeToken** * * A very simple structure for `TypeTokens` to fit into. * * Use this type if you need to preserve type simplicity, otherwise * prefer `TypeToken` (or subsets like `AtomicToken`, `SingletonToken`, etc.) */ type BaseTypeToken = `${TypeTokenStart}${string}${TypeTokenStop}`; /** * TypeTokenAtomics * * The token names which are considered "atomic" */ type TypeTokenAtomics = typeof TT_ATOMICS[number]; type TypeTokenContainers = typeof TT_CONTAINERS[number]; type TypeTokenFunctions = typeof TT_FUNCTIONS[number]; type TypeTokenSingletons = typeof TT_SINGLETONS[number]; type TypeTokenSets = typeof TT_SETS[number]; /** * **TypeTokenKind** * * The full set of _type token_ kinds (aka, the first and * identifying part of the string token after the initial * token identifier) */ type TypeTokenKind = TypeTokenAtomics | TypeTokenContainers | TypeTokenFunctions | TypeTokenSets | TypeTokenSingletons; /** * string which indicates the start of a `TypeToken` */ type TypeTokenStart = typeof TT_START; /** * string which indicates the end of a `TypeToken` */ type TypeTokenStop = typeof TT_STOP; /** the _delimiter_ token used in a `TypeToken` */ type TypeTokenDelimiter = typeof TT_DELIMITER; type Delim = TypeTokenDelimiter; /** * **TypeToken** * * A **TypeToken** represents the general shape of all variants of the * TypeToken family. Variants are distinguished at the highest level * by their `TypeTokenKind`. * * You can use the generic `T` to isolate to one or more of these kinds * if you like but by default all are represented. */ type TypeToken = IsEqual extends true ? `${TypeTokenStart}${T}${"" | `${Delim}${string}`}${TypeTokenStop}` : T extends TypeTokenKind ? IsUnion extends true ? null : T extends TypeTokenSets ? `${TypeTokenStart}${T}${Delim}${TypeTokenLookup}${TypeTokenStop}` : T extends TypeTokenAtomics ? `${TypeTokenStart}${T}${TypeTokenStop}` : `${TypeTokenStart}${T}${TypeTokenStop}` | `${TypeTokenStart}${T}${Delim}${TypeTokenLookup}${TypeTokenStop}` : never; /** * the shape of `TypeToken` variants which represent one of the Singleton variants */ type TT_Singleton = TypeToken; /** the shape of `TypeToken` variants which represent one of the Atomic variants */ type TT_Atomic = TypeToken; /** the shape of `TypeToken` variants which a "set" of pattern based types */ type TT_Set = TypeToken; /** the shape of `TypeToken` variants which represent a function */ type TT_Function = TypeToken; /** the shape of `TypeToken` variants which represent a container */ type TT_Container = TypeToken; //#endregion //#region src/runtime-types/TypeToken-variants.d.ts type MakeDynamic = { [K in keyof T]: ReplaceAll, "${Metric}", MetricCategory> }; /** * Type extensions for the `string` variant * * Allow for wide "string", or a string literal. */ type TypeToken__String = `${string}`; type TypeToken__StringSet = MakeDynamic[number]; /** * Type extensions for the `number` variant. * * Allow for wide "number", a numeric literal. */ type TypeToken__Number = `::${number}`; type TypeToken__NumberSet = "bigInt" | `bigInt::${bigint}` | "digit" | `digit::${2 | 3 | 4}` | "integer"; type params = string; type rtn = string; type D$1 = TypeTokenDelimiter; type TypeToken__Fn = `[${params}]` | `[${params}]${D$1}${rtn}` | `any::${rtn}`; type TypeToken__Gen = `[${params}]` | `[${params}]${D$1}${rtn}` | `gen${D$1}any${D$1}${rtn}`; type TypeToken__FnSet = `withoutParams` | `withoutParams${D$1}${rtn}` | `booleanLogic` | `booleanLogic${D$1}[${params}]`; type RecVariant = typeof TYPE_TOKEN_REC_VARIANTS[number]; type RecKeyVariant = typeof TYPE_TOKEN_REC_KEY_VARIANTS[number]; type TypeToken__Rec = `${RecVariant}${D$1}${RecKeyVariant}` | `${D$1}kv${D$1}${string}` | `${D$1}kv${D$1}${string}${D$1}${"withUnknownIndex" | "withAnyIndex"}`; type TypeToken__Undefined = ""; type TypeToken__Null = ""; type TypeToken__Boolean = ""; type TypeToken__True = ""; type TypeToken__False = ""; type TypeToken__Never = ""; type TypeToken__Unknown = ""; type TypeToken__UnionSet = typeof TYPE_TOKEN_UNION_SET_VARIANTS[number]; interface _TypeTokenLookup { "string": TypeToken__String; "string-set": TypeToken__StringSet; "number": TypeToken__Number; "number-set": TypeToken__NumberSet; "undefined": TypeToken__Undefined; "null": TypeToken__Null; "boolean": TypeToken__Boolean; "true": TypeToken__True; "false": TypeToken__False; "never": TypeToken__Never; "unknown": TypeToken__Unknown; "fn": TypeToken__Fn; "fn-set": TypeToken__FnSet; "gen": TypeToken__Gen; "rec": TypeToken__Rec; "arr": ""; "map": ""; "weak": ""; "asUnion": ""; "union-set": TypeToken__UnionSet; } /** * **TypeTokenLookup**`` * * Adds allowed string literal variants for a given `TypeTokenKind` */ type TypeTokenLookup = T extends keyof _TypeTokenLookup ? _TypeTokenLookup[T] : ""; //#endregion //#region src/runtime-types/TypeTuple.d.ts /** * **TypeTuple**`` * * The Tuple containing: * - a type _representation_ * - a type guard to validate * - (optionally) a textual description of the type * * This provides a simple shorthand way of defining a type in a way * which can be used in the tooling for `Type` and `TypeDefn` but does * not represent a full-fledged `Type`. */ type TypeTuple = [type: TType, guard: TypeGuard, desc: TDesc]; //#endregion //#region src/generics/GenericParam.d.ts /** * **GenericParam** * * A structured representation of a generic parameter used by runtime types * like `InputToken`. * * **Related:** `GenericParamToken` */ interface GenericParam { /** the generic's name */ name: string; /** * a _string based_ `InputToken` representing the generic's * type. */ token: InputTokenSuggestions; /** * the **type** the given generic parameter _extends_ */ type: unknown; } //#endregion //#region src/kv/FromKv.d.ts type Intersect = T extends [infer Head extends Dictionary, ...infer Rest extends Dictionary[]] ? Intersect : R; type Convert$1 = T extends [infer Head extends KeyValue, ...infer Rest extends KeyValue[]] ? Head["required"] extends true ? Convert$1]> : Convert$1]> : ExpandRecursively>; /** * **FromKv**`` * * Converts a tuple of `KeyValue` objects into a narrowly typed object. * * ```ts * // { foo: 1; bar: "hi" } * type FooBar = FromKv<[ * { key: "foo", value: 1 }, * { key: "bar", value: "hi" } * ]>; * ``` * * **Related:** `ToKv`, `KeyValue` */ type FromKv = IsWideContainer extends true ? Dictionary : Convert$1; //#endregion //#region src/kv/KeyValue.d.ts /** * **KeyValue** * * A type used by utilities like `ToKv` and `FromKv` to convert * a Dictionary into a tuple of KeyValue's (or visa-versa). */ interface KeyValue { /** the _key_ of an object */ key: K; /** the _value_ of the object's @ `key` */ value: V; /** * whether this key/value pair is _required_ in the object definitions */ required: R; } //#endregion //#region src/kv/ToKv.d.ts interface ToKvOptions extends Partial { recurse?: number | boolean; } type Recurse = TVal extends Dictionary ? [IsFalse>] extends [true] ? TVal : ToKv : TVal; type Convert, TKv extends readonly KeyValue[] = []> = TKeys extends [infer Head extends ObjectKey, ...infer Rest extends ObjectKey[]] ? Head extends keyof TObj ? Head extends TOptional[number] ? Convert | undefined; required: false; }]> : Convert; required: true; }]> : never : TKv; interface Options { order: T["order"] extends SortOrder ? T["order"] : "natural"; start: T["start"] extends readonly unknown[] ? T["start"] : []; end: T["end"] extends readonly unknown[] ? T["end"] : []; offset: T["offset"] extends PropertyKey ? T["offset"] : "key"; recurse: T["recurse"] extends number | boolean ? T["recurse"] : false; } /** * **ToKv**`` * * Type utility which receives a Dictionary based object and converts * it to a tuple of `KeyValue` objects. * * ```ts * // [ {key: "id", value: 123 }, {key: "foo", value: "bar" } ] * type Arr = ToKv<{ id: 123, foo: "bar" }>; * ``` * * ### Options * * The optional second generic provides an object hash: * * 1. Sorting * * - by default the "natural order" found in the dictionary is used to * sort the resultant array * - you can, however, "pin" keys to the start or end * - you can also sort the keys in "asc" and "desc" order * - if a sort `order` is provided other than the default of "natural", * the symbol keys will be added to the start and then all string keys * will be sorted in the order specified * - all sorting functionality is provided by the `Sort<...>` utility * * 2. Depth * * - by default the conversion of dictionary objects to an array is only done * at the root level (e.g., values which are dictionaries are left as that type) * - if you would like to _recurse_ into object values you can modify the * `depth` property: * - `true` will recurse infinitely * - any numeric value will cap the depth of recursion to the specified depth * * * **Related:** `KeyValue`, `FromKv`, `toKeyValue()`, `fromKeyValue()` */ type ToKv = IsLiteralLikeObject extends true ? Convert>, readonly ObjectKey[]>, Options> : KeyValue[]; //#endregion //#region src/queues/FifoQueue.d.ts /** * A "First In, First out" queue (**FIFO**) */ interface FifoQueue { queue: TType[]; size: number; /** * reports back a boolean value to indicate whether the queue is empty or not */ isEmpty: () => boolean; /** * pushes additional items into the queue */ push: (...add: T) => void; /** * Drop a number of items from the top of the queue; if * quantity is not provided then 1 item will be dropped. */ drop: (quantity?: T) => void; /** clears the values in the queue */ clear: () => void; /** similar to `clear()` but returns the current queue items before clearing */ drain: () => TType[]; /** * Take 1 or more values from the top of the queue. */ take: (quantity?: T) => FixedLengthArray; [Symbol.iterator]: () => Iterator; } //#endregion //#region src/queues/LifoQueue.d.ts /** * A "Last In, First out" queue (**LIFO**) */ interface LifoQueue { queue: TType[]; size: number; /** * reports back a boolean value to indicate whether the queue is empty or not */ isEmpty: () => boolean; /** * pushes additional items into the queue */ push: (...add: T) => void; /** * Drop a number of items from the top of the queue; if * quantity is not provided then 1 item will be dropped. */ drop: (quantity?: T) => void; /** clears the values in the queue */ clear: () => void; /** similar to `clear()` but returns the current queue items before clearing */ drain: () => TType[]; /** * Take 1 or more values from the top of the queue. */ take: (quantity?: T) => FixedLengthArray; [Symbol.iterator]: () => Iterator; } //#endregion //#region src/regex/EscapeRegex.d.ts type EscapeRegex = AsFromTo<{ ".": "\\."; "*": "\\*"; "+": "\\+"; "?": "\\?"; "^": "\\^"; "$": "\\$"; "{": "\\{"; "}": "\\}"; "(": "\\("; ")": "\\)"; "|": "\\|"; "[": "\\["; "]": "\\]"; "\\": "\\\\"; }>; //#endregion //#region src/regex/ExtractCaptureGroups.d.ts type TemplateSegment = "{{string}}" | "{{number}}" | "{{boolean}}"; type SegmentToType = S extends "{{string}}" ? string : S extends "{{number}}" ? number : S extends "{{boolean}}" ? boolean : never; /** * Extracts the capture groups in a RegExp and their type. */ type IsSubset = T extends `.*(${string}).*` ? true : false; type ExtractCaptureGroups, Acc extends RegexGroupValue[] = []> = TTmpl extends `${infer _Before}{{${infer Segment}}}${infer After}` ? Segment extends "string" | "number" | "boolean" ? ExtractCaptureGroups]> : ExtractCaptureGroups : TSubset extends true ? [string, ...Acc] : Acc; //#endregion //#region src/regex/RegexArray.d.ts type RegexGroupValue = string | number | bigint | boolean | null | undefined; /** * Converts the pseudo Regex (which hasn't been escaped to be "real" regex) * back to the curly braced template blocks expected by the `StringLiteralTemplate` * utility. */ type PrettyRegexToTemplate = AsFromTo<{ "(.+?)": `{{string}}`; "(\\d+)": `{{number}}`; "(true|false)": `{{boolean}}`; }>; /** * Converts from _pretty_ regex to block template mode with `{{string}}`, etc. */ type AsTemplateString$1 = T extends `^${infer Inner}$` ? ReplaceAllFromTo : T extends `.*(${infer Inner}).*` ? `${string}${ReplaceAllFromTo}${string}` : never; type Groups = TStrategy extends "exact" ? ApplyTemplate : TStrategy extends "subset" ? [TValue, StringLiteralTemplate>, ...(ApplyTemplate, false> extends readonly [string, ...infer Rest] ? Rest : [])] : never; type _RegexArray = Expand & Record<"kind", "RegexArray"> & (TStrategy extends "subset" ? Record<"template", StripSurroundingStringTemplate> : Record<"template", TTemplate>) & Record<"matchStrategy", TStrategy> & RegExpExecArray & Record<"input", TValue>>; /*** * **RegexArray**`` * * When you call `exec()` on a regular expression you get a `RegExpExecArray` type * in return. Unfortunately this has no type information but this type tries to solve this. * * - When a successful match is made, the matched expression will be returned in it's entirety * as the first element (aka, index 0) * - the remaining array elements are the matches found within the parenthesis */ type RegexArray< /** the template in a RegExp-like format for human readability */TTemplate extends string, TValue extends string> = _RegexArray, TTemplate extends `.*(${string}` ? "subset" : "exact", TValue> extends infer R ? IsStringLiteral extends true ? TValue extends StringLiteralTemplate> ? R : Err<"no-match"> : R : never; //#endregion //#region src/regex/RegexHandlingStrategy.d.ts /** * **RegexHandlingStrategy** * * Indicating whether the string value representing a `RegExp` should be matched * literally/exactly or whether it should be measured as a _substring_ of some larger * whole. */ type RegexHandlingStrategy = "exact" | "subset"; //#endregion //#region src/regex/RegularExpression.d.ts type RegexToTemplate = AsFromTo<{ "(.+?)": `${string}`; "(\\d+)": `${number}`; "(true|false)": `${boolean}`; }>; type AsTemplateString = T extends `^${infer Inner}$` ? ReplaceAllFromTo : T extends `.*(${infer Inner}).*` ? `${string}${ReplaceAllFromTo}${string}` : never; /** * A typed version of `RegExpExecArray` */ type RegexExecFn = (test: T) => RegexArray; /** * Provides strong typing to the **RegExp**'s `test()` function. * * - knows whether outcome is `true` or `false` if input string is a string literal * - if the input string is wide then result is always just a boolean value */ type RegexTestFn = string extends TInput ? boolean : TInput extends AsTemplateString ? true : false; /** * **RegularExpression**`` * * A `RegExp` created by a runtime utility which adds a `pattern` property * expressing the pattern used for the regular expression in a string literal form. */ type RegularExpression = Omit & { kind: "RegexpArray"; test: (test: T) => RegexTestFn; exec: RegexExecFn; pattern: TLitTemplate; }; //#endregion //#region src/sets/AddIfUnique.d.ts type Merge$1, readonly (PropertyKey & keyof B)[]>> = K extends [infer Head extends PropertyKey & keyof B, ...infer Rest extends readonly (PropertyKey & keyof B)[]] ? Head extends keyof A ? Merge$1 & Record, B, Rest> : Merge$1, B, Rest> : ExpandDictionary; /** * **AddIfUnique**`` * * Adds `TItem` to the end of `TList` if it's type does not * already exist in `TList`. * * - if `TOffset` is used -- _by default it is not_ -- then the * uniqueness comparison will be done on a property offset of * both the `TItem` and the `TList` items. * - when the offset type of `TItem` is found in `TList` then * no new items will be added to `TList` but the matched item * in `TList` will be updated to be a union with `TItem` */ type AddIfUnique = IsNull extends true ? Contains extends true ? TList : [...TList, TItem] : TOffset extends keyof TItem ? Contains, TItem[TOffset]> extends true ? { [K in keyof TList]: TOffset extends keyof TList[K] ? TList[K][TOffset] extends TItem[TOffset] ? Merge$1, As> : TList[K] : TList[K] } : [...TList, TItem] : TList; //#endregion //#region src/sets/DefineModifiers.d.ts /** * **DefineModifiers**`` * * Take a tuple of string literals and converts this into a "modifier" where * any of the defined modifiers can be expressed singularly as a string or as * part of a tuple array of modifiers. */ type DefineModifiers = null | T[number] | readonly (T[number])[]; //#endregion //#region src/sets/HasModifier.d.ts /** * **HasModifier**`` * * Tests whether `T` is defined in the modifiers set `TConfig`. * * - you can optionally include the full modifiers definition to get * type validation for `TTest`. */ type HasModifier[number], TConfig extends readonly string[] | string | null, TDefn extends readonly string[] | string | null = TConfig> = string extends TTest ? boolean : string extends TConfig ? boolean : IsNull extends true ? false : Contains, readonly string[]>, TTest>; //#endregion //#region src/sets/IntersectingKeys.d.ts /** * Efficiently filters tuples by removing never values using direct tail recursion */ type InTuple = A extends readonly [infer Head, ...infer Tail] ? Contains extends true ? InTuple : InTuple : Result; /** * **IntersectingKeys**`` * * Provides a tuple of keys which are shared between the two * containers passed in `A` and `B`. * * - will usable in both arrays and objects, it's more common to * use this with objects. * * **Related:** `Intersection` */ type IntersectingKeys = IsSameContainerType extends true ? A extends readonly unknown[] ? InTuple, NumericKeys>> : A extends Dictionary ? InTuple, readonly ObjectKey[]>, As, readonly ObjectKey[]>> : never : Err<`invalid-comparison/keys`, `The IntersectingKeys utility works when both A and B are the same type of container but that was not the case!`, { a: A; b: B; }>; //#endregion //#region src/sets/Intersection.d.ts /** compare objects with offset property */ type CompareWithOffset = A extends [infer AType, ...infer Rest] ? GetEach extends infer _BOffset extends readonly unknown[] ? O extends keyof AType ? Find$1 extends infer Found extends Dictionary ? CompareWithOffset>]> : CompareWithOffset : CompareWithOffset : never : ExpandDictionary; /** Improved detection for wide container values */ type DetectValues = A extends (infer AT)[] ? B extends (infer BT)[] ? IsLiteralLike extends true ? Each, "isLiteral"> extends true ? UnionFrom[] : A[number][] : IsLiteralLike extends true ? Each, "isLiteral"> extends true ? UnionFrom[] : B[number][] : If, [], (AT & BT)[]> : unknown[] : unknown[]; type CompareArrayValues = AValues extends readonly [infer AHead, ...infer ATail] ? ExistsInArrayExact extends true ? Contains extends true ? CompareArrayValues : CompareArrayValues : CompareArrayValues : Result; type CompareObjectValues = AValues extends readonly [infer AHead, ...infer ATail] ? ExistsInArrayExact extends true ? Contains extends true ? CompareObjectValues : CompareObjectValues : CompareObjectValues : Result; type ExistsInArrayExact = B extends readonly [infer BHead, ...infer BTail] ? IsEqual extends true ? true : ExistsInArrayExact : false; type Process$3 = IsSameContainerType extends true ? IsWideContainer extends true ? IsWideContainer extends true ? IsDictionary extends true ? IsDictionary extends true ? DetectValues, Values> : never : DetectValues, Values> : B extends readonly unknown[] ? UnionFrom[] : never : IsWideContainer extends true ? A extends readonly unknown[] ? UnionFrom[] : never : A extends readonly unknown[] ? B extends readonly unknown[] ? O extends null ? CompareArrayValues : CompareWithOffset> : never : CompareObjectValues, Values> : Err<`invalid-comparison/keys`, `The Intersection utility works when both A and B are the same type of container but that was not the case!`, { a: A; b: B; }>; /** * **Intersection**`` * * Compares the _values_ in `A` and `B` and returns the set of values found in both. * * - the `O` generic allows you to add an _offset_ which will be used on each element in the values * - when an offset is used the result will be an array of that properties value when both * `A` and `B` contain that value. * - this utility _can_ be used on both tuples/arrays and dictionaries but has more utility when * used with tuples/arrays. If you're considering using this with an object consider whether * `IntersectingKeys` might be a better option. * * #### Union Handling * - if both `A` and `B` are union types then the union type itself must be the same * - if one of `A` or `B` is a union type then the intersection type is the type of the * non-union member made to be _optional_ */ type Intersection = Process$3; //#endregion //#region src/sets/Keys.d.ts /** * **Keys**`` * * Provides the _explicit keys_ of a container `TContainer` as an array of values. * * - if the container is wide then the keys will be a wide array type * - if the container is a narrow type then a tuple of literal keys will be returned * * ```ts * type Obj = { foo: 1, bar: 2, [key: string]: unknown }; * type Arr = [1,2,3]; * // readonly ["foo", "bar"] * type K1 = Keys; * // readonly [0,1,2] * type K2 = Keys; * // number[] * type Arr = Keys; * // string[] * type Obj = Record; * ``` * * **Related:** `ValidKey`, `PublicKeys`, `PrivateKeys` */ type Keys$1 = As : ObjectKeys, readonly (PropertyKey | (PropertyKey | undefined))[]>; /** * **WithTemplateKeys**`` * * Produces a tuple of keys where there a combination of * literal keys and then one or more _template_ keys */ type WithTemplateKeys<_TLiteral extends readonly unknown[], _TTemplate extends readonly string[]> = true; type _Public = [] extends TInput ? TOutput : _Public, First$1 extends `_${string}` ? TOutput : [...TOutput, First$1]>; /** * **PublicKeys**`` * * Provides a tuple of _keys_ for `TContainer` but unlike `Keys` it removes any * keys which start with an underscore character. */ type PublicKeys = Keys$1 extends readonly PropertyKey[] ? _Public> : never; /** * **PrivateKey** * * A `PrivateKey` is an object key that is preceded with a `_` character to indicate * that it is a _private_ property. */ type PrivateKey = `_${string}`; /** * **PrivateKeys**`` * * Keys on an object which have a `_` character as first part of the * name are considered private and this utility will create a union * of all the keys in this category. * * **Related:** `PublicKeys`, `Keys`, `PrivateKeyOf` */ type PrivateKeys = { [K in keyof T]: K extends `_${string}` ? K : never }[keyof T]; type _KeyOf = TupleToUnion> extends PropertyKey ? TupleToUnion> extends keyof TContainer ? TupleToUnion> : never : never; /** * **KeyOf**`` * * Provides a **union type** of keys for the passed in container. * * **Related:** `Keys`,`PublicKeys`,`PublicKeyOf` */ type KeyOf = IsWideUnion<_KeyOf> extends true ? "" : As<_KeyOf, string | symbol>; /** * **PublicKeyOf**`` * * Provides a **union type** of _public_ keys (aka, keys not starting with * underscore character) for the passed in container. * * **Related:** `Keys`,`PublicKeys`,`KeyOf` */ type PublicKeyOf = TupleToUnion> extends PropertyKey ? TupleToUnion> extends keyof TContainer ? TupleToUnion> : never : never; /** * **PrivateKeyOf**`` * * Provides a **union type** of _private_ keys (aka, keys starting with * underscore character) for the passed in container. * * **Related:** `Keys`,`PrivateKeys`,`KeyOf` */ type PrivateKeyOf = TupleToUnion> extends PropertyKey ? TupleToUnion> extends keyof TContainer ? TupleToUnion> : never : never; //#endregion //#region src/sets/SetCandidate.d.ts /** * **SetCandidate** * * A _set candidate_ is the base type for a type which can be converted * into a "set" (and have set operations applied). */ type SetCandidate = readonly unknown[] | Narrowable; //#endregion //#region src/sets/Unique.d.ts type Get$1 = IfNever; type Process$2 = [] extends TValues ? TResults : Process$2, TDeref, Push, IsScalar> extends true ? Not>> : Not extends true ? TResults : GetEach>, string | number | readonly unknown[]>, Get$1, TDeref>>>>>; /** * **Unique**`` * * Given a tuple of values, this utility will reduce the tuple to * _unique_ values in the set. * * - If the values are containers themselves, you can provide a `TDeref` * to point to a property which represents the "identity" of that container * - If you're comparing containers _without_ a `TDeref` property * then the full type signature will be used in deduplication * * ```ts * // ["foo", "bar"] * type FooBar = Unique<["foo","foo","bar"]>; * ``` */ type Unique = IfNever>, Process$2>; //#endregion //#region src/sets/UniqueKeys.d.ts /** * **UniqueKeys**`` * * Provides a **LeftRight** tuple which articulates the * _unique_ keys to each container's keys. * * The keys for each sides unique values are represented * a tuple of values. * * ```ts * type Foo = { foo: 1; bar: 2 }; * type Baz = { bar: 5; baz: 42, extra: "why not?" }; * // LeftRight<["foo"], ["baz", "extra"]> * type U = UniqueKeys; * ``` * - the example above with an _object_ container is the primary use case * but it can be used with array's too but please note it is primarily used * in this case to identify how the "longer" array has additional keys: * ```ts * type Short = [1,2]; // length 2 * type Long = [3,4,5,6,7,8,9,10]; // length 8 * // LeftRight<[], [2,3,4,5,6,7]> * type U = UniqueKeys; * ``` * * **Related:** `UniqueKeysUnion` */ type UniqueKeys = LeftRight>>, AsNumberWhenPossible>>>; //#endregion //#region src/sets/UniqueKeysUnion.d.ts /** * **UniqueKeysUnion**`` * * Provides a **LeftRight** tuple which articulates the * _unique_ keys to each container's keys. * * The keys for each sides unique values are represented * as a union type. * * ```ts * type Foo = { foo: 1; bar: 2 }; * type Baz = { bar: 5; baz: 42, extra: "why not?" }; * // [ "foo", "baz" | "extra" ] * type U = UniqueKeys; * ``` * * **Related:** `UniqueKeys` */ type UniqueKeysUnion = LeftRight, Exclude>; //#endregion //#region src/sets/UniqueKv.d.ts /** * **UniqueKv**`` * * Returns a `LeftRight` tuple containing the unique KV pairs found in `L` and `R`. Both `L` and `R` are expect to be an * object type of some sort. * * - this means that if _both_ `L` and `R` have a shared property but the values * are different then they are considered "unique" for each list. * * **Related:** `Unique`, `UniqueKeys` */ type UniqueKv = LeftRight, Exclude>; //#endregion //#region src/take/AsTakeState.d.ts /** * **AsTakeState**`` * * Ensures that if `T` is a _string_ that it's converted to an appropriate * `TakeState`. */ type AsTakeState = As; //#endregion //#region src/take/DropParser.d.ts /** * **DropRulePolicy** * * Determines how the matches to `enter` and `exit` tokens are included in * the **kept** or **dropped** properties: * * - `inclusive` - means that the `enter` and `exit` tokens * will be added to the **kept** property. * - `exclusive` - means the `enter` and `exit` tokens will * will be added to the dropped segments * - `drop-enter` - the `enter` tokens will be dropped * but the `exit` tokens will still be added to the **kept** * property * - `drop-exit` - the `exit` tokens will be dropped but the * `enter` tokens will still be added to the **kept** property */ type DropRulePolicy = "inclusive" | "exclusive" | "drop-enter" | "drop-exit"; /** * A user configurable rule to use with the `dropParser()` utility. * * **Related:** `FinalizedDropRule` */ interface DropRule { /** * the sub-strings which will push the parser _into_ * the "drop" state. */ enter: string | string[]; /** * the sub-strings which will push the parser _into_ * the "keep" state. */ exit: string | string[]; /** * You may optionally choose to state the _matching policy_: * * - `inclusive` - means that the `enter` and `exit` tokens * will be added to the **kept** property. * - `exclusive` - means the `enter` and `exit` tokens will * will be added to the **dropped** segments * - `drop-enter` - the `enter` tokens will be dropped * but the `exit` tokens will still be added to the **kept** * property * - `drop-exit` - the `exit` tokens will be dropped but the * `enter` tokens will still be added to the **kept** property * * By default the **policy** is set to `inclusive`. * * @default "inclusive" */ policy?: DropRulePolicy; } interface DropResult { kind: "drop-result"; kept: string; dropped: string[]; toString: () => string; } /** * looks through rules to find a match and if * there are more than one `enter` or `exit` token(s) * provided in the match, use the _longest_ one as the * "extractor" * * - returns `{ extract: string, rule: Rule }` when found * - otherwise `false` */ type FindLongestMatch = TRules extends [infer Head extends FinalizedDropRule, ...infer Rest extends readonly FinalizedDropRule[]] ? LongestToStartWith extends infer Found extends string ? { extract: Found; rule: Head; } : FindLongestMatch : false; interface Match$1 { /** the extracted string representing a **enter** or **exit** token */ extract: string; /** * if the new state is "drop" then store the entry `Rule` used */ newState: "keep" | FinalizedDropRule; policy: DropRulePolicy; } /** * Looks for a rule that might match the _beginning_ of the * parse string. * * - when a match is found, returns a tuple of: * - `{ newState, extract, policy }` * - the `newState` is either: * - when moving _into_ a **drop** state the matched `DropRule` * - when moving _into_ a **keep** state the string "keep" */ type MatchRule = TState extends "keep" ? FindLongestMatch extends { extract: infer Extract extends string; rule: infer RuleDefn extends FinalizedDropRule; } ? As<{ extract: Extract; newState: RuleDefn; policy: RuleDefn["policy"]; }, Match$1> : false : TState extends { policy: infer Policy extends DropRulePolicy; enter: infer _Enter extends string[]; exit: infer Exit extends string[]; } ? StartsWith extends true ? As<{ extract: As, string>; newState: "keep"; policy: Policy; }, Match$1> : false : never; /** * prevents a trailing empty space in the * "dropped" property. */ type RemoveEmptyDrop = T extends [...infer LeadIn extends readonly string[], infer Last extends string] ? Last extends "" ? LeadIn : T : T; type IsMovingToKeepState = T extends "keep" ? true : false; /** * enforces the policy set for updating the `kept` property */ type PolicyHandlerForKept = TPolicy extends "inclusive" ? IsMovingToKeepState extends true ? `${TKept}${TExtracted}` : `${TKept}${TExtracted}` : TPolicy extends "exclusive" ? IsMovingToKeepState extends true ? TKept : TKept : TPolicy extends "drop-enter" ? IsMovingToKeepState extends true ? `${TKept}${TExtracted}` : TKept : TPolicy extends "drop-exit" ? IsMovingToKeepState extends true ? TKept : `${TKept}${TExtracted}` : never; /** * enforces the policy set for updating the `dropped` property */ type PolicyHandlerForDropped = TPolicy extends "inclusive" ? IsMovingToKeepState extends true ? [...TDropped, ""] : TDropped : TPolicy extends "exclusive" ? IsMovingToKeepState extends true ? [...AppendToLast, ""] : [...TDropped, TExtracted] : TPolicy extends "drop-enter" ? IsMovingToKeepState extends true ? [...TDropped, ""] : [...TDropped, TExtracted] : TPolicy extends "drop-exit" ? IsMovingToKeepState extends true ? [...AppendToLast, ""] : TDropped : never; /** * **AsDropResult**`` * * A type utility which results the runtime's eventual parsing work. * The resultant type will will be a `DropResult` type which exposes: * * - the `kept` property is a string literal representing what * of the original content was "kept". * - the `dropped` property is an array of string literals representing * the parts/sub-strings which were removed. * - due to the inclusion of a `toString()` method, the returned `DropResult` * object can be easily be serialized into the `kept` property which is * typically what people want to extract. */ type AsDropResult = string extends TContent ? DropResult : MatchRule extends { newState: infer NewState extends "keep" | FinalizedDropRule; extract: infer Extracted extends string; policy: infer Policy extends DropRulePolicy; } ? AsDropResult, TRules, NewState, PolicyHandlerForKept, PolicyHandlerForDropped> : TContent extends `${infer Head extends string}${infer Rest}` ? TState extends "keep" ? AsDropResult : AsDropResult> : As<{ kind: "drop-result"; kept: TKept; dropped: RemoveEmptyDrop; toString: () => TKept; }, DropResult>; /** * A finalized `DropRule` */ interface FinalizedDropRule { /** enter tokens */ enter: string[]; /** exit tokens */ exit: string[]; /** token policy */ policy: DropRulePolicy; } /** KV component of `DropParser` */ interface DropParserKv { kind: "drop-parser"; rules: T; kept: string; dropped: string[]; } /** function component of `DropParser` */ type DropParserFn = (content: U) => AsDropResult; /** * **DropParser**`` * * A configured drop parser ready for content to be parsed. */ type DropParser = DropParserKv & DropParserFn; //#endregion //#region src/take/TakeParser.d.ts /** * **TakeParser** * * A parser function that is provided a `Take` state and must convert that into: * * 1. When able to parse the head of the parse string successfully: `[ taken: string, parsed: [State["parsed"], T] ]` * 2. When parser is not able to parse the head of the string: `[ taken: "", parsed: State["parsed"] ]` * 3. If parser engages to parse the head of the parse string but see's a structural problem with the input, * a tuple of the type `[ null, Error ]` should be returned. */ type TakeParser = (parse: T) => [taken: string, parsed: readonly unknown[]] | [null, Error]; //#endregion //#region src/take/TakeStart.d.ts type GetMatch = TMatch extends [infer Head extends string, ...infer Rest extends readonly string[]] ? StartsWith extends true ? Head : GetMatch : null; /** * **TakeStartCallback** * * A callback which receives the _matched value_ and the current state (as a `TakeState` object) * and must return an updated `TakeState` or */ type TakeStartCallback = (match: TMatch, state: TState) => TakeState | Err<"skip"> | Err<"no-token"> | Err<"invalid-token">; type TakeStartMatches__Callback = readonly [TakeStartCallback, string, ...readonly string[]]; type TakeStartMatches__Mapper = readonly [Dictionary]; type TakeStartMatches__Default = readonly [string, ...readonly string[]]; type TakeStartMatchesKind = "callback" | "mapper" | "default"; type TakeStartMatches = IsUnion extends true ? TakeStartMatches__Callback | TakeStartMatches__Mapper | TakeStartMatches__Default : T extends "callback" ? TakeStartMatches__Callback : T extends "mapper" ? TakeStartMatches__Mapper : T extends "default" ? TakeStartMatches__Default : never; /** * get the list of string literals which we are trying to match on */ type GetMatches = T extends TakeStartMatches<"callback"> ? Slice : T extends TakeStartMatches<"mapper"> ? StringKeys : T extends TakeStartMatches<"default"> ? T : never; /** * get's a lookup dictionary for when a "mapper" style is being used */ type GetLookup = T extends TakeStartMatches<"mapper"> ? T[0] : EmptyObject; /** * get's a callback function */ type GetCallback = T extends TakeStartMatches<"callback"> ? T[0] extends infer Callback extends TakeStartCallback ? Callback : Err<"invalid-callback", `The callback provided to the takeStart() utility was invalid. It must extend the type TakeStartCallback!`, { callback: T[0]; }> : (val: string, state: S) => S; type GetVariant = T extends TakeStartMatches<"callback"> ? "callback" : T extends TakeStartMatches<"mapper"> ? "mapper" : T extends TakeStartMatches<"default"> ? "default" : "invalid"; type GetToken = GetMatches extends infer Matches extends readonly string[] ? GetMatch extends infer Match extends string ? M extends TakeStartMatches<"callback"> ? FnReturn> extends TakeState ? FnReturn>["tokens"] : "shit" : M extends TakeStartMatches<"mapper"> ? GetLookup extends infer Lookup extends Dictionary ? Lookup[Match] extends [unknown, infer IT extends InputToken] ? FromInputToken extends Error ? Err<"invalid-token", `a takeStart() based function which used a token mapper had a problem with the key '${Match}'. When a user maps to a tuple, the second parameter is an InputToken but in this case the input token could not be parsed!`, { mapper: Lookup; }> : ["result", FromInputToken] : Lookup[Match] : never : M extends TakeStartMatches<"default"> ? Match : Err<"invalid-token/bad-match-type"> : Err<"no-match", `The variant type for the match types could not be matched to 'default', 'mapper', or 'callback'!`, { config: M; content: T; matches: Matches; }> : Err<`invalid-config`, `The match configuration used in the takeStart() utility is not valid!`, { config: M; }>; /** * **TakeStartFn**`(value) => TakeState | Error` * * A partial application of the `takeStart()` utility. * * - the match configuration is complete, * - ready for passing in values to start parsing */ type TakeStartFn = ((value: U) => TakeStart) & { variant: GetVariant; matches: GetMatches; }; /** * **TakeStart**`` * * Attempts to find any of the string literals in `TMatch` at the head of the * parse string. */ type TakeStart = As extends infer State extends TakeState ? GetMatches extends infer Matches extends readonly string[] ? StartsWith extends true ? GetMatch extends infer Match extends Matches[number] ? GetToken extends Error ? GetToken : { kind: "TakeState"; parsed: [...State["parsed"], Match]; parseString: StripLeading; tokens: [...State["tokens"], GetToken]; } : State : never : never : never, TakeState | Error>; //#endregion //#region src/take/TakeState.d.ts interface TakeState { kind: "TakeState"; /** the segments of the parse string that were previously parsed */ parsed: string[]; /** the remaining _parse string_ after the **take** function parsed a section of it */ parseString: string; /** the tokens which have been parsed from the string so far */ tokens: T[]; } //#endregion //#region src/take/UpdateTake.d.ts /** * **UpdateTake**`` * * Updates an existing **TakeState** `TState` by: * * - the `TParsed` generic must always be a _string_ and will represent the "parsed" value * as well as the substring which will be removed from the `parseString` property * - the `TToken` generic -- when set -- will be what is added to the `tokens` property * - when `TToken` is not set it's value is set to `TToken` */ type UpdateTake = As<{ kind: "TakeState"; parsed: [...TState["parsed"], TParsed]; parseString: StripLeading; tokens: [...TState["tokens"], TToken]; }, TakeState>; //#endregion //#region src/unions/CapitalizeEachUnionMember.d.ts type Process$1 = [] extends T ? R[number] : Process$1, [...R, First$1 extends string ? Capitalize> : First$1]>; /** * **CapitalizeEachUnionMember**`` * * Capitalizes all string-derived union members in a union. */ type CapitalizeEachUnionMember = IsUnion extends true ? Process$1> : T extends string ? Capitalize : T; //#endregion //#region src/unions/OneOf.d.ts type MergeTypes = TTypes extends [infer Head, ...infer Rest] ? MergeTypes : TResult; type OnlyFirst = T & { [K in keyof Omit]?: never }; type _OneOf, TResult = never> = T extends [infer Head, ...infer Rest] ? _OneOf> : TResult; /** * **OneOf**`` * * Creates an _exclusive_ union between types of `T`. */ type OneOf = _OneOf; //#endregion //#region src/unions/Success.d.ts /** * **Sucess**`` * * Removes an Error from `T` where an error is part of the union * type of `T`; otherwise has no impact on the type. */ type Success$1 = Exclude; //#endregion //#region src/unions/UnionFilter.d.ts type RemoveEmptyObject = [] extends T ? RemoveNever[number] : RemoveEmptyObject, [...R, First$1 extends Dictionary ? Equals>["length"], number> extends true ? never : First$1 : First$1]>; /** * **UnionFilter**`` * * A type utility which receives a union type `U` and then eliminates * all elements of the union which _extend_ `E`. * * **Note:** _this is very much like `Exclude` utility but can handle * unions of containers as well as just scalar values._ * * **Related:** `UnionRetain` */ type UnionFilter = [U] extends [never] ? never : IsUnion extends true ? Some, "extends", EmptyObject> extends true ? Exclude>, RemoveEmptyObject>> : Exclude : U; //#endregion //#region src/unions/UnionFrom.d.ts /** * **UnionFrom**`` * * Creates a union type from the potential _values_ of a container. * * - you may optionally specify the `U` generic which represents the * "offset" to use. * - In cases where it set it will expect the root container's _values_ to be containers * themselves and the union will _offset_ by the index provided in `O`. */ type UnionFrom = T extends readonly unknown[] ? IsNull extends true ? T[number] : GetEach extends readonly unknown[] ? GetEach[number] : never : IsDictionary extends true ? IsNull extends true ? Values extends readonly unknown[] ? Values[number] : never : Err<`invalid-offset`, `The UnionFrom received an 'offset' value in the U generic. This feature is intended for tuples not objects!`, { container: T; offset: U; }> : never; //#endregion //#region src/unions/UnionMutate.d.ts type UnionMutationOp = "Capitalize" | "Lowercase" | "Uppercase" | "CamelCase" | "PascalCase" | "SnakeCase" | "KebabCase" | "Required"; type Mutate = TOp extends "Capitalize" ? { [K in keyof TElements]: TElements[K] extends string ? Capitalize : TElements[K] } : TOp extends "Uppercase" ? { [K in keyof TElements]: TElements[K] extends string ? Uppercase : TElements[K] } : TOp extends "Lowercase" ? { [K in keyof TElements]: TElements[K] extends string ? Lowercase : TElements[K] } : TOp extends "CamelCase" ? { [K in keyof TElements]: TElements[K] extends string ? CamelCase : TElements[K] } : TOp extends "PascalCase" ? { [K in keyof TElements]: TElements[K] extends string ? PascalCase : TElements[K] } : TOp extends "KebabCase" ? { [K in keyof TElements]: TElements[K] extends string ? KebabCase : TElements[K] } : TOp extends "SnakeCase" ? { [K in keyof TElements]: TElements[K] extends string ? SnakeCase : TElements[K] } : TOp extends "Required" ? NotFilter extends readonly unknown[] ? NotFilter : never : never; /** * **UnionMutate**`` * * Mutates `T` if it is a union, if it is not a union it passed through as is. * * Mutation operations include: * * - Capitalize, Lowercase * - CamelCase, PascalCase, KebabCase, SnakeCase * - Required (removed `undefined` in a union) */ type UnionMutate = [T] extends [never] ? never : IsUnion extends true ? Mutate, Op>[number] : T; //#endregion //#region src/validation/ValidateCharacterSet.d.ts type Test$2 = T extends `${infer Head extends string}${infer Rest}` ? Head extends U ? Test$2 : false : true; /** * **ValidateCharacterSet**`` * * Validates that `TContent` only has the characters found in `TCharset`: * * - if valid, `TContent` is proxied through "as is" * - if invalid, `E` is returned (which defaults to an error type of * "invalid-character" */ type ValidateCharacterSet> = string extends TContent ? TContent | E : string extends TCharset ? boolean : IsEqual extends true ? boolean : Test$2 extends true ? TContent : E extends Err<"invalid-character"> ? StripChars extends infer InvalidChars extends string ? Err<"invalid-character", `The content passed into ValidateCharacterSet had ${Length} character(s) which did not fit into the target character set!`, { invalid: Unique>; content: TContent; }> : never : E; //#endregion //#region src/validation/ValidateLength.d.ts type ValidateLengthOptions = { min: number; } | { max: number; } | { min: number; max: number; }; type ValidateMin = "min" extends keyof O ? O["min"] extends infer Min extends number ? IsGreaterThanOrEqual : never : true; type ValidateMax = "max" extends keyof O ? O["max"] extends infer Max extends number ? IsLessThanOrEqual : never : true; type NotMatched; max: IndexOf; }> = ValidateMin, O> extends false ? Err<`invalid-length/min`, T extends string ? `The string '${T}' is required to have a minimum of ${Opt["min"]} characters but had a length of ${Length}!` : T extends number ? `The number '${T}' is required to have a minimum of ${Opt["min"]} numeric digits (negative sign and decimal place marker are not counted) but had a length of ${Length}!` : T extends readonly unknown[] ? `The array '${ToStringLiteral__Array}' is required to have a minimum of ${Opt["min"]} elements but had a length of ${Length}!` : never, { content: T; options: Opt; length: Length; min: Opt["min"]; }> : ValidateMax, O> extends false ? Err<`invalid-length/max`, T extends string ? `The string '${T}' is required to have a maximum of ${Opt["max"]} characters but had a length of ${Length}!` : T extends number ? `The number '${T}' is required to have a maximum of ${Opt["max"]} numeric digits (negative sign and decimal place marker are not counted) but had a length of ${Length}!` : T extends readonly unknown[] ? `The array '${ToStringLiteral__Array}' is required to have a maximum of ${Opt["max"]} elements but had a length of ${Length}!` : never, { content: T; options: Opt; length: Length; max: Opt["max"]; }> : never; type Test$1 = [ValidateMin] extends [true] ? [ValidateMax] extends [true] ? T : NotMatched : NotMatched; /** * **ValidateLength**`` * * Tests whether the content in `T` has a length that matches the * constraints of `O`. The `O` generic: * * - provides a `min` property to set a minimum length * - provides a `max` property to set a maximum length * * If `T` does not match the constraints imposed by `O` then * a `Err` error will be returned. * * **Note:** the length of a number passed in refers to the number of * _numeric digits_. This means that characters like `-` or `.` which * might be present in a negative or floating point number are NOT counted. * * ```ts * // "foobar" * type Foobar = ValidateLength<"foobar", { max: 10 }>; * // Err<"invalid-type/max"> * type NotFoobar = Validate<"foobar", { min: 3; max: 4 }>; * ``` */ type ValidateLength = T extends readonly unknown[] ? [IsWideArray] extends [true] ? T | Err<`invalid-length/${"min" | "max"}`> : Test$1 : T extends string ? string extends T ? T | Err<`invalid-length/${"min" | "max"}`> : Test$1, O> : T extends number ? ValidateLength<`${T}`, O> extends `${number}` ? AsNumber> : ValidateLength<`${T}`, O> : never; //#endregion export { Abs, AbsMaybe, Acceleration, AccelerationMetrics, AccelerationUom, Add, AddIfUnique, AddKeyValue, AddPositive, AddUrlPathSegment, AfterFirst, AfterFirstChar, AfterLast, AllCaps, AllExtend, AllLengthOf, AllLiteral, AllNumericLiterals, AllOptionalElements, AllStringLiterals, AlphaChar, AlphanumericChar, AmazonUrl, AmericanExpress, And, AnyArray, AnyFunction, AnyMap, AnyObject, AnyQueryParams, AnySet, AnyWeakMap, Api, ApiCallback, ApiConfig, ApiEscape, ApiHandler, ApiOptions, ApiReturn, ApiState, ApiStateInitializer, ApiSurface, Append, AppendRight, AppendToLast, AppleUrl, ApplyCssHexShorthand, ApplyTemplate, AreIncompatible, AreSameLength, AreSameType, Area, AreaMetrics, AreaUom, ArgUnion, AriaDocStructureRoles, AriaLandmarkRoles, AriaLiveRegionRoles, AriaRole, AriaWidgetRoles, AriaWindowRoles, ArrayElementType, ArrayTo, ArrayToString, ArrayTypeDefn, As, AsApi, AsArray, AsBoolean, AsChoice, AsContainer, AsDateMeta, AsDefined, AsDictionary, AsDoneFn, AsDropResult, AsEscapeFunction, AsFinalizedConfig, AsFnMeta, AsFourDigitYear, AsFromTo, AsFunction, AsHtmlComponentTag, AsHtmlTag, AsIndexOf, AsInputToken, AsLeft, AsLeftRight, AsLiteralTemplate, AsNarrowingFn, AsNegativeNumber, AsNestingApi, AsNestingConfig, AsNonNull, AsNumber, AsNumberWhenPossible, AsNumericArray, AsObject, AsObjectKey, AsObjectKeys, AsOptionalParamFn, AsOutputToken, AsPropertyKey, AsRecord, AsRef, AsRelativeDate, AsRgbObject, AsRgbTuple, AsRgbaObject, AsRight, AsSimpleType, AsSomething, AsStaticFn, AsStaticTemplate, AsString, AsStringUnion, AsTakeState, AsTemplateType, AsTemplateTypes, AsTuple, AsTwoDigitMonth, AsTypeSubtype, AsUnion, AsUnionToken, AsVueComputedRef, AssertAssertionError, AssertContains, AssertEqual, AssertEquals, AssertError, AssertExtends, AssertFalse, AssertNotEqual, AssertSameValues, AssertTrue, AssertValidation, AssertionError, AssertionMapper, AssertionOp, AsyncFunction, Asynchronous, AustralianNewsCompanies, AustralianNewsUrls, AvailableConverters, Awaited$1 as Awaited, BCP47, BackTick, BareCssSelector, BaseType, BaseTypeToken, BeforeLast, BelgianNewsCompanies, BelgianNewsUrls, BespokeLiteral, BespokeUnion, BestBuyUrl, BooleanLike, BooleanSort, BooleanSortOptions, Box, Bracket, BracketAndQuoteNesting, BracketNesting, Brand, BrandSymbol, Break$1 as Break, BuildDefinition, CSV, Callback, CamelCase, CamelKeys, CanadianNewsCompanies, CanadianNewsUrls, CapFirstAlpha, CapitalizeEachUnionMember, CapitalizeWords, Cardinality, Cardinality0, Cardinality1, CardinalityExplicit, CardinalityFilter0, CardinalityFilter1, CardinalityIn, CardinalityInput, CardinalityNode, CardinalityOut, CargoDependency, CargoToml, Char$1 as Char, CharCount, Chars, ChewyUrl, ChineseNewsCompanies, ChineseNewsUrls, Choice, ChoiceApi, ChoiceApiConfig, ChoiceApiOptions, ChoiceBuilder, ChoiceCallback, ChoiceValue, ClosingBracket, ClosingMark, ClosingMarkPlus, CodePointOf, ColorFnOptOpacity, ColorFnValue, ColorParam, CombinedKeys, CommonHtmlElement, Comparator, Compare, CompareNumbers, ComparisonAccept, ComparisonDesc, ComparisonFn, ComparisonLookup, ComparisonMode, ComparisonOpConfig, ComparisonOperation, ComparisonParamConvert, ComparisonParamConvert__List, ComparisonParamConvert__Unit, Concat, ConfigDefinition, ConfiguredMap, Consonant, Consonants, ConstrainObject, ConstrainedObjectCallback, ConstrainedObjectIdentity, Constructor, Container, ContainerBlockKey, ContainerKeyGuarantee, Contains, ContainsAll, ContainsSome, Continent, Conversion, ConvertTypeOf, ConvertWideTokenNames, ConverterCoverage, ConverterDefn, CostCoUrl, CostcoUrl, Count$1 as Count, CountryPhoneNumber, Cr, CrThenIndent, CreateChoice, CreateKV, CreateLookup, CreditCard, CssAbsolutionPositioningProperties, CssAlignContent, CssAlignItems, CssAlignProperties, CssAlignSelf, CssAnimation, CssAnimationComposition, CssAnimationDelay, CssAnimationDirection, CssAnimationDuration, CssAnimationFillMode, CssAnimationIterationCount, CssAnimationPlayState, CssAnimationProperties, CssAnimationTimingFunction, CssAppearance, CssAspectRatio, CssBackdropFilter, CssBackgroundProperties, CssBorderCollapse, CssBorderImageRepeat, CssBorderImageSource, CssBorderInlineSizing, CssBorderProperties, CssBorderStyle, CssBorderWidth, CssBoxAlign, CssBoxDecorationBreak, CssBoxProperties, CssBoxShadow, CssBoxSizing, CssBreak, CssBreakInside, CssBreakProperties, CssCalc, CssClamp, CssClassSelector, CssColor, CssColorFn, CssColorLight, CssColorMix, CssColorMixLight, CssColorModel, CssColorSpace, CssColorSpacePrimary, CssContent, CssCursor, CssDefinition, CssDisplay, CssDisplayStatePseudoClasses, CssFlex, CssFlexBasis, CssFlexDirection, CssFlexFlow, CssFlexGrow, CssFlexShrink, CssFloat, CssFontFamily, CssFontFeatureSetting, CssFontKerning, CssFontLanguageOverride, CssFontPalette, CssFontProperties, CssFontStyle, CssFontSynthesis, CssFontWeight, CssFontWidth, CssFunctionalPseudoClass, CssGap, CssGlobal, CssHangingPunctuation, CssHexColor, CssHsb, CssHsl, CssIdSelector, CssImageOrientation, CssImageRendering, CssImageResolution, CssInputPseudoClasses, CssJustifyContent, CssJustifyItems, CssJustifyProperties, CssJustifySelf, CssKeyframeTimestamp, CssKeyframeTimestampSuggest, CssLetterSpacing, CssLinguisticPseudoClasses, CssListStyle, CssLocationPseudoClasses, CssMargin, CssMarginBlock, CssMarginBlockEnd, CssMarginBlockStart, CssMarginBottom, CssMarginInline, CssMarginInlineEnd, CssMarginInlineStart, CssMarginLeft, CssMarginProperties, CssMarginRight, CssMarginTop, CssMixBlendMode, CssNamedColor, CssNamedColorLookup, CssNamedSizes, CssObjectFit, CssObjectPosition, CssOffsetDistance, CssOffsetPath, CssOffsetPosition, CssOffsetProperties, CssOkLch, CssOpacity, CssOutline, CssOutlineColor, CssOutlineOffset, CssOutlineProperties, CssOutlineStyle, CssOutlineWidth, CssOverflowAnchor, CssOverflowBlock, CssOverflowClipMargin, CssOverflowInline, CssOverflowProperties, CssOverflowX, CssOverflowY, CssPadding, CssPaddingBlock, CssPaddingBlockEnd, CssPaddingBlockStart, CssPaddingBottom, CssPaddingInline, CssPaddingInlineEnd, CssPaddingInlineStart, CssPaddingLeft, CssPaddingProperties, CssPaddingRight, CssPaddingTop, CssPerspectiveOrigin, CssPlaceContent, CssPlaceItems, CssPlaceProperties, CssPlaceSelf, CssPointerEvent, CssPosition, CssProperty, CssPseudoClass, CssPseudoClassDefn, CssResourceStatePseudoClasses, CssRgb, CssRgba, CssRotation, CssRound, CssSelector, CssSizing, CssSizingFunction, CssSizingLight, CssStroke, CssStrokeDasharray, CssStrokeProperties, CssTagSelector, CssTextAlign, CssTextDecorationLine, CssTextDecorationStyle, CssTextIndent, CssTextJustify, CssTextOrientation, CssTextOverflow, CssTextPosition, CssTextProperties, CssTextRendering, CssTextTransform, CssTextWrap, CssTextWrapMode, CssTextWrapStyle, CssTimePseudoClasses, CssTiming, CssTransform, CssTransformBox, CssTransformOrigin, CssTransformProperties, CssTransformStyle, CssTranslate, CssTranslateFn, CssTreePseudoClasses, CssUserActionPseudoClasses, CssVar, CssVarWithFallback, CssWhiteSpace, CssWhiteSpaceCollapse, CssWordBreak, CssWritingMode, Csv, CsvToJsonTuple, CsvToStrUnion, CsvToTuple, CsvToTupleStr, CsvToUnion, CurrencyChar, Current, CurrentMetrics, CurrentUom, CvsUrl, DEFAULT_MANY_TO_ONE_MAPPING, DEFAULT_ONE_TO_MANY_MAPPING, DEFAULT_ONE_TO_ONE_MAPPING, DanishNewsCompanies, DanishNewsUrls, DashToSnake, DashUppercase, DateLike, DateMeta, DatePlus, DateSeparator, DateSource, DateType, DayJsLike, DaysInMonth, DecomposeMapConfig, Decrement, DefaultManyToOneMapping, DefaultNesting, DefaultOneToManyMapping, DefaultOneToOneMapping, DefaultOptions, DefaultTemplateBlocks, DefineModifiers, DefineObject, DefineObjectApi, DefineObjectWith, DefineStatelessApi, DefineTokenDetail, DefineTuple, Defined, DellUrl, Delta$1 as Delta, DeltaLight, DeployConfig, DialCountryCode, DictChangeValue, Dictionary, DictionaryTypeDefn, Digit$1 as Digit, DigitNonZero, Digital, DigitalLiteral, Digitize, DinersClub, Discover, Distance, DistanceMetrics, DistanceUom, DistinguishEmpty, Divide, DnsName, DockerCompose, DockerDependsOn, DockerService, DoesExtend, DoesNotExtend, DomainName, DoneFnTuple, DotPathFor, DoubleQuote, DropChars, DropLeading, DropParser, DropParserFn, DropParserKv, DropResult, DropRule, DropRulePolicy, DropTrailing, DropVariadic, DropVariadicHead, DropVariadicTail, DutchNewsCompanies, DutchNewsUrls, DynamicSegment, DynamicToken, DynamicTokenApi, Each, EachAsString, EachAsStringLiteralTemplate, EachOperation, EbayUrl, ElementOf, EmSpace, Email, Empty, EmptyObject, EmptyString, EnSpace, EncodingDefinition, EndsWith, EndsWithNumber, Energy, EnergyMetrics, EnergyUom, EnsureKeys, EnsureLeading, EnsureLeadingEvery, EnsureSurround, EnsureTrailing, EntryExceptionRules, EpochInMs, EpochInSeconds, EqualGreaterLessorChar, EqualNotEqualChar, EqualityChar, Equals, Err, ErrContext, ErrMsg, ErrType, EscapeCodeChars, EscapeFunction, EscapeRegex, EscapedSafeEncodingConversion, EsotericHtmlElement, EtsyUrl, Even, EvenNumber, Every, EveryLength, ExcludeIndex, Exif, ExifAttributionInfo, ExifCameraInfo, ExifCompression, ExifContrast, ExifDateTimeInfo, ExifEmbedPolicy, ExifExtraneous, ExifFlashValues, ExifGainControl, ExifGps, ExifLightSource, ExifPhotoContext, ExifPreviewColorSpace, ExifSaturation, ExifSceneCaptureType, ExifSharpness, ExifSubjectDistance, ExitExceptionRules, Expand, ExpandDictionary, ExpandRecursively, ExpandTuple, ExpandUnion, Expect, ExplicitFunction, ExplicitlyEmptyObject, Extends, ExtendsAll, ExtendsEvery, ExtendsNone, ExtendsSome, ExtractCaptureGroups, ExtractOptionalElements, ExtractOptionalKeys, ExtractRequiredElements, Fail, FailFast, FailFastOptions, Fallback, FalsyValue, FifoQueue, FillStringHole, Filter, FilterByNestingLevel, FilterEmptyStrings, FilterEmptyStringsInTerminalPosition, FilterFn, FinalizedDropRule, FinalizedMapConfig, Find$1 as Find, FindFunction, FindMaxLength, First$1 as First, FirstChar, FirstDefined, FirstKey, FirstOfEach, FirstSet, FirstString, FirstValue, FixedLengthArray, Flatten, FlattenUnion, FluentApi, FluentFn, FluentState, FnAllowingProps, FnArgsDefn, FnDefn, FnFrom, FnKeyValue, FnMeta, FnMetaShape, FnPropertiesDefn, FnReturn, FnReturnTypeDefn, FnWithDescription, FnWithProps, FourDigitYear, FrenchNewsCompanies, FrenchNewsUrls, Frequency, FrequencyMetrics, FrequencyUom, FromCsv, FromDefineObject, FromDefineTuple, FromDefn, FromDynamicSegment, FromInputToken, FromInputToken__Object, FromInputToken__String, FromInputToken__Tuple, FromKv, FromLiteralTemplate, FromLiteralTokens, FromMaybeRef, FromNamedDynamicSegment, FromNesting, FromRecordKeyDefn, FromShapeCallback, FromSimpleRecordKey, FromSimpleToken, FromTo, FromTypeDefn, FromWideTokens, FullWidthQuotation, FullyQualifiedUrl, GenericParam, GermanNewsCompanies, GermanNewsUrls, Get, GetBrand, GetComparator, GetComparisonParams, GetDefaultPort, GetEach, GetEscapeFunction, GetExitToken, GetFixedKeys, GetIndexKeys, GetInputToken, GetMonthAbbrev, GetMonthName, GetMonthNumber, GetNextLevelConfig, GetNonVariadicLength, GetOpConfig, GetOptionalElementCount, GetParentConfig, GetPhoneCountryCode, GetPhoneNumberType, GetQueryParameterDynamics, GetRequiredElementCount, GetSeason, GetTemplateBlocks, GetTemplateParams, GetTokenNames, GetTypeOf, GetUrlDynamics, GetUrlPath, GetUrlPathDynamics, GetUrlPort, GetUrlProtocol, GetUrlProtocolPrefix, GetUrlQueryParams, GetUrlSource, GetYear, GetYouTubePageType, GitRef, GithubActionsUrl, GithubInsightPageType, GithubInsightUrl, GithubOrgUrl, GithubRepoBranchesUrl, GithubRepoDiscussionUrl, GithubRepoDiscussionsUrl, GithubRepoIssueUrl, GithubRepoIssuesListUrl, GithubRepoProjectUrl, GithubRepoProjectsUrl, GithubRepoPullRequestUrl, GithubRepoPullRequestsUrl, GithubRepoReleaseTagUrl, GithubRepoReleasesUrl, GithubRepoTagsUrl, GithubRepoUrl, GithubUrl, Grammar, GrammarTypeDefinition, GreaterThan, GreaterThanOrEqual, HairSpace, HandMUrl, Handle, HandleDoneFn, HandleErr, HasAny, HasArray, HasCharacters, HasErrors, HasEscapeFunction, HasEvery, HasFalse, HasFunctionKeys, HasIndex, HasIndexKeys, HasIndexSignature, HasIpAddress, HasModifier, HasNetworkProtocolReference, HasNever, HasNoParameters, HasNonTemplateLiteral, HasOneParameter, HasOptionalElements, HasOptionalElements__Tuple, HasOtherCharacters, HasParameters, HasPhoneCountryCode, HasProp, HasQueryParameter, HasRequiredElements, HasRequiredProps, HasSameKeys, HasSameValues, HasTemplateLiteral, HasTrue, HasTypedFunctionKeys, HasUnionType, HasUppercase, HasUrlPath, HasUrlSource, HasVariadicHead, HasVariadicInterior, HasVariadicParameters, HasVariadicTail, HasWideBoolean, HasWideValues, HaveSameNumericSign, Healthcheck, Hemisphere, HexColor, HexColorToRgbObject, HexColorToRgbTuple, HexToDecimal, HexToDecimalArray, HexadecimalChar, HomeDepotUrl, HtmlBodyElement, HtmlElement, HtmlFrameworkElement, HtmlFunctionalElement, HtmlHeaderElement, HtmlInputElement, HtmlListElement, HtmlMediaElement, HtmlStructuralElement, HtmlSymantecElement, HtmlTableElement, HtmlTag, HtmlTagAtomic, HtmlTagClose, HtmlTagOpen, Html__AtomicTag, Html__BlockTag, HttpHeader, HttpHeaders, HttpHeadingKeys, HttpVerb, HttpVerbsWithBody, HttpVerbsWithoutBody, IP6Multicast, IP6Unicast, ISO639_2, ISO639_3, IT_AtomicToken, IT_BooleanLiteralToken, IT_Combinators, IT_Failure, IT_Generics, IT_KvType, IT_NumericLiteralToken, IT_Parameter, IT_ParameterResults, IT_StringLiteralToken, IT_TakeArray, IT_TakeAtomic, IT_TakeFunction, IT_TakeGenerator, IT_TakeGroup, IT_TakeIntersection, IT_TakeKind, IT_TakeKvObjects, IT_TakeLiteralArray, IT_TakeNumericLiteral, IT_TakeObjectLiteral, IT_TakeOutcome, IT_TakeParameters, IT_TakePromise, IT_TakeSet, IT_TakeStringLiteral, IT_TakeTokenGeneric, IT_TakeTokenGenerics, IT_TakeUnion, IT_Token, IT_Token_Array, IT_Token_Atomic, IT_Token_Base, IT_Token_Function, IT_Token_Generator, IT_Token_Group, IT_Token_Intersection, IT_Token_Kv, IT_Token_Literal, IT_Token_Literal_Array, IT_Token_Object_Literal, IT_Token_Promise, IT_Token_Set, IT_Token_Union, IT_TupleToOutputToken, IanaAfrica, IanaAmerica, IanaAntarctica, IanaAsia, IanaEurope, IanaPacific, IanaZone, IanaZoneArea, IdentityFn, IdentityFunction, IdeographicSpace, If, IfAllExtend, IfAllLiteral, IfEqual, IfEquals, IfLeft, IfLength, IfLiteralKind, IfNever, IfUnset, IfUnsetOrUndefined, IkeaUrl, ImgFormat, ImgFormatWeb, Immutable, InBetween, InBetweenOptions, Increment, Indent, Indent2, Indent4, IndentSpaces, IndentTab, IndexOf, Indexable, IndexableObject, IndianNewsCompanies, IndianNewsUrls, InlineSvg, InputToken, InputTokenSuggestions, InputToken__SimpleTokens, Integer, IntegerBrand, InternationalPhoneNumber, IntersectingKeys, Intersection, IntersectionToTuple, IntoTemplate, Inverse, InvertNumericSign, Ip4Address, Ip4AddressLike, Ip4Netmask16, Ip4Netmask24, Ip4Netmask32, Ip4Netmask8, Ip4NetmaskSuggestion, Ip4Octet, Ip4Subnet, Ip4SubnetLike, Ip6Address, Ip6AddressFull, Ip6AddressLike, Ip6Group, Ip6GroupExpansion, Ip6Loopback, Ip6Subnet, Ip6SubnetLike, IsAfter, IsAllCaps, IsAllLowercase, IsAlphanumeric, IsAmericanExpress, IsAny, IsAnyEqual, IsArray, IsAtomicTag, IsBalanced, IsBefore, IsBetweenExclusively, IsBetweenInclusively, IsBoolean, IsBooleanLike, IsBooleanLiteral, IsBranded, IsCapitalized, IsComputedRef, IsContainer, IsCreditCard, IsCssHexadecimal, IsCssRgbString, IsCsv, IsDateLike, IsDayJs, IsDefaultNumericPercentage, IsDefined, IsDictionary, IsDictionaryDefinition, IsDomainName, IsDotPath, IsDoubleLeap, IsEmpty, IsEmptyArray, IsEmptyContainer, IsEmptyObject, IsEmptyString, IsEntryToken, IsEpochInMilliseconds, IsEpochInSeconds, IsEqual, IsErrMsg, IsError, IsEscapeFunction, IsExitToken, IsFalse, IsFalsy, IsFloat, IsFnWithDictionary, IsFourDigitYear, IsFunction, IsGreaterThan, IsGreaterThanOrEqual, IsHexColor, IsHexadecimal, IsHtmlClosingTag, IsInputToken, IsInputTokenSuccess, IsInteger, IsIp4Address, IsIp4Octet, IsIp6Address, IsIp6HexGroup, IsIpAddress, IsIsoDate, IsIsoDateTime, IsIsoFullDate, IsIsoFullDateTime, IsIsoMonthDate, IsIsoTime, IsIsoYear, IsIsoYearMonth, IsIterable, IsJsDate, IsLeapYear, IsLength, IsLessThan, IsLessThanOrEqual, IsLiteral, IsLiteralContainer, IsLiteralFn, IsLiteralKind, IsLiteralLike, IsLiteralLikeArray, IsLiteralLikeObject, IsLiteralLikeTuple, IsLiteralNumber, IsLiteralObject, IsLiteralScalar, IsLiteralString, IsLiteralTuple, IsLiteralUnion, IsLowerAlpha, IsLuxonDateTime, IsMixedUnion, IsMoment, IsNarrower, IsNarrowingFn, IsNegativeNumber, IsNestingConfig, IsNestingKeyValue, IsNestingMatchEnd, IsNestingTuple, IsNever, IsNonEmptyContainer, IsNonEmptyObject, IsNonLiteralUnion, IsNot, IsNotEqual, IsNothing, IsNull, IsNumber, IsNumberLike, IsNumericArray, IsNumericLiteral, IsObject, IsObjectKeyRequiringQuotes, IsOk, IsOptional, IsPercentage, IsPhoneNumber, IsPositiveNumber, IsReadonlyArray, IsReadonlyObject, IsRequired, IsRgbObject, IsRgbTuple, IsRgbaObject, IsSameContainerType, IsSameDay, IsSameMonth, IsSameMonthYear, IsSameYear, IsScalar, IsSet, IsSingleChar, IsSingleSided, IsSingularNoun, IsStaticFn, IsStaticTemplate, IsStrictEmptyObject, IsStrictPromise, IsString, IsStringLiteral, IsSubstring, IsSymbol, IsTemplateLiteral, IsThenable, IsTrue, IsTruthy, IsTuple, IsTwoDigitDate, IsTwoDigitMonth, IsUndefined, IsUnion, IsUnionArray, IsUniqueSymbol, IsUnitPrimitive, IsUnknown, IsUnset, IsUrl, IsValidDotPath, IsValidIndex, IsVariable, IsVariadicArray, IsVisaMastercard, IsVueRef, IsWhitespace, IsWideArray, IsWideBoolean, IsWideContainer, IsWideNumber, IsWideObject, IsWideScalar, IsWideString, IsWideSymbol, IsWideType, IsWideUnion, IsYouTubePlaylist, IsYouTubeUrl, IsYouTubeVideoUrl, Iso3166Alpha2Lookup, Iso3166Alpha3Lookup, Iso3166CodeLookup, Iso3166CountryLookup, Iso3166_1_Alpha2, Iso3166_1_Alpha3, Iso3166_1_CountryCode, Iso3166_1_CountryName, Iso3166_1_Lookup, Iso3166_1_Token, IsoDate$1 as IsoDate, IsoDate30, IsoDate31, IsoDateTime, IsoFullDate, IsoFullDateTimeLike, IsoModernDoubleLeap, IsoMonthDate, IsoTime, IsoTimeLike, IsoYear, IsoYearMonth, IsolateErrors, IsolatedResults, ItalianNewsCompanies, ItalianNewsUrls, JapaneseNewsCompanies, JapaneseNewsUrls, Jcb, Join, JsDateLike, JsonRxEncodingSpecifier, JsonRxMessageEncoding, JsonRxPayloadEncoding, JsonRxProtocol, JustFunction, KebabCase, KebabKeys, KeyOf, KeyValue, Keys$1 as Keys, KeysEqualValue, KeysNotEqualValue, KeysOverlap, KeysUnion, KeysWithError, KeysWithValue, KeysWithoutValue, KlassMeta, KnownNestingConfig, KrogerUrl, KvFn, KvFnDefn, Last$1 as Last, LastChar, LastOfEach, LeadingNonAlpha, Left$1 as Left, LeftContains, LeftDoubleMark, LeftEquals, LeftExtends, LeftHeavyDoubleTurned, LeftHeavySingleTurned, LeftIncludes, LeftLowDoublePrime, LeftReversedDoublePrime, LeftRight, LeftRight__Operations, LeftSingleMark, LeftWhitespace, Length, LessThan, LessThanOrEqual, LexerDelta, LexerState, LifoQueue, LikeRegExp, List, LiteralFnModifiers, LiteralLikeModifiers, LiteralModifiers, LiteralNumberModifiers, LiteralObjectModifiers, LiteralStringModifiers, LocalPhoneNumber, Locale, LocaleWithSubTag, LoggingOptions, Logic, LogicFunction, LogicHandler, LogicOptions, LogicalCombinator, LogicalReturns, Longest, LongestCommonPrefix, LongestToStartWith, LowerAllCaps, LowerAlphaChar, LowesUrl, Luminosity, LuminosityMetrics, LuminosityUom, LuxonLikeDateTime, LuxonStaticDateTime, MacysUrl, Maestro, MakeKeysOptional, MakeKeysRequired, MakeOptional, MakePropsMutable, MakeRequired, ManyToMany, ManyToOne, ManyToZero, MapCard, MapCardinality, MapCardinalityFrom, MapCardinalityIllustrated, MapConfig, MapCoverage, MapFn, MapFnInput, MapFnOutput, MapIR, MapInput, MapInputFrom, MapKeyDefn, MapKeys, MapKeysOptions, MapOR, MapOutput, MapOutputFrom, MapTo, MapToString, MapValueDefn, MapperApi, MapperOld, Mass, MassMetrics, MassUom, Mastercard, MatchChar, Max$1 as Max, MaxLength, MaxSafeInteger, MaybeRef, Merge, MergeKVs, MergeObjects, MergeScalars, MergeTuples, Metric, MetricCategory, MexicanNewsCompanies, MexicanNewsUrls, MimeTypes, Min$1 as Min, MinLength, MinLengthArray, MinimalDigitDate, MinimalDigitDate__Suffixed, MixObjects, Mod, ModernDoubleLeap, MomentLike, MonthAbbrev, MonthDateDigit, MonthInSeason, MonthName, MonthNumber, MonthNumeric, MultiChoiceCallback, MultipleChoice, Multiply, Mutable, MutableProps, MutablePropsExclusive, NBSP, NamedColor, NamedColorMinimal, NamedColor_Blue, NamedColor_Brown, NamedColor_Cyan, NamedColor_Gray, NamedColor_Green, NamedColor_Orange, NamedColor_Pink, NamedColor_Purple, NamedColor_Red, NamedColor_White, NamedColor_Yellow, NamedDynamicSegment, NamingConvention, Narrow, NarrowContainer, NarrowNonBreakingSpace, NarrowObject, Narrowable, NarrowableDefined, NarrowableScalar, NarrowingFn, NarrowlyContains, NegDelta, Negative, Nest, NestedException, NestedSplit, NestedSplitPolicy, NestedString, Nesting, NestingApi, NestingKeyValue, NestingKeyValueConfig, NestingKeyValueEntry, NestingTuple, NestingTupleConfig, NetworkConfig, NetworkDefinition, NetworkProtocol, NetworkProtocolPrefix, NewsUrls, NextDigit, NikeUrl, NoMatch, NodeCallback, NonAlphaChar, NonArray, NonBreakingSpace, NonNumericKeys, NonStringKeys, NonZeroNumericChar, None, NorwegianNewsCompanies, NorwegianNewsUrls, Not, NotEqual, NotFilter, NotLength, NotNull, Nothing, NpmVersion, NumberLike, NumericChar, NumericChar__NonZero, NumericChar__OneToFive, NumericChar__OneToFour, NumericChar__OneToThree, NumericChar__OneToTwo, NumericChar__ZeroToFive, NumericChar__ZeroToFour, NumericChar__ZeroToOne, NumericChar__ZeroToThree, NumericChar__ZeroToTwo, NumericKeys, NumericRange, NumericSequence, NumericSign, NumericSort, NumericSortOptions, ObjKeyDefn, ObjectApiCallback, ObjectKey, ObjectKeys, ObjectMap, ObjectMapConversion, ObjectMapper, ObjectMapperCallback, ObjectToApi, ObjectToCssString, ObjectToJsString, ObjectToJsonString, ObjectToKeyframeString, ObjectToString, ObjectValuesAsStringLiteralTemplate, OddNumber, OldSchoolHtmlElement, OnPass, OnPassRemap, OneOf, OneToMany, OneToOne, OneToZero, OnlyFixedKeys, OnlyFn, OnlyFnProps, OnlyIndexKeys, OnlyOptional, OpeningBracket, OpeningMark, OpeningMarkPlus, Opt$1 as Opt, OptCr, OptCrThenIndent, OptModifier, OptNumber, OptPercent, OptRecord, OptRequired, OptSpace, OptSpace2, OptSpace4, OptUrlQueryParameters, OptWhitespace, OptWhitespaceAll, OptionalKeys, OptionalKeysTuple, OptionalParamFn, OptionalProps, OptionalSimpleScalarTokens, OptionalSpace, Or, OutputToken, PackageJson, PadEnd, PadStart, ParameterlessFn, ParseDate, ParseInt, ParseTime, ParsedDate, ParsedTime, PascalCase, PascalKeys, Passthrough, PathJoin, PercentChar, Percentage, PhoneAreaCode, PhoneCountryCode, PhoneCountryLookup, PhoneFormat, PhoneNumber, PhoneNumberDelimiter, PhoneNumberType, PhoneNumberWithCountryCode, PhoneShortCode, Pluralize, PlusMinus, Pop, PortMapping, PortSpecifierOptions, Power, PowerMetrics, PowerUom, Precision, Prepend, PrependAll, Pressure, PressureMetrics, PressureUom, PriorDigit, PrivateKey, PrivateKeyOf, PrivateKeys, Process, PromiseAll, Promised, Promisify, PropertyChar, ProtocolOptions, ProxyErr, PublicKeyOf, PublicKeys, Punctuation, Push, QuotationMark, QuotationMarkPlus, QuoteCharacter, QuoteNesting, RGB, RGBA, RawPhoneNumber, ReadonlyKeys, ReadonlyProps, RecKeyVariant, RecVariant, RecordKeyDefn, RecordKeyWideTokens, RecordValueTypeDefn, ReduceValues, RegexArray, RegexExecFn, RegexGroupValue, RegexHandlingStrategy, RegexTestFn, RegularExpression, RegularFn, RelativeUrl, RemoveBoolean, RemoveEmpty, RemoveFnProps, RemoveFromEnd, RemoveFromStart, RemoveHttpProtocol, RemoveIndex, RemoveIndexKeys, RemoveMarked, RemoveNetworkProtocol, RemoveNever, RemovePhoneCountryCode, RemoveUndefined, RemoveUrlPort, RemoveUrlSource, RemoveWhitespace, RenameKey, RenderTime, Repeat, Replace, ReplaceAll, ReplaceAllFromTo, ReplaceAllToFrom, ReplaceBooleanInterpolation, ReplaceFromTo, ReplaceLast, ReplaceNumericInterpolation, ReplaceStringInterpolation, ReplaceType, RepoPageType, RepoSource, RepoUrls, RequireProps, RequiredKeys, RequiredKeysTuple, RequiredProps, RequiredSimpleScalarTokens, Resistance, ResistanceMetrics, ResistanceUom, ResolvedTokenType, RestEndpoint, RestMethod, RetailUrl, RetainAfter, RetainAfterLast, RetainBetween, RetainChars, RetainLiterals, RetainUntil, RetainUntil__Nested, RetainUntil__NestedOptions, RetainWhile, RetainWideTypes, ReturnTypes, ReturnValues, Returns, ReturnsBoolean, ReturnsFalse, ReturnsTrue, Reverse, ReverseLookup, Rfc1812, Rfc1812Like, RgbColor, RgbDecimalString, RgbTuple, RgbaColor, Right$1 as Right, RightContains, RightDoubleMark, RightEquals, RightExtends, RightHeavyDoubleTurned, RightHeavySingleTurned, RightIncludes, RightReversedDoublePrime, RightSingleMark, RightWhitespace, RuntimeTakeFunction, RuntimeUnion, SKeys, SafeDecode, SafeDecodingConversion, SafeDecodingKey__Brackets, SafeDecodingKey__Quotes, SafeDecodingKey__Whitespace, SafeEncode, SafeEncodeEscaped, SafeEncodingConversion, SafeEncodingGroup, SafeEncodingKey__Brackets, SafeEncodingKey__Quotes, SafeEncodingKey__Whitespace, SafeString, Scalar, ScalarCallback, ScalarNotSymbol, Season, Second$1 as Second, SecondOfEach, SecretDefinition, SemanticDependency, SemanticVersion, SerializedData, Set$1 as Set, SetCandidate, SetIndex, SetKey, SetKeyForce, SetKeyStrict, SetKeysTo, SetToString, ShallowBracketAndQuoteNesting, ShallowBracketNesting, ShallowQuoteNesting, Shape, ShapeApi, ShapeApi__Scalars, ShapeCallback, ShapeSuggest, ShapeTupleOrUnion, SharedKeys, Shift, ShiftDecimalPlace, Shortest, SimpleArrayToken, SimpleContainerToken, SimpleDictToken, SimpleMapToken, SimpleScalarToken, SimpleSetToken, SimpleToken, SimpleType, SimpleTypeArray, SimpleTypeDict, SimpleTypeMap, SimpleTypeScalar, SimpleTypeSet, SimpleTypeUnion, SimpleUnionToken, SimplifyObject, SingleQuote, SingularNoun, SingularNounEnding, SizingUnits, Slice, SliceArray, SliceString, SmartMark, SmartMarkPlus, SnakeCase, SnakeKeys, SocialMediaPlatform, SocialMediaProfileUrl, SocialMediaUrl, Solo, Some, SomeEqual, SomeExtend, Something, Sort, SortByKey, SortByKeyOptions, SortByLength, SortOptions, SortOrder, SouthKoreanNewsCompanies, SouthKoreanNewsUrls, SpaceChars, SpanishNewsCompanies, SpanishNewsUrls, SpecialChar, Speed, SpeedMetrics, SpeedUom, Split, Split2, SplitAtVariadic, SplitOnWhitespace, StackFrame, StackTrace, StandardMark, StartsWith, StartsWithNumber, StartsWithTemplateLiteral, StaticFn, StaticTemplateSections, StaticToken, StaticTokenApi, StrLen, StringDelimiter, StringEncoder, StringIsAfter, StringKeys, StringLength, StringLiteralFromTuple, StringLiteralTemplate, StringLiteralToken, StringLiteralType, StringSort, StringSortOptions, StringTokenUtilities, StripAfter, StripAfterLast, StripBefore, StripChars, StripFirst, StripLeading, StripLeadingStringTemplate, StripLeadingTemplate, StripLeftNonAlpha, StripSlash, StripSurround, StripSurrounding, StripSurroundingStringTemplate, StripTrailing, StripTrailingStringTemplate, StripUntil, StripWhile, StrongMap, StrongMapTransformer, StrongMapTypes, StructuredStringType, Subtract, Success$1 as Success, Suggest, SuggestHexadecimal, SuggestIp6SubnetMask, SuggestIpAddress, Sum$1 as Sum, Surround, SwissNewsCompanies, SwissNewsUrls, SymbolKind, SyncFunction, Synchronous, TLD, TSV, TT_Atomic, TT_Container, TT_Function, TT_Set, TT_Singleton, TakeDate, TakeFirst, TakeFunction, TakeHours, TakeLast, TakeMilliseconds, TakeMinutes, TakeMonth, TakeNestedString, TakeNumeric, TakeNumericOptions, TakeOptionalElements, TakeParser, TakeProp, TakeRequiredElements, TakeSeconds, TakeStart, TakeStartCallback, TakeStartFn, TakeStartMatches, TakeStartMatchesKind, TakeStartMatches__Callback, TakeStartMatches__Default, TakeStartMatches__Mapper, TakeState, TakeTimezone, TakeUtility, TakeWrapper, TakeYear, TargetUrl, Temperature, TemperatureMetrics, TemperatureUom, TemplateBlock__BARE, TemplateBlocks, TemplateMap, TemplateMap__Basic, TemplateMap__Generics, TemplateParams, TemporalInstanceLike, TemporalLike, TemporalPlainDateTimeLike, TemporalTimeZoneLike, TemporalZonedDateTimeLike, Test, Thenable, ThinSpace, ThreeDigitMillisecond, TimeMetric, TimeMetrics, TimeUom, TimeZoneExplicit, TimezoneOffset, ToBoolean, ToCSV, ToChoices, ToCsv, ToFn, ToInteger, ToIntegerOp, ToJson, ToJsonArray, ToJsonObject, ToJsonOptions, ToJsonScalar, ToJsonValue, ToKv, ToKvOptions, ToLiteralOptions, ToNumber, ToNumericArray, ToPhoneFormat, ToString, ToStringArray, ToStringLiteral, ToStringLiteral__Array, ToStringLiteral__Object, ToStringLiteral__Scalar, ToStringLiteral__Union, ToUnion, Token$1 as Token, TokenIsStatic, TokenMapper, TokenName, TokenParamsConstraint, TokenResolver, TokenSyntax, TokenType, TokenizeStringLiteral, Tokenizer, Trim, TrimCharEnd, TrimDictionary, TrimEach, TrimEnd, TrimLeft, TrimRight, TrimStart, Truncate, TruncateAtLen, TruthyReturns, Tuple$1 as Tuple, TupleDefn, TupleMeta, TupleRange, TupleToIntersection, TupleToUnion, TurkishNewsCompanies, TurkishNewsUrls, TwChroma, TwChroma100, TwChroma200, TwChroma300, TwChroma400, TwChroma50, TwChroma500, TwChroma600, TwChroma700, TwChroma800, TwChroma900, TwChroma950, TwChromaLookup, TwColor, TwColorOptionalOpacity, TwColorTarget, TwColorWithLuminosity, TwColorWithLuminosityOpacity, TwHue, TwLumi100, TwLumi200, TwLumi300, TwLumi400, TwLumi50, TwLumi500, TwLumi600, TwLumi700, TwLumi800, TwLumi900, TwLumi950, TwLuminosity, TwLuminosityLookup, TwModifier, TwModifier__Core, TwModifier__Order, TwModifier__Reln, TwModifier__Size, TwModifiers, TwNeutralColor, TwSizeResponsive, TwStaticColor, TwTarget__Color, TwTarget__ColorLuminosity, TwTarget__ColorLuminosityWithOpacity, TwTarget__ColorName, TwTarget__ColorWithOptPrefixes, TwTarget__Color__Light, TwVibrantColor, TwoDigitDate, TwoDigitHour, TwoDigitMinute, TwoDigitMonth, TwoDigitSecond, Type$1 as Type, TypeDefaultValue, TypeDefinition, TypeDefn, TypeDefnValidations, TypeGuard, TypeHasDefaultValue, TypeHasUnderlying, TypeHasValidations, TypeIsRequired, TypeKind, TypeKindContainer, TypeKindContainerNarrow, TypeKindContainerWide, TypeKindFalsy, TypeKindLiteral, TypeKindWide, TypeOf, TypeOfArray, TypeOfExtended, TypeOptions, TypeReplace, TypeRequired, TypeStrength, TypeSubtype, TypeToken, TypeTokenAtomics, TypeTokenContainers, TypeTokenDelimiter, TypeTokenFunctions, TypeTokenKind, TypeTokenLookup, TypeTokenSets, TypeTokenSingletons, TypeTokenStart, TypeTokenStop, TypeToken__Boolean, TypeToken__False, TypeToken__Fn, TypeToken__FnSet, TypeToken__Gen, TypeToken__Never, TypeToken__Null, TypeToken__Number, TypeToken__NumberSet, TypeToken__Rec, TypeToken__String, TypeToken__StringSet, TypeToken__True, TypeToken__Undefined, TypeToken__UnionSet, TypeToken__Unknown, TypeTuple, TypeUnderlying, TypedError, TypedFunction, TypedFunctionWithDictionary, TypedParameter, UUID, UUID_Urn, UkNewsCompanies, UkNewsUrls, Unbrand, UnbrandValues, UnderlyingType, UnionArrayToTuple, UnionElDefn, UnionExtends, UnionFilter, UnionFrom, UnionFromProp, UnionHasArray, UnionIncludes, UnionMemberEquals, UnionMemberExtends, UnionMutate, UnionMutationOp, UnionToIntersection, UnionToString, UnionToTuple, UnionToTuple__PreserveBoolean, UnionWithAll, Unique, UniqueKeys, UniqueKeysUnion, UniqueKv, Unset, UntilLast, UntilLastOptions, Uom, UpdateTake, UpperAlphaChar, UpsertKeyValue, Uri, UrlBuilder, UrlOptions, UrlPath, UrlPathChars, UrlPort, UrlQueryParameters, UrlsFrom, UsNewsCompanies, UsNewsUrls, UsPhoneNumber, UsStateAbbrev, UsStateName, ValidKey, Validate, ValidateCharacterSet, ValidateLength, ValidateLengthOptions, ValidateMax, ValidateMin, ValidationFunction, ValueAtDotPath, ValueCallback, ValueOrReturnValue, Values, Variable, VariableChar, VariadicParameterModifiers, VariadicType, Visa, VisaMastercard, Voltage, VoltageMetrics, VoltageUom, Volume, VolumeDefinition, VolumeMapping, VolumeMetrics, VolumeUom, VueComputedRef, VueRef, WalgreensUrl, WalmartUrl, WayFairUrl, WeakMapKeyDefn, WeakMapToString, WeakMapValueDefn, When, WhenErr, WhenNever, WhereLeft, Whitespace, WhitespaceAll, WholeFoodsUrl, WideContainerNames, WideScalarModifiers, WideTokenNames, WideTypeName, Widen, WidenContainer, WidenFn, WidenFunc, WidenFunction, WidenLiteral, WidenScalar, WidenTuple, WidenUnion, WidenValues, WithDefault, WithKeys, WithNumericKeys, WithStringKeys, WithTemplateKeys, WithValue, WithoutKeys, WithoutValue, WrapperFn, Xor, YouTubeCreatorUrl, YouTubeEmbedUrl, YouTubeFeedType, YouTubeFeedUrl, YouTubeHistoryUrl, YouTubeHome, YouTubeLikedPlaylistUrl, YouTubePageType, YouTubePlaylistUrl, YouTubeShareUrl, YouTubeSubscriptionsUrl, YouTubeUrl, YouTubeUsersPlaylistUrl, YouTubeVideoUrl, YouTubeVideosInPlaylist, ZaraUrl, Zero, ZeroToMany, ZeroToOne, ZeroToZero, Zip5, ZipCode, ZipPlus4, ZipToState, _TrimDict }; //# sourceMappingURL=index.d.mts.map