inferred-types 0.53.12 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/constants/dist/index.cjs +218 -216
- package/modules/constants/dist/index.cjs.map +1 -1
- package/modules/constants/dist/index.d.ts +35 -51
- package/modules/constants/dist/index.js +207 -203
- package/modules/constants/dist/index.js.map +1 -1
- package/modules/inferred-types/dist/index.cjs +567 -465
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +597 -451
- package/modules/inferred-types/dist/index.js +545 -447
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +346 -232
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +331 -210
- package/modules/runtime/dist/index.js +335 -227
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.d.ts +233 -192
- package/package.json +1 -8
|
@@ -1071,14 +1071,6 @@ type IsGreaterThanOrEqual<A extends NumberLike, B extends NumberLike> = IsEqual<
|
|
|
1071
1071
|
*/
|
|
1072
1072
|
type IsInteger<T> = [IsNever<T>] extends [true] ? false : [T] extends [NumberLike] ? [IsStringLiteral<`${T}`>] extends [true] ? [HasCharacters<`${T}`, ".">] extends [true] ? false : true : boolean : false;
|
|
1073
1073
|
|
|
1074
|
-
/**
|
|
1075
|
-
* **IsLength**`<T, LEN>`
|
|
1076
|
-
*
|
|
1077
|
-
* Boolean type utility which returns true/false based on whether
|
|
1078
|
-
* the correct length for `T` is specified.
|
|
1079
|
-
*/
|
|
1080
|
-
type IsLength<T, LEN extends number> = T extends readonly unknown[] ? IfEqual<Length<T>, LEN, true, false> : false;
|
|
1081
|
-
|
|
1082
1074
|
type Calc$2<A extends number, B extends number, Count extends 1[] = []> = Count["length"] extends B ? false : Count["length"] extends A ? true : Calc$2<A, B, [...Count, 1]>;
|
|
1083
1075
|
/**
|
|
1084
1076
|
* **IsLessThan**`<A,B>`
|
|
@@ -1289,6 +1281,14 @@ type IsUndefined<T> = T extends undefined ? true : false;
|
|
|
1289
1281
|
*/
|
|
1290
1282
|
type IsUnionArray<T> = T extends readonly any[] ? IsEqual<T["length"], number> extends true ? IsUnion<ElementOf<T>> extends true ? true : false : false : false;
|
|
1291
1283
|
|
|
1284
|
+
/**
|
|
1285
|
+
* **IsUnset**`<T>`
|
|
1286
|
+
*
|
|
1287
|
+
* Boolean operator which reports true/false on whether
|
|
1288
|
+
* `T` is the value `Unset`.
|
|
1289
|
+
*/
|
|
1290
|
+
type IsUnset<T> = IsEqual<T, Unset>;
|
|
1291
|
+
|
|
1292
1292
|
type HasUrlPath<T extends string> = And<[
|
|
1293
1293
|
Not<IsNever<GetUrlPath<T>>>,
|
|
1294
1294
|
Or<[
|
|
@@ -4377,6 +4377,18 @@ declare const WALGREENS_DNS: readonly ["www.walgreens.com"];
|
|
|
4377
4377
|
declare const CVS_DNS: readonly ["www.cvs.com"];
|
|
4378
4378
|
declare const WHOLE_FOODS_DNS: readonly ["www.wholefoodsmarket.com", "www.wholefoodsmarket.co.uk"];
|
|
4379
4379
|
|
|
4380
|
+
declare const SIMPLE_DICT_VALUES: readonly ["string", "number", "boolean", "unknown", "Opt<string>", "Opt<number>", "Opt<boolean>", "Opt<unknown>"];
|
|
4381
|
+
declare const SIMPLE_SET_TYPES: readonly ["string", "number", "boolean", "unknown", "Opt<string>", "Opt<number>", "Opt<boolean>", "Opt<unknown>"];
|
|
4382
|
+
declare const SIMPLE_SCALAR_TOKENS: readonly ["string", "number", `string(${string})`, `number(${number})` | `number(${number},${string})`, "boolean", "true", "false", "null", "undefined", "unknown", "any", "never"];
|
|
4383
|
+
declare const SIMPLE_OPT_SCALAR_TOKENS: readonly ["Opt<string>", "Opt<number>", "Opt<boolean>", "Opt<true>", "Opt<false>", "Opt<null>", "Opt<undefined>", "Opt<unknown>", "Opt<any>", `Opt<string(${string})>` | `Opt<string(${string},${string})>`, `Opt<number(${number})` | `Opt<number(${number},${string})`, "Opt<undefined>"];
|
|
4384
|
+
declare const SIMPLE_UNION_TOKENS: readonly [`union(${string})` | `union(${string},${string})`];
|
|
4385
|
+
declare const SIMPLE_MAP_KEYS: readonly ["string", "number", "Dict", "Dict<string, string>", "Dict<string, number>", "Dict<string, boolean>", "Dict<string, unknown>", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>"];
|
|
4386
|
+
declare const SIMPLE_MAP_VALUES: readonly ["string", "number", "Dict", "Dict<string, string>", "Dict<string, number>", "Dict<string, boolean>", "Dict<string, unknown>", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>", "boolean", "unknown", "undefined", "Dict", "Array", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>", "Dict<string, Opt<unknown>>"];
|
|
4387
|
+
declare const SIMPLE_DICT_TOKENS: readonly ["Dict", "Dict<string, string>", "Dict<string, number>", "Dict<string, boolean>", "Dict<string, unknown>", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>", "Dict<string, Opt<unknown>>", `Dict<{${string}: string}>` | `Dict<{${string}: number}>` | `Dict<{${string}: boolean}>` | `Dict<{${string}: undefined}>` | `Dict<{${string}: never}>` | `Dict<{${string}: unknown}>` | `Dict<{${string}: null}>` | `Dict<{${string}: Opt<string>}>` | `Dict<{${string}: Opt<number>}>` | `Dict<{${string}: Opt<boolean>}>` | `Dict<{${string}: Opt<unknown>}>` | `Dict<{${string}: string(${string})}>` | `Dict<{${string}: number(${number})}>` | `Dict<{${string}: number(${number},${string})}>` | `Dict<{${string}: true}>` | `Dict<{${string}: false}>` | `Dict<{${string}: any}>` | `Dict<{${string}: Opt<true>}>` | `Dict<{${string}: Opt<false>}>` | `Dict<{${string}: Opt<null>}>` | `Dict<{${string}: Opt<undefined>}>` | `Dict<{${string}: Opt<any>}>` | `Dict<{${string}: Opt<string(${string})>}>` | `Dict<{${string}: Opt<string(${string},${string})>}>` | `Dict<{${string}: Opt<number(${number})}>` | `Dict<{${string}: Opt<number(${number},${string})}>`, `Dict<{${string}: string, ${string}: ${string}}` | `Dict<{${string}: number, ${string}: ${string}}` | `Dict<{${string}: boolean, ${string}: ${string}}` | `Dict<{${string}: undefined, ${string}: ${string}}` | `Dict<{${string}: never, ${string}: ${string}}` | `Dict<{${string}: unknown, ${string}: ${string}}` | `Dict<{${string}: null, ${string}: ${string}}` | `Dict<{${string}: Opt<string>, ${string}: ${string}}` | `Dict<{${string}: Opt<number>, ${string}: ${string}}` | `Dict<{${string}: Opt<boolean>, ${string}: ${string}}` | `Dict<{${string}: Opt<unknown>, ${string}: ${string}}` | `Dict<{${string}: string(${string}), ${string}: ${string}}` | `Dict<{${string}: number(${number}), ${string}: ${string}}` | `Dict<{${string}: number(${number},${string}), ${string}: ${string}}` | `Dict<{${string}: true, ${string}: ${string}}` | `Dict<{${string}: false, ${string}: ${string}}` | `Dict<{${string}: any, ${string}: ${string}}` | `Dict<{${string}: Opt<true>, ${string}: ${string}}` | `Dict<{${string}: Opt<false>, ${string}: ${string}}` | `Dict<{${string}: Opt<null>, ${string}: ${string}}` | `Dict<{${string}: Opt<undefined>, ${string}: ${string}}` | `Dict<{${string}: Opt<any>, ${string}: ${string}}` | `Dict<{${string}: Opt<string(${string})>, ${string}: ${string}}` | `Dict<{${string}: Opt<string(${string},${string})>, ${string}: ${string}}` | `Dict<{${string}: Opt<number(${number}), ${string}: ${string}}` | `Dict<{${string}: Opt<number(${number},${string}), ${string}: ${string}}`];
|
|
4388
|
+
declare const SIMPLE_ARRAY_TOKENS: readonly ["Array", "Array<string>", `Array<string(${string})>`, "Array<number>", `Array<number(${number})>` | `Array<number(${number},${string})>`, "Array<boolean>", "Array<unknown>", "Array<Dict>", "Array<Set>", "Array<Map>"];
|
|
4389
|
+
declare const SIMPLE_MAP_TOKENS: readonly ["Map", "Map<string, string>" | "Map<string, number>" | "Map<string, boolean>" | "Map<string, undefined>" | "Map<string, unknown>" | "Map<string, Dict>" | "Map<string, Dict<string, string>>" | "Map<string, Dict<string, number>>" | "Map<string, Dict<string, boolean>>" | "Map<string, Dict<string, unknown>>" | "Map<string, Dict<string, Opt<string>>>" | "Map<string, Dict<string, Opt<number>>>" | "Map<string, Dict<string, Opt<boolean>>>" | "Map<string, Array>" | "Map<string, Dict<string, Opt<unknown>>>" | "Map<number, string>" | "Map<number, number>" | "Map<number, boolean>" | "Map<number, undefined>" | "Map<number, unknown>" | "Map<number, Dict>" | "Map<number, Dict<string, string>>" | "Map<number, Dict<string, number>>" | "Map<number, Dict<string, boolean>>" | "Map<number, Dict<string, unknown>>" | "Map<number, Dict<string, Opt<string>>>" | "Map<number, Dict<string, Opt<number>>>" | "Map<number, Dict<string, Opt<boolean>>>" | "Map<number, Array>" | "Map<number, Dict<string, Opt<unknown>>>" | "Map<Dict, string>" | "Map<Dict, number>" | "Map<Dict, boolean>" | "Map<Dict, undefined>" | "Map<Dict, unknown>" | "Map<Dict, Dict>" | "Map<Dict, Dict<string, string>>" | "Map<Dict, Dict<string, number>>" | "Map<Dict, Dict<string, boolean>>" | "Map<Dict, Dict<string, unknown>>" | "Map<Dict, Dict<string, Opt<string>>>" | "Map<Dict, Dict<string, Opt<number>>>" | "Map<Dict, Dict<string, Opt<boolean>>>" | "Map<Dict, Array>" | "Map<Dict, Dict<string, Opt<unknown>>>" | "Map<Dict<string, string>, string>" | "Map<Dict<string, string>, number>" | "Map<Dict<string, string>, boolean>" | "Map<Dict<string, string>, undefined>" | "Map<Dict<string, string>, unknown>" | "Map<Dict<string, string>, Dict>" | "Map<Dict<string, string>, Dict<string, string>>" | "Map<Dict<string, string>, Dict<string, number>>" | "Map<Dict<string, string>, Dict<string, boolean>>" | "Map<Dict<string, string>, Dict<string, unknown>>" | "Map<Dict<string, string>, Dict<string, Opt<string>>>" | "Map<Dict<string, string>, Dict<string, Opt<number>>>" | "Map<Dict<string, string>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, string>, Array>" | "Map<Dict<string, string>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, number>, string>" | "Map<Dict<string, number>, number>" | "Map<Dict<string, number>, boolean>" | "Map<Dict<string, number>, undefined>" | "Map<Dict<string, number>, unknown>" | "Map<Dict<string, number>, Dict>" | "Map<Dict<string, number>, Dict<string, string>>" | "Map<Dict<string, number>, Dict<string, number>>" | "Map<Dict<string, number>, Dict<string, boolean>>" | "Map<Dict<string, number>, Dict<string, unknown>>" | "Map<Dict<string, number>, Dict<string, Opt<string>>>" | "Map<Dict<string, number>, Dict<string, Opt<number>>>" | "Map<Dict<string, number>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, number>, Array>" | "Map<Dict<string, number>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, boolean>, string>" | "Map<Dict<string, boolean>, number>" | "Map<Dict<string, boolean>, boolean>" | "Map<Dict<string, boolean>, undefined>" | "Map<Dict<string, boolean>, unknown>" | "Map<Dict<string, boolean>, Dict>" | "Map<Dict<string, boolean>, Dict<string, string>>" | "Map<Dict<string, boolean>, Dict<string, number>>" | "Map<Dict<string, boolean>, Dict<string, boolean>>" | "Map<Dict<string, boolean>, Dict<string, unknown>>" | "Map<Dict<string, boolean>, Dict<string, Opt<string>>>" | "Map<Dict<string, boolean>, Dict<string, Opt<number>>>" | "Map<Dict<string, boolean>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, boolean>, Array>" | "Map<Dict<string, boolean>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, unknown>, string>" | "Map<Dict<string, unknown>, number>" | "Map<Dict<string, unknown>, boolean>" | "Map<Dict<string, unknown>, undefined>" | "Map<Dict<string, unknown>, unknown>" | "Map<Dict<string, unknown>, Dict>" | "Map<Dict<string, unknown>, Dict<string, string>>" | "Map<Dict<string, unknown>, Dict<string, number>>" | "Map<Dict<string, unknown>, Dict<string, boolean>>" | "Map<Dict<string, unknown>, Dict<string, unknown>>" | "Map<Dict<string, unknown>, Dict<string, Opt<string>>>" | "Map<Dict<string, unknown>, Dict<string, Opt<number>>>" | "Map<Dict<string, unknown>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, unknown>, Array>" | "Map<Dict<string, unknown>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, Opt<string>>, string>" | "Map<Dict<string, Opt<string>>, number>" | "Map<Dict<string, Opt<string>>, boolean>" | "Map<Dict<string, Opt<string>>, undefined>" | "Map<Dict<string, Opt<string>>, unknown>" | "Map<Dict<string, Opt<string>>, Dict>" | "Map<Dict<string, Opt<string>>, Dict<string, string>>" | "Map<Dict<string, Opt<string>>, Dict<string, number>>" | "Map<Dict<string, Opt<string>>, Dict<string, boolean>>" | "Map<Dict<string, Opt<string>>, Dict<string, unknown>>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<string>>>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<number>>>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, Opt<string>>, Array>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, Opt<number>>, string>" | "Map<Dict<string, Opt<number>>, number>" | "Map<Dict<string, Opt<number>>, boolean>" | "Map<Dict<string, Opt<number>>, undefined>" | "Map<Dict<string, Opt<number>>, unknown>" | "Map<Dict<string, Opt<number>>, Dict>" | "Map<Dict<string, Opt<number>>, Dict<string, string>>" | "Map<Dict<string, Opt<number>>, Dict<string, number>>" | "Map<Dict<string, Opt<number>>, Dict<string, boolean>>" | "Map<Dict<string, Opt<number>>, Dict<string, unknown>>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<string>>>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<number>>>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, Opt<number>>, Array>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, Opt<boolean>>, string>" | "Map<Dict<string, Opt<boolean>>, number>" | "Map<Dict<string, Opt<boolean>>, boolean>" | "Map<Dict<string, Opt<boolean>>, undefined>" | "Map<Dict<string, Opt<boolean>>, unknown>" | "Map<Dict<string, Opt<boolean>>, Dict>" | "Map<Dict<string, Opt<boolean>>, Dict<string, string>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, number>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, boolean>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, unknown>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<string>>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<number>>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, Opt<boolean>>, Array>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<unknown>>>", "WeakMap"];
|
|
4390
|
+
declare const SIMPLE_SET_TOKENS: readonly ["Set", "Set<string>" | "Set<number>" | "Set<boolean>" | "Set<unknown>" | "Set<Opt<string>>" | "Set<Opt<number>>" | "Set<Opt<boolean>>" | "Set<Opt<unknown>>"];
|
|
4391
|
+
|
|
4380
4392
|
declare const SOCIAL_MEDIA: [{
|
|
4381
4393
|
readonly name: "Facebook";
|
|
4382
4394
|
readonly description: "Connect with friends, family, and communities worldwide on one of the largest social networks.";
|
|
@@ -4597,39 +4609,34 @@ declare const TW_MODIFIERS_SIZING: readonly ["sm", "md", "lg", "xl", "2xl"];
|
|
|
4597
4609
|
*/
|
|
4598
4610
|
declare const TYPE_OF: readonly ["string", "number", "boolean", "undefined", "symbol", "bigint", "function", "object"];
|
|
4599
4611
|
|
|
4600
|
-
declare const SIMPLE_DICT_VALUES: readonly ["string", "number", "boolean", "unknown", "Opt<string>", "Opt<number>", "Opt<boolean>", "Opt<unknown>"];
|
|
4601
|
-
declare const SIMPLE_SET_TYPES: readonly ["string", "number", "boolean", "unknown", "Opt<string>", "Opt<number>", "Opt<boolean>", "Opt<unknown>"];
|
|
4602
|
-
declare const SIMPLE_SCALAR_TOKENS: readonly ["string", "number", `string(${string})`, `number(${number})` | `number(${number},${string})`, "boolean", "true", "false", "null", "undefined", "unknown", "any", "never"];
|
|
4603
|
-
declare const SIMPLE_OPT_SCALAR_TOKENS: readonly ["Opt<string>", "Opt<number>", "Opt<boolean>", "Opt<true>", "Opt<false>", "Opt<null>", "Opt<undefined>", "Opt<unknown>", "Opt<any>", `Opt<string(${string})>` | `Opt<string(${string},${string})>`, `Opt<number(${number})` | `Opt<number(${number},${string})`, "Opt<undefined>"];
|
|
4604
|
-
declare const SIMPLE_UNION_TOKENS: readonly [`union(${string})` | `union(${string},${string})`];
|
|
4605
|
-
declare const SIMPLE_MAP_KEYS: readonly ["string", "number", "Dict", "Dict<string, string>", "Dict<string, number>", "Dict<string, boolean>", "Dict<string, unknown>", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>"];
|
|
4606
|
-
declare const SIMPLE_MAP_VALUES: readonly ["string", "number", "Dict", "Dict<string, string>", "Dict<string, number>", "Dict<string, boolean>", "Dict<string, unknown>", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>", "boolean", "unknown", "undefined", "Dict", "Array", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>", "Dict<string, Opt<unknown>>"];
|
|
4607
|
-
declare const SIMPLE_DICT_TOKENS: readonly ["Dict", "Dict<string, string>", "Dict<string, number>", "Dict<string, boolean>", "Dict<string, unknown>", "Dict<string, Opt<string>>", "Dict<string, Opt<number>>", "Dict<string, Opt<boolean>>", "Dict<string, Opt<unknown>>", `Dict<{${string}: string}>` | `Dict<{${string}: number}>` | `Dict<{${string}: boolean}>` | `Dict<{${string}: undefined}>` | `Dict<{${string}: never}>` | `Dict<{${string}: unknown}>` | `Dict<{${string}: null}>` | `Dict<{${string}: true}>` | `Dict<{${string}: false}>` | `Dict<{${string}: Opt<string>}>` | `Dict<{${string}: Opt<number>}>` | `Dict<{${string}: Opt<boolean>}>` | `Dict<{${string}: Opt<unknown>}>` | `Dict<{${string}: string(${string})}>` | `Dict<{${string}: number(${number})}>` | `Dict<{${string}: number(${number},${string})}>` | `Dict<{${string}: any}>` | `Dict<{${string}: Opt<true>}>` | `Dict<{${string}: Opt<false>}>` | `Dict<{${string}: Opt<null>}>` | `Dict<{${string}: Opt<undefined>}>` | `Dict<{${string}: Opt<any>}>` | `Dict<{${string}: Opt<string(${string})>}>` | `Dict<{${string}: Opt<string(${string},${string})>}>` | `Dict<{${string}: Opt<number(${number})}>` | `Dict<{${string}: Opt<number(${number},${string})}>`, `Dict<{${string}: string, ${string}: ${string}}` | `Dict<{${string}: number, ${string}: ${string}}` | `Dict<{${string}: boolean, ${string}: ${string}}` | `Dict<{${string}: undefined, ${string}: ${string}}` | `Dict<{${string}: never, ${string}: ${string}}` | `Dict<{${string}: unknown, ${string}: ${string}}` | `Dict<{${string}: null, ${string}: ${string}}` | `Dict<{${string}: true, ${string}: ${string}}` | `Dict<{${string}: false, ${string}: ${string}}` | `Dict<{${string}: Opt<string>, ${string}: ${string}}` | `Dict<{${string}: Opt<number>, ${string}: ${string}}` | `Dict<{${string}: Opt<boolean>, ${string}: ${string}}` | `Dict<{${string}: Opt<unknown>, ${string}: ${string}}` | `Dict<{${string}: string(${string}), ${string}: ${string}}` | `Dict<{${string}: number(${number}), ${string}: ${string}}` | `Dict<{${string}: number(${number},${string}), ${string}: ${string}}` | `Dict<{${string}: any, ${string}: ${string}}` | `Dict<{${string}: Opt<true>, ${string}: ${string}}` | `Dict<{${string}: Opt<false>, ${string}: ${string}}` | `Dict<{${string}: Opt<null>, ${string}: ${string}}` | `Dict<{${string}: Opt<undefined>, ${string}: ${string}}` | `Dict<{${string}: Opt<any>, ${string}: ${string}}` | `Dict<{${string}: Opt<string(${string})>, ${string}: ${string}}` | `Dict<{${string}: Opt<string(${string},${string})>, ${string}: ${string}}` | `Dict<{${string}: Opt<number(${number}), ${string}: ${string}}` | `Dict<{${string}: Opt<number(${number},${string}), ${string}: ${string}}`];
|
|
4608
|
-
declare const SIMPLE_ARRAY_TOKENS: readonly ["Array", "Array<string>", `Array<string(${string})>`, "Array<number>", `Array<number(${number})>` | `Array<number(${number},${string})>`, "Array<boolean>", "Array<unknown>", "Array<Dict>", "Array<Set>", "Array<Map>"];
|
|
4609
|
-
declare const SIMPLE_MAP_TOKENS: readonly ["Map", "Map<string, string>" | "Map<string, number>" | "Map<string, boolean>" | "Map<string, undefined>" | "Map<string, unknown>" | "Map<string, Dict>" | "Map<string, Dict<string, string>>" | "Map<string, Dict<string, number>>" | "Map<string, Dict<string, boolean>>" | "Map<string, Dict<string, unknown>>" | "Map<string, Dict<string, Opt<string>>>" | "Map<string, Dict<string, Opt<number>>>" | "Map<string, Dict<string, Opt<boolean>>>" | "Map<string, Array>" | "Map<string, Dict<string, Opt<unknown>>>" | "Map<number, string>" | "Map<number, number>" | "Map<number, boolean>" | "Map<number, undefined>" | "Map<number, unknown>" | "Map<number, Dict>" | "Map<number, Dict<string, string>>" | "Map<number, Dict<string, number>>" | "Map<number, Dict<string, boolean>>" | "Map<number, Dict<string, unknown>>" | "Map<number, Dict<string, Opt<string>>>" | "Map<number, Dict<string, Opt<number>>>" | "Map<number, Dict<string, Opt<boolean>>>" | "Map<number, Array>" | "Map<number, Dict<string, Opt<unknown>>>" | "Map<Dict, string>" | "Map<Dict, number>" | "Map<Dict, boolean>" | "Map<Dict, undefined>" | "Map<Dict, unknown>" | "Map<Dict, Dict>" | "Map<Dict, Dict<string, string>>" | "Map<Dict, Dict<string, number>>" | "Map<Dict, Dict<string, boolean>>" | "Map<Dict, Dict<string, unknown>>" | "Map<Dict, Dict<string, Opt<string>>>" | "Map<Dict, Dict<string, Opt<number>>>" | "Map<Dict, Dict<string, Opt<boolean>>>" | "Map<Dict, Array>" | "Map<Dict, Dict<string, Opt<unknown>>>" | "Map<Dict<string, string>, string>" | "Map<Dict<string, string>, number>" | "Map<Dict<string, string>, boolean>" | "Map<Dict<string, string>, undefined>" | "Map<Dict<string, string>, unknown>" | "Map<Dict<string, string>, Dict>" | "Map<Dict<string, string>, Dict<string, string>>" | "Map<Dict<string, string>, Dict<string, number>>" | "Map<Dict<string, string>, Dict<string, boolean>>" | "Map<Dict<string, string>, Dict<string, unknown>>" | "Map<Dict<string, string>, Dict<string, Opt<string>>>" | "Map<Dict<string, string>, Dict<string, Opt<number>>>" | "Map<Dict<string, string>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, string>, Array>" | "Map<Dict<string, string>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, number>, string>" | "Map<Dict<string, number>, number>" | "Map<Dict<string, number>, boolean>" | "Map<Dict<string, number>, undefined>" | "Map<Dict<string, number>, unknown>" | "Map<Dict<string, number>, Dict>" | "Map<Dict<string, number>, Dict<string, string>>" | "Map<Dict<string, number>, Dict<string, number>>" | "Map<Dict<string, number>, Dict<string, boolean>>" | "Map<Dict<string, number>, Dict<string, unknown>>" | "Map<Dict<string, number>, Dict<string, Opt<string>>>" | "Map<Dict<string, number>, Dict<string, Opt<number>>>" | "Map<Dict<string, number>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, number>, Array>" | "Map<Dict<string, number>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, boolean>, string>" | "Map<Dict<string, boolean>, number>" | "Map<Dict<string, boolean>, boolean>" | "Map<Dict<string, boolean>, undefined>" | "Map<Dict<string, boolean>, unknown>" | "Map<Dict<string, boolean>, Dict>" | "Map<Dict<string, boolean>, Dict<string, string>>" | "Map<Dict<string, boolean>, Dict<string, number>>" | "Map<Dict<string, boolean>, Dict<string, boolean>>" | "Map<Dict<string, boolean>, Dict<string, unknown>>" | "Map<Dict<string, boolean>, Dict<string, Opt<string>>>" | "Map<Dict<string, boolean>, Dict<string, Opt<number>>>" | "Map<Dict<string, boolean>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, boolean>, Array>" | "Map<Dict<string, boolean>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, unknown>, string>" | "Map<Dict<string, unknown>, number>" | "Map<Dict<string, unknown>, boolean>" | "Map<Dict<string, unknown>, undefined>" | "Map<Dict<string, unknown>, unknown>" | "Map<Dict<string, unknown>, Dict>" | "Map<Dict<string, unknown>, Dict<string, string>>" | "Map<Dict<string, unknown>, Dict<string, number>>" | "Map<Dict<string, unknown>, Dict<string, boolean>>" | "Map<Dict<string, unknown>, Dict<string, unknown>>" | "Map<Dict<string, unknown>, Dict<string, Opt<string>>>" | "Map<Dict<string, unknown>, Dict<string, Opt<number>>>" | "Map<Dict<string, unknown>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, unknown>, Array>" | "Map<Dict<string, unknown>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, Opt<string>>, string>" | "Map<Dict<string, Opt<string>>, number>" | "Map<Dict<string, Opt<string>>, boolean>" | "Map<Dict<string, Opt<string>>, undefined>" | "Map<Dict<string, Opt<string>>, unknown>" | "Map<Dict<string, Opt<string>>, Dict>" | "Map<Dict<string, Opt<string>>, Dict<string, string>>" | "Map<Dict<string, Opt<string>>, Dict<string, number>>" | "Map<Dict<string, Opt<string>>, Dict<string, boolean>>" | "Map<Dict<string, Opt<string>>, Dict<string, unknown>>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<string>>>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<number>>>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, Opt<string>>, Array>" | "Map<Dict<string, Opt<string>>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, Opt<number>>, string>" | "Map<Dict<string, Opt<number>>, number>" | "Map<Dict<string, Opt<number>>, boolean>" | "Map<Dict<string, Opt<number>>, undefined>" | "Map<Dict<string, Opt<number>>, unknown>" | "Map<Dict<string, Opt<number>>, Dict>" | "Map<Dict<string, Opt<number>>, Dict<string, string>>" | "Map<Dict<string, Opt<number>>, Dict<string, number>>" | "Map<Dict<string, Opt<number>>, Dict<string, boolean>>" | "Map<Dict<string, Opt<number>>, Dict<string, unknown>>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<string>>>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<number>>>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, Opt<number>>, Array>" | "Map<Dict<string, Opt<number>>, Dict<string, Opt<unknown>>>" | "Map<Dict<string, Opt<boolean>>, string>" | "Map<Dict<string, Opt<boolean>>, number>" | "Map<Dict<string, Opt<boolean>>, boolean>" | "Map<Dict<string, Opt<boolean>>, undefined>" | "Map<Dict<string, Opt<boolean>>, unknown>" | "Map<Dict<string, Opt<boolean>>, Dict>" | "Map<Dict<string, Opt<boolean>>, Dict<string, string>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, number>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, boolean>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, unknown>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<string>>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<number>>>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<boolean>>>" | "Map<Dict<string, Opt<boolean>>, Array>" | "Map<Dict<string, Opt<boolean>>, Dict<string, Opt<unknown>>>", "WeakMap"];
|
|
4610
|
-
declare const SIMPLE_SET_TOKENS: readonly ["Set", "Set<string>" | "Set<number>" | "Set<boolean>" | "Set<unknown>" | "Set<Opt<string>>" | "Set<Opt<number>>" | "Set<Opt<boolean>>" | "Set<Opt<unknown>>"];
|
|
4611
4612
|
/**
|
|
4612
4613
|
* **Type Tokens** which have zero configuration elements.
|
|
4613
4614
|
*/
|
|
4614
|
-
declare const
|
|
4615
|
+
declare const TT_ATOMICS: readonly ["undefined", "null", "boolean", "true", "false"];
|
|
4615
4616
|
/**
|
|
4616
4617
|
* **Type Tokens** which have a literal variant which represents
|
|
4617
4618
|
* the _single_ configuration of this type which is available.
|
|
4618
4619
|
*/
|
|
4619
|
-
declare const
|
|
4620
|
-
declare const
|
|
4620
|
+
declare const TT_SINGLETONS: readonly ["string", "number"];
|
|
4621
|
+
declare const TT_SETS: readonly ["string-set", "numeric-set", "fn-set", "union-set"];
|
|
4621
4622
|
/**
|
|
4622
4623
|
* **Type Tokens** which represent _functions_ (either the typical
|
|
4623
4624
|
* variety or Generator functions).
|
|
4624
4625
|
*/
|
|
4625
|
-
declare const
|
|
4626
|
+
declare const TT_FUNCTIONS: readonly ["fn", "gen"];
|
|
4626
4627
|
/**
|
|
4627
4628
|
* **Type Tokens** which _contain_ other **Type Tokens** to make up their
|
|
4628
4629
|
* identity.
|
|
4629
4630
|
*/
|
|
4630
|
-
declare const
|
|
4631
|
+
declare const TT_CONTAINERS: readonly ["rec", "arr", "set", "map", "union", "obj", "tuple"];
|
|
4631
4632
|
declare const TT_START: "<<";
|
|
4632
4633
|
declare const TT_STOP: ">>";
|
|
4634
|
+
declare const TT_DELIMITER: "::";
|
|
4635
|
+
|
|
4636
|
+
declare const TYPE_TOKEN_REC_VARIANTS: readonly ["object-key", "string-key"];
|
|
4637
|
+
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[]"];
|
|
4638
|
+
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}"];
|
|
4639
|
+
declare const TYPE_TOKEN_UNION_SET_VARIANTS: string[];
|
|
4633
4640
|
|
|
4634
4641
|
interface OnPassRemap<TNever = unknown, TFalse = unknown, TError = unknown> {
|
|
4635
4642
|
never: TNever;
|
|
@@ -4948,9 +4955,9 @@ type PreProcess$2<A extends NumberLike, B extends NumberLike> = CheckWide<A, B>
|
|
|
4948
4955
|
*/
|
|
4949
4956
|
type Add<A extends NumberLike, B extends NumberLike> = A extends number ? As<PreProcess$2<A, B>, number> : A extends `${number}` ? As<PreProcess$2<A, B>, `${number}`> : never;
|
|
4950
4957
|
|
|
4951
|
-
type Convert$
|
|
4958
|
+
type Convert$3<T> = T extends `${number}` ? ToNumber<T> : T;
|
|
4952
4959
|
type ConvertTuple<T> = T extends unknown[] ? {
|
|
4953
|
-
[K in keyof T]: Convert$
|
|
4960
|
+
[K in keyof T]: Convert$3<T[K]>;
|
|
4954
4961
|
} : never;
|
|
4955
4962
|
type ConvertUnion$1<T> = If<IsUnion<T>, TupleToUnion<ConvertTuple<UnionToTuple$1<T>>>, never>;
|
|
4956
4963
|
/**
|
|
@@ -4966,7 +4973,7 @@ type ConvertUnion$1<T> = If<IsUnion<T>, TupleToUnion<ConvertTuple<UnionToTuple$1
|
|
|
4966
4973
|
* literal values will be converted to a numeric literal but the return type will
|
|
4967
4974
|
* still be a _union_.
|
|
4968
4975
|
*/
|
|
4969
|
-
type AsNumberWhenPossible<T> = If<IsUnion<T>, ConvertUnion$1<T>, T extends readonly unknown[] ? ConvertTuple<T> : Convert$
|
|
4976
|
+
type AsNumberWhenPossible<T> = If<IsUnion<T>, ConvertUnion$1<T>, T extends readonly unknown[] ? ConvertTuple<T> : Convert$3<T>>;
|
|
4970
4977
|
|
|
4971
4978
|
/**
|
|
4972
4979
|
* **AsBoolean**`<T>`
|
|
@@ -4976,8 +4983,6 @@ type AsNumberWhenPossible<T> = If<IsUnion<T>, ConvertUnion$1<T>, T extends reado
|
|
|
4976
4983
|
*/
|
|
4977
4984
|
type AsBoolean<T> = T extends boolean ? T : T extends "true" ? true : T extends "false" ? false : T extends "boolean" ? boolean : never;
|
|
4978
4985
|
|
|
4979
|
-
type AsDictionary<T> = T extends Dictionary ? T : never;
|
|
4980
|
-
|
|
4981
4986
|
interface TypeErrorInfo<TContext extends Record<string, unknown> = EmptyObject> {
|
|
4982
4987
|
/**
|
|
4983
4988
|
* if there is a particular "id" value which is useful to separate from the error message
|
|
@@ -5293,7 +5298,7 @@ type KebabCase<TString extends string, TPreserve extends boolean = false> = Proc
|
|
|
5293
5298
|
*/
|
|
5294
5299
|
type LowerAllCaps<T extends string> = IsAllCaps<T> extends true ? Lowercase<T> : T;
|
|
5295
5300
|
|
|
5296
|
-
type Delimiter = "_" | "-" | " ";
|
|
5301
|
+
type Delimiter$1 = "_" | "-" | " ";
|
|
5297
5302
|
/** convert all delimiters to dashes */
|
|
5298
5303
|
type DashDelim<T extends string> = T extends `${infer Begin}${" "}${infer Rest}` ? DashDelim<`${Begin}-${Rest}`> : T extends `${infer Begin}${"_"}${infer Rest}` ? DashDelim<`${Begin}-${Rest}`> : T;
|
|
5299
5304
|
/**
|
|
@@ -5306,7 +5311,7 @@ type DashDelim<T extends string> = T extends `${infer Begin}${" "}${infer Rest}`
|
|
|
5306
5311
|
* type T = PascalCase<"\n foo_bar \t">;
|
|
5307
5312
|
* ```
|
|
5308
5313
|
*/
|
|
5309
|
-
type PascalCase<S extends string> = string extends S ? string : Trim<DashDelim<LowerAllCaps<S>>> extends `${infer Begin}${Delimiter}${infer Rest}` ? PascalCase<`${Capitalize<Begin>}${Capitalize<Rest>}`> : Capitalize<Trim<LowerAllCaps<S>>>;
|
|
5314
|
+
type PascalCase<S extends string> = string extends S ? string : Trim<DashDelim<LowerAllCaps<S>>> extends `${infer Begin}${Delimiter$1}${infer Rest}` ? PascalCase<`${Capitalize<Begin>}${Capitalize<Rest>}`> : Capitalize<Trim<LowerAllCaps<S>>>;
|
|
5310
5315
|
|
|
5311
5316
|
/** convert space to dash */
|
|
5312
5317
|
type SpaceToDash<T extends string> = T extends `${infer Begin}${" "}${infer Rest}` ? SpaceToDash<`${Begin}-${Rest}`> : T;
|
|
@@ -7904,6 +7909,7 @@ type Volume = `${number}${OptSpace}${VolumeUom}`;
|
|
|
7904
7909
|
* **Related:** `Uom`
|
|
7905
7910
|
*/
|
|
7906
7911
|
type Metric = Acceleration | Area | Current | Distance | Frequency | Luminosity | Mass | Power | Pressure | Resistance | Speed | Temperature | TimeMetric | Voltage | Volume;
|
|
7912
|
+
type MetricCategory = "Acceleration" | "Area" | "Current" | "Distance" | "Frequency" | "Luminosity" | "Mass" | "Power" | "Pressure" | "Resistance" | "Speed" | "Temperature" | "Time" | "Voltage" | "Volume";
|
|
7907
7913
|
/**
|
|
7908
7914
|
* **Uom**
|
|
7909
7915
|
*
|
|
@@ -9923,7 +9929,6 @@ interface LuxonJs {
|
|
|
9923
9929
|
};
|
|
9924
9930
|
}
|
|
9925
9931
|
|
|
9926
|
-
type HandleObject<TObj extends Dictionary, TKeys extends readonly unknown[], TResult extends Dictionary = EmptyObject> = [] extends TKeys ? ExpandDictionary<TResult> : HandleObject<TObj, AfterFirst<TKeys>, First<TKeys> extends keyof TObj ? TObj[First<TKeys>] extends ShapeCallback ? Record<First<TKeys>, HandleDoneFn<ReturnType<TObj[First<TKeys>]>>> & TResult : TObj[First<TKeys>] extends SimpleToken ? Record<First<TKeys>, AsType<TObj[First<TKeys>]>> & TResult : Record<First<TKeys>, TObj[First<TKeys>]> & TResult : never>;
|
|
9927
9932
|
type ProcessUnion<T extends UnionElDefn> = T extends Tuple ? TupleToUnion<T> : T extends ShapeCallback ? HandleDoneFn<ReturnType<T>> : never;
|
|
9928
9933
|
type IterateUnion<T extends readonly UnionElDefn[]> = {
|
|
9929
9934
|
[K in keyof T]: ProcessUnion<T[K]>;
|
|
@@ -9935,11 +9940,10 @@ type IterateUnion<T extends readonly UnionElDefn[]> = {
|
|
|
9935
9940
|
* and makes this into _union type_.
|
|
9936
9941
|
*/
|
|
9937
9942
|
type AsUnion<T extends UnionElDefn | readonly [UnionElDefn, ...UnionElDefn[]]> = T extends UnionElDefn[] ? TupleToUnion<IterateUnion<T>> : T extends UnionElDefn ? ProcessUnion<T> : never;
|
|
9938
|
-
type IsDictionaryDefinition<T> = T extends Dictionary ? Contains<Values<T>, ShapeCallback> : false;
|
|
9939
9943
|
/**
|
|
9940
9944
|
* converts non-tuple definition types to actual type
|
|
9941
9945
|
*/
|
|
9942
|
-
type ToType$1<T, TElse> =
|
|
9946
|
+
type ToType$1<T, TElse> = T extends ShapeCallback ? FromShapeCallback<T> : T extends SimpleToken ? FromSimpleToken<T> : T extends RecordKeyWideTokens ? FromSimpleRecordKey<T> : T extends WideTokenNames | WideContainerNames ? FromWideTokens<T> : T extends RecordKeyWideTokens ? FromSimpleRecordKey<T> : TElse;
|
|
9943
9947
|
/**
|
|
9944
9948
|
* iterates over tuple definition types to convert into real types
|
|
9945
9949
|
*/
|
|
@@ -9947,8 +9951,16 @@ type IterateOverDefinitions<T extends readonly unknown[], TElse> = {
|
|
|
9947
9951
|
[K in keyof T]: ToType$1<T[K], TElse>;
|
|
9948
9952
|
};
|
|
9949
9953
|
type TypeDefinition = NarrowableScalar | ShapeCallback;
|
|
9954
|
+
/**
|
|
9955
|
+
* converts a `ShapeCallback` into the _type_ which it is defining
|
|
9956
|
+
*/
|
|
9957
|
+
type FromShapeCallback<TShape extends ShapeCallback, TAsToken extends boolean = false> = TAsToken extends false ? ReturnType<HandleDoneFn<TShape>> : string;
|
|
9958
|
+
/**
|
|
9959
|
+
* converts a `SimpleToken` into the _type_ which it is defining
|
|
9960
|
+
*/
|
|
9961
|
+
type FromSimpleToken<T extends SimpleToken> = SimpleType<T>;
|
|
9950
9962
|
type _FromDefineObject<T extends Required<DefineObject>> = {
|
|
9951
|
-
[K in keyof T]: T[K] extends SimpleToken ?
|
|
9963
|
+
[K in keyof T]: T[K] extends SimpleToken ? FromSimpleToken<T[K]> : T[K] extends ShapeCallback ? FromShapeCallback<T[K]> : never;
|
|
9952
9964
|
};
|
|
9953
9965
|
/**
|
|
9954
9966
|
* Converts a `DefineObject` definition into the type that it is
|
|
@@ -9970,7 +9982,7 @@ type FromDefineObject<T extends DefineObject> = MakeKeysOptional<_FromDefineObje
|
|
|
9970
9982
|
* Note: when dictionary objects are found the _values_ will be
|
|
9971
9983
|
* interrogated for ShapeCallback's.
|
|
9972
9984
|
*/
|
|
9973
|
-
type FromDefn$1<T, TElse =
|
|
9985
|
+
type FromDefn$1<T, TElse = Unset> = T extends DefineObject ? FromDefineObject<T> : T extends readonly unknown[] ? IterateOverDefinitions<T, TElse> : ToType$1<T, TElse>;
|
|
9974
9986
|
|
|
9975
9987
|
type WideTokenNames = "string" | "number" | "boolean" | "null" | "undefined" | "never" | "unknown" | "string[]" | "number[]" | "boolean[]" | "unknown[]";
|
|
9976
9988
|
type ConvertWideTokenNames<T extends WideTokenNames> = 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;
|
|
@@ -10366,47 +10378,6 @@ type Process$c<TKeys extends readonly string[], TValue, TObj extends Dictionary
|
|
|
10366
10378
|
*/
|
|
10367
10379
|
type CreateKV<TKeys extends readonly string[], TValue = unknown> = ExpandRecursively<Process$c<TKeys, TValue>>;
|
|
10368
10380
|
|
|
10369
|
-
type SetTypes = typeof SIMPLE_SET_TYPES[number];
|
|
10370
|
-
type MapKeys = typeof SIMPLE_MAP_KEYS[number];
|
|
10371
|
-
type MapValues = typeof SIMPLE_MAP_VALUES[number];
|
|
10372
|
-
type DictValues = typeof SIMPLE_DICT_VALUES[number];
|
|
10373
|
-
/**
|
|
10374
|
-
* **SimpleTypeScalar**`<T>`
|
|
10375
|
-
*
|
|
10376
|
-
* Converts a `SimpleScalarToken` into the _type_ it represents.
|
|
10377
|
-
*/
|
|
10378
|
-
type SimpleTypeScalar<T extends SimpleScalarToken> = T extends "string" ? string : T extends `string(${infer Literal})` ? Literal extends `${string},${string}` ? CsvToStrUnion<Literal> : Literal : T extends "number" ? number : T extends `number(${infer Literal})` ? Literal extends `${string},${string}` ? CsvToUnion<Literal> : AsNumber<Literal> : T extends "boolean" ? boolean : T extends "true" ? true : T extends "false" ? false : T extends "null" ? null : T extends "any" ? any : T extends "undefined" ? undefined : T extends "unknown" ? unknown : T extends `Opt<${infer Underlying extends SimpleScalarToken}>` ? undefined | SimpleTypeScalar<Underlying> : never;
|
|
10379
|
-
/**
|
|
10380
|
-
* **SimpleTypeUnion**`<T>`
|
|
10381
|
-
*
|
|
10382
|
-
* Converts a `SimpleUnionToken` into the _type_ it represents.
|
|
10383
|
-
*/
|
|
10384
|
-
type SimpleTypeUnion<T extends SimpleUnionToken> = T extends "opt(string)" ? string | undefined : T extends "opt(number)" ? number | undefined : T extends "opt(boolean)" ? boolean | undefined : T extends "opt(unknown)" ? unknown | undefined : T extends `opt(${infer Literal extends string})` ? Literal extends `${string},${string}` ? TupleToUnion<CsvToTuple<Literal>> | undefined : UnderlyingType<Literal> | undefined : T extends `Union(${infer Literal})` ? Literal extends `${string},${string}` ? CsvToTuple<Literal> : Literal : never;
|
|
10385
|
-
type SimpleTypeDict<T extends SimpleDictToken> = T extends `Dict` ? Dictionary : T extends `Dict<string, ${infer Value extends DictValues & SimpleScalarToken}>` ? Dictionary<string, SimpleTypeScalar<Value>> : T extends `Dict<{${infer K}: ${infer V}, ${infer K2}: ${infer V2}}>` ? V extends SimpleScalarToken ? V2 extends SimpleScalarToken ? ExpandDictionary<Record<K, SimpleTypeScalar<V>> & Record<K2, SimpleTypeScalar<V2>> & Dictionary> : ExpandDictionary<Record<K, SimpleTypeScalar<V>> & Dictionary> : V2 extends SimpleScalarToken ? ExpandDictionary<Record<K2, SimpleTypeScalar<V2>> & Dictionary> : never : T extends `Dict<{${infer Key}: ${infer Value}}>` ? Value extends SimpleScalarToken ? ExpandDictionary<Record<Key, SimpleTypeScalar<Value>> & Dictionary> : never : never;
|
|
10386
|
-
type SimpleTypeArray<T extends SimpleArrayToken> = T extends "Array" ? any[] : T extends "Array<string>" ? string[] : T extends `Array<string(${infer StringUnion})>` ? Array<SimpleTypeScalar<`string(${StringUnion})`>> : T extends "Array<number>" ? number[] : T extends `Array<number(${infer NumericUnion extends `${number}`})>` ? Array<SimpleTypeScalar<`number(${NumericUnion})`>> : T extends "Array<boolean>" ? boolean[] : T extends "Array<unknown>" ? unknown[] : never;
|
|
10387
|
-
type SimpleTypeMap<T extends SimpleMapToken> = T extends "Map" ? Map<any, any> : T extends `Map<${infer Key extends MapKeys}, ${infer Value extends MapValues}>` ? Map<SimpleType<Key>, SimpleType<Value>> : never;
|
|
10388
|
-
type SimpleTypeSet<T extends SimpleSetToken> = T extends "Set" ? Set<any> : T extends `Set<${infer Type extends SetTypes}>` ? Set<SimpleType<Type>> : never;
|
|
10389
|
-
/**
|
|
10390
|
-
* **SimpleType**`<T>`
|
|
10391
|
-
*
|
|
10392
|
-
* A type utility which takes a `SimpleToken` and converts it to
|
|
10393
|
-
* it's _type_ in the type system.
|
|
10394
|
-
*
|
|
10395
|
-
* **Related:** `ToShapeToken`, `StructuredStringType`
|
|
10396
|
-
*/
|
|
10397
|
-
type SimpleType<T extends SimpleToken> = T extends SimpleScalarToken ? SimpleTypeScalar<T> : T extends SimpleDictToken ? SimpleTypeDict<T> : T extends SimpleArrayToken ? SimpleTypeArray<T> : T extends SimpleMapToken ? SimpleTypeMap<T> : T extends SimpleSetToken ? SimpleTypeSet<T> : T extends SimpleUnionToken ? SimpleTypeUnion<T> : never;
|
|
10398
|
-
|
|
10399
|
-
/**
|
|
10400
|
-
* **SimpleToken**
|
|
10401
|
-
*
|
|
10402
|
-
* An enumeration of string values which point to _types_ in the
|
|
10403
|
-
* the type system.
|
|
10404
|
-
*
|
|
10405
|
-
* **Related:**
|
|
10406
|
-
* - `SimpleScalarToken`, `SimpleContainerToken`, `SimpleUnionToken`,
|
|
10407
|
-
* - `TypeToken`
|
|
10408
|
-
*/
|
|
10409
|
-
type SimpleToken = SimpleScalarToken | SimpleArrayToken | SimpleDictToken | SimpleMapToken | SimpleSetToken | SimpleUnionToken;
|
|
10410
10381
|
/**
|
|
10411
10382
|
* the _optional_ variants of the `SimpleScalarToken` type
|
|
10412
10383
|
*/
|
|
@@ -10415,30 +10386,12 @@ type OptionalSimpleScalarTokens = typeof SIMPLE_OPT_SCALAR_TOKENS[number];
|
|
|
10415
10386
|
* the _required_ variants of the `SimpleScalarToken` type
|
|
10416
10387
|
*/
|
|
10417
10388
|
type RequiredSimpleScalarTokens = typeof SIMPLE_SCALAR_TOKENS[number];
|
|
10418
|
-
/**
|
|
10419
|
-
* **SimpleScalarToken**
|
|
10420
|
-
*
|
|
10421
|
-
* A subset of the `SimpleToken` which may be more useful for building
|
|
10422
|
-
* simple string literal values.
|
|
10423
|
-
*
|
|
10424
|
-
* **Note:** this includes both `RequiredSimpleScalarTokens` and `OptionalSimpleScalarTokens`.
|
|
10425
|
-
*/
|
|
10426
|
-
type SimpleScalarToken = RequiredSimpleScalarTokens | OptionalSimpleScalarTokens;
|
|
10427
10389
|
/**
|
|
10428
10390
|
* **SimpleUnionToken**
|
|
10429
10391
|
*
|
|
10430
10392
|
* A subset of `SimpleToken` which represents union types.
|
|
10431
10393
|
*/
|
|
10432
10394
|
type SimpleUnionToken = typeof SIMPLE_UNION_TOKENS[number];
|
|
10433
|
-
/**
|
|
10434
|
-
* **BaseTypeToken**
|
|
10435
|
-
*
|
|
10436
|
-
* A very simple structure for `TypeTokens` to fit into.
|
|
10437
|
-
*
|
|
10438
|
-
* Use this type if you need to preserve type simplicity, otherwise
|
|
10439
|
-
* prefer `TypeToken` (or subsets like `AtomicToken`, `SingletonToken`, etc.)
|
|
10440
|
-
*/
|
|
10441
|
-
type BaseTypeToken = `${TypeTokenStart}${string}${TypeTokenStop}`;
|
|
10442
10395
|
/**
|
|
10443
10396
|
* a subset of `SimpleContainerToken`
|
|
10444
10397
|
*/
|
|
@@ -10463,52 +10416,129 @@ type SimpleSetToken = typeof SIMPLE_SET_TOKENS[number];
|
|
|
10463
10416
|
*/
|
|
10464
10417
|
type SimpleContainerToken = SimpleDictToken | SimpleArrayToken | SimpleMapToken | SimpleArrayToken;
|
|
10465
10418
|
/**
|
|
10466
|
-
*
|
|
10419
|
+
* **SimpleScalarToken**
|
|
10467
10420
|
*
|
|
10468
|
-
*
|
|
10421
|
+
* A subset of the `SimpleToken` which may be more useful for building
|
|
10422
|
+
* simple string literal values.
|
|
10423
|
+
*
|
|
10424
|
+
* **Note:** this includes both `RequiredSimpleScalarTokens` and `OptionalSimpleScalarTokens`.
|
|
10425
|
+
*/
|
|
10426
|
+
type SimpleScalarToken = RequiredSimpleScalarTokens | OptionalSimpleScalarTokens;
|
|
10427
|
+
/**
|
|
10428
|
+
* **SimpleToken**
|
|
10429
|
+
*
|
|
10430
|
+
* An enumeration of string values which point to _types_ in the
|
|
10431
|
+
* the type system.
|
|
10432
|
+
*
|
|
10433
|
+
* **Related:**
|
|
10434
|
+
* - `SimpleScalarToken`, `SimpleContainerToken`, `SimpleUnionToken`,
|
|
10435
|
+
* - `FromSimpleToken`, `FromDefn`
|
|
10436
|
+
* - `TypeToken`
|
|
10437
|
+
*/
|
|
10438
|
+
type SimpleToken = SimpleScalarToken | SimpleArrayToken | SimpleDictToken | SimpleMapToken | SimpleSetToken | SimpleUnionToken;
|
|
10439
|
+
|
|
10440
|
+
type SetTypes = typeof SIMPLE_SET_TYPES[number];
|
|
10441
|
+
type MapKeys = typeof SIMPLE_MAP_KEYS[number];
|
|
10442
|
+
type MapValues = typeof SIMPLE_MAP_VALUES[number];
|
|
10443
|
+
type DictValues = typeof SIMPLE_DICT_VALUES[number];
|
|
10444
|
+
/**
|
|
10445
|
+
* **SimpleTypeScalar**`<T>`
|
|
10446
|
+
*
|
|
10447
|
+
* Converts a `SimpleScalarToken` into the _type_ it represents.
|
|
10469
10448
|
*/
|
|
10470
|
-
type
|
|
10449
|
+
type SimpleTypeScalar<T extends SimpleScalarToken> = T extends "string" ? string : T extends `string(${infer Literal})` ? Literal extends `${string},${string}` ? CsvToStrUnion<Literal> : Literal : T extends "number" ? number : T extends `number(${infer Literal})` ? Literal extends `${string},${string}` ? CsvToUnion<Literal> : AsNumber<Literal> : T extends "boolean" ? boolean : T extends "true" ? true : T extends "false" ? false : T extends "null" ? null : T extends "any" ? any : T extends "undefined" ? undefined : T extends "unknown" ? unknown : T extends `Opt<${infer Underlying extends SimpleScalarToken}>` ? undefined | SimpleTypeScalar<Underlying> : never;
|
|
10471
10450
|
/**
|
|
10472
|
-
* **
|
|
10451
|
+
* **SimpleTypeUnion**`<T>`
|
|
10473
10452
|
*
|
|
10474
|
-
*
|
|
10453
|
+
* Converts a `SimpleUnionToken` into the _type_ it represents.
|
|
10475
10454
|
*/
|
|
10476
|
-
type
|
|
10477
|
-
type
|
|
10478
|
-
type
|
|
10479
|
-
type
|
|
10455
|
+
type SimpleTypeUnion<T extends SimpleUnionToken> = T extends "opt(string)" ? string | undefined : T extends "opt(number)" ? number | undefined : T extends "opt(boolean)" ? boolean | undefined : T extends "opt(unknown)" ? unknown | undefined : T extends `opt(${infer Literal extends string})` ? Literal extends `${string},${string}` ? TupleToUnion<CsvToTuple<Literal>> | undefined : UnderlyingType<Literal> | undefined : T extends `Union(${infer Literal})` ? Literal extends `${string},${string}` ? CsvToTuple<Literal> : Literal : never;
|
|
10456
|
+
type SimpleTypeDict<T extends SimpleDictToken> = T extends `Dict` ? Dictionary : T extends `Dict<string, ${infer Value extends DictValues & SimpleScalarToken}>` ? Dictionary<string, SimpleTypeScalar<Value>> : T extends `Dict<{${infer K}: ${infer V}, ${infer K2}: ${infer V2}}>` ? V extends SimpleScalarToken ? V2 extends SimpleScalarToken ? ExpandDictionary<Record<K, SimpleTypeScalar<V>> & Record<K2, SimpleTypeScalar<V2>> & Dictionary> : ExpandDictionary<Record<K, SimpleTypeScalar<V>> & Dictionary> : V2 extends SimpleScalarToken ? ExpandDictionary<Record<K2, SimpleTypeScalar<V2>> & Dictionary> : never : T extends `Dict<{${infer Key}: ${infer Value}}>` ? Value extends SimpleScalarToken ? ExpandDictionary<Record<Key, SimpleTypeScalar<Value>> & Dictionary> : never : never;
|
|
10457
|
+
type SimpleTypeArray<T extends SimpleArrayToken> = T extends "Array" ? any[] : T extends "Array<string>" ? string[] : T extends `Array<string(${infer StringUnion})>` ? Array<SimpleTypeScalar<`string(${StringUnion})`>> : T extends "Array<number>" ? number[] : T extends `Array<number(${infer NumericUnion extends `${number}`})>` ? Array<SimpleTypeScalar<`number(${NumericUnion})`>> : T extends "Array<boolean>" ? boolean[] : T extends "Array<unknown>" ? unknown[] : never;
|
|
10458
|
+
type SimpleTypeMap<T extends SimpleMapToken> = T extends "Map" ? Map<any, any> : T extends `Map<${infer Key extends MapKeys}, ${infer Value extends MapValues}>` ? Map<SimpleType<Key>, SimpleType<Value>> : never;
|
|
10459
|
+
type SimpleTypeSet<T extends SimpleSetToken> = T extends "Set" ? Set<any> : T extends `Set<${infer Type extends SetTypes}>` ? Set<SimpleType<Type>> : never;
|
|
10480
10460
|
/**
|
|
10481
|
-
* **
|
|
10461
|
+
* **SimpleType**`<T>`
|
|
10462
|
+
*
|
|
10463
|
+
* A type utility which takes a `SimpleToken` and converts it to
|
|
10464
|
+
* it's _type_ in the type system.
|
|
10482
10465
|
*
|
|
10483
|
-
*
|
|
10484
|
-
* - set _name_ `${string}`, then
|
|
10485
|
-
* - static `::[ `, then
|
|
10486
|
-
* - set _parameters_ `${string}`, then
|
|
10487
|
-
* - static ` ]>>`
|
|
10466
|
+
* **Related:** `ToShapeToken`, `StructuredStringType`
|
|
10488
10467
|
*/
|
|
10489
|
-
type
|
|
10490
|
-
|
|
10491
|
-
type
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
type SetToken = `<<set::${BaseTypeToken}>>`;
|
|
10495
|
-
type MapToken = `<<map::${BaseTypeToken}::${BaseTypeToken}>>`;
|
|
10496
|
-
type WeakMapToken = `<<weak::${BaseTypeToken}::${BaseTypeToken}>>`;
|
|
10497
|
-
type FnToken = `<<fn::${string}::${BaseTypeToken}>>`;
|
|
10498
|
-
type GeneratorToken = `<<gen::${string}::${BaseTypeToken}>>`;
|
|
10499
|
-
type TypeTokenFunctions = typeof TT_Functions[number];
|
|
10500
|
-
type TypeTokenSingletons = typeof TT_Singletons[number];
|
|
10468
|
+
type SimpleType<T extends SimpleToken> = T extends SimpleScalarToken ? SimpleTypeScalar<T> : T extends SimpleDictToken ? SimpleTypeDict<T> : T extends SimpleArrayToken ? SimpleTypeArray<T> : T extends SimpleMapToken ? SimpleTypeMap<T> : T extends SimpleSetToken ? SimpleTypeSet<T> : T extends SimpleUnionToken ? SimpleTypeUnion<T> : never;
|
|
10469
|
+
|
|
10470
|
+
type MakeDynamic<T extends readonly string[]> = {
|
|
10471
|
+
[K in keyof T]: ReplaceAll<ReplaceAll<T[K], "${string}", `${string}`>, "${Metric}", MetricCategory>;
|
|
10472
|
+
};
|
|
10501
10473
|
/**
|
|
10502
|
-
*
|
|
10474
|
+
* Type extensions for the `string` variant
|
|
10475
|
+
*
|
|
10476
|
+
* Allow for wide "string", or a string literal.
|
|
10477
|
+
*/
|
|
10478
|
+
type TypeToken__String = `${string}`;
|
|
10479
|
+
type TypeToken__StringSet = MakeDynamic<typeof TYPE_TOKEN_STRING_SET_VARIANTS>[number];
|
|
10480
|
+
/**
|
|
10481
|
+
* Type extensions for the `number` variant.
|
|
10482
|
+
*
|
|
10483
|
+
* Allow for wide "number", a numeric literal.
|
|
10484
|
+
*/
|
|
10485
|
+
type TypeToken__Number = `::${number}`;
|
|
10486
|
+
type TypeToken__NumberSet = "bigInt" | `bigInt::${bigint}` | "digit" | `digit::${2 | 3 | 4}` | "integer";
|
|
10487
|
+
type params = string;
|
|
10488
|
+
type rtn = string;
|
|
10489
|
+
type D = TypeTokenDelimiter;
|
|
10490
|
+
type TypeToken__Fn = `[${params}]` | `[${params}]${D}${rtn}` | `any::${rtn}`;
|
|
10491
|
+
type TypeToken__Gen = `[${params}]` | `[${params}]${D}${rtn}` | `gen${D}any${D}${rtn}`;
|
|
10492
|
+
type TypeToken__FnSet = `withoutParams` | `withoutParams${D}${rtn}` | `booleanLogic` | `booleanLogic${D}[${params}]`;
|
|
10493
|
+
type RecVariant = typeof TYPE_TOKEN_REC_VARIANTS[number];
|
|
10494
|
+
type RecKeyVariant = typeof TYPE_TOKEN_REC_KEY_VARIANTS[number];
|
|
10495
|
+
type TypeToken__Rec = `${RecVariant}${D}${RecKeyVariant}` | `${D}kv${D}${string}` | `${D}kv${D}${string}${D}${"withUnknownIndex" | "withAnyIndex"}`;
|
|
10496
|
+
type TypeToken__Undefined = "";
|
|
10497
|
+
type TypeToken__Null = "";
|
|
10498
|
+
type TypeToken__Boolean = "";
|
|
10499
|
+
type TypeToken__True = "";
|
|
10500
|
+
type TypeToken__False = "";
|
|
10501
|
+
type TypeToken__Never = "";
|
|
10502
|
+
type TypeToken__Unknown = "";
|
|
10503
|
+
type TypeToken__UnionSet = typeof TYPE_TOKEN_UNION_SET_VARIANTS[number];
|
|
10504
|
+
interface _TypeTokenLookup {
|
|
10505
|
+
"string": TypeToken__String;
|
|
10506
|
+
"string-set": TypeToken__StringSet;
|
|
10507
|
+
"number": TypeToken__Number;
|
|
10508
|
+
"number-set": TypeToken__NumberSet;
|
|
10509
|
+
"undefined": TypeToken__Undefined;
|
|
10510
|
+
"null": TypeToken__Null;
|
|
10511
|
+
"boolean": TypeToken__Boolean;
|
|
10512
|
+
"true": TypeToken__True;
|
|
10513
|
+
"false": TypeToken__False;
|
|
10514
|
+
"never": TypeToken__Never;
|
|
10515
|
+
"unknown": TypeToken__Unknown;
|
|
10516
|
+
"fn": TypeToken__Fn;
|
|
10517
|
+
"fn-set": TypeToken__FnSet;
|
|
10518
|
+
"gen": TypeToken__Gen;
|
|
10519
|
+
"rec": TypeToken__Rec;
|
|
10520
|
+
"arr": "";
|
|
10521
|
+
"map": "";
|
|
10522
|
+
"weak": "";
|
|
10523
|
+
"union": "";
|
|
10524
|
+
"union-set": TypeToken__UnionSet;
|
|
10525
|
+
}
|
|
10526
|
+
/**
|
|
10527
|
+
* **TypeTokenLookup**`<T>`
|
|
10503
10528
|
*
|
|
10504
|
-
*
|
|
10505
|
-
* - Wide: `<<string>>` or `<<number>>`
|
|
10506
|
-
* - Literal: `<<string::{string}>` or `<number::{number}>`
|
|
10507
|
-
* - Union Literal: `<<string::{UnionToken}>>`
|
|
10508
|
-
* - Sets: `<<string-set::[set]::[...params]>`
|
|
10529
|
+
* Adds allowed string literal variants for a given `TypeTokenKind`
|
|
10509
10530
|
*/
|
|
10510
|
-
type
|
|
10511
|
-
|
|
10531
|
+
type TypeTokenLookup<T extends TypeTokenKind> = T extends keyof _TypeTokenLookup ? _TypeTokenLookup[T] : "";
|
|
10532
|
+
/**
|
|
10533
|
+
* TypeTokenAtomics
|
|
10534
|
+
*
|
|
10535
|
+
* The token names which are considered "atomic"
|
|
10536
|
+
*/
|
|
10537
|
+
type TypeTokenAtomics = typeof TT_ATOMICS[number];
|
|
10538
|
+
type TypeTokenContainers = typeof TT_CONTAINERS[number];
|
|
10539
|
+
type TypeTokenFunctions = typeof TT_FUNCTIONS[number];
|
|
10540
|
+
type TypeTokenSingletons = typeof TT_SINGLETONS[number];
|
|
10541
|
+
type TypeTokenSets = typeof TT_SETS[number];
|
|
10512
10542
|
/**
|
|
10513
10543
|
* **TypeTokenKind**
|
|
10514
10544
|
*
|
|
@@ -10525,24 +10555,32 @@ type TypeTokenStart = typeof TT_START;
|
|
|
10525
10555
|
* string which indicates the end of a `TypeToken`
|
|
10526
10556
|
*/
|
|
10527
10557
|
type TypeTokenStop = typeof TT_STOP;
|
|
10558
|
+
/** the _delimiter_ token used in a `TypeToken` */
|
|
10559
|
+
type TypeTokenDelimiter = typeof TT_DELIMITER;
|
|
10560
|
+
type Delim = TypeTokenDelimiter;
|
|
10528
10561
|
/**
|
|
10529
10562
|
* **TypeToken**
|
|
10530
10563
|
*
|
|
10564
|
+
* A **TypeToken** represents the general shape of all variants of the
|
|
10565
|
+
* TypeToken family. Variants are distinguished at the highest level
|
|
10566
|
+
* by their `TypeTokenKind`.
|
|
10531
10567
|
*
|
|
10568
|
+
* You can use the generic `T` to isolate to one or more of these kinds
|
|
10569
|
+
* if you like but by default all are represented.
|
|
10532
10570
|
*/
|
|
10533
|
-
type TypeToken<T extends TypeTokenKind = TypeTokenKind> = `${TypeTokenStart}${T}${"" |
|
|
10534
|
-
|
|
10535
|
-
type ProcessSimple<T extends SimpleToken | TypeToken> = T extends SimpleToken ? SimpleType<T> : never;
|
|
10536
|
-
type Iterate<T extends readonly SimpleToken[], TResult = never> = [] extends T ? TResult : Iterate<AfterFirst<T>, TResult & (First<T> extends SimpleScalarToken ? SimpleTypeScalar<First<T>> : First<T> extends SimpleDictToken ? SimpleTypeDict<First<T>> : First<T> extends SimpleMapToken ? SimpleTypeMap<First<T>> : First<T> extends SimpleSetToken ? SimpleTypeSet<First<T>> : First<T> extends SimpleArrayToken ? SimpleTypeArray<First<T>> : First<T> extends SimpleUnionToken ? SimpleTypeUnion<First<T>> : never)>;
|
|
10571
|
+
type TypeToken<T extends TypeTokenKind = TypeTokenKind> = IsEqual<T, TypeTokenKind> extends true ? `${TypeTokenStart}${T}${"" | `${Delim}${string}`}${TypeTokenStop}` : T extends TypeTokenKind ? IsUnion<T> extends true ? null : T extends TypeTokenSets ? `${TypeTokenStart}${T}${Delim}${TypeTokenLookup<T>}${TypeTokenStop}` : T extends TypeTokenAtomics ? `${TypeTokenStart}${T}${TypeTokenStop}` : `${TypeTokenStart}${T}${TypeTokenStop}` | `${TypeTokenStart}${T}${Delim}${TypeTokenLookup<T>}${TypeTokenStop}` : never;
|
|
10537
10572
|
/**
|
|
10538
|
-
*
|
|
10539
|
-
*
|
|
10540
|
-
* converts either a `SimpleToken` or a `TypeToken` into the
|
|
10541
|
-
* _type_ it represents.
|
|
10542
|
-
*
|
|
10543
|
-
* NOTE: only implemented for `SimpleToken` at the moment.
|
|
10573
|
+
* the shape of `TypeToken` variants which represent one of the Singleton variants
|
|
10544
10574
|
*/
|
|
10545
|
-
type
|
|
10575
|
+
type TT_Singleton = TypeToken<TypeTokenSingletons>;
|
|
10576
|
+
/** the shape of `TypeToken` variants which represent one of the Atomic variants */
|
|
10577
|
+
type TT_Atomic = TypeToken<TypeTokenAtomics>;
|
|
10578
|
+
/** the shape of `TypeToken` variants which a "set" of pattern based types */
|
|
10579
|
+
type TT_Set = TypeToken<TypeTokenSets>;
|
|
10580
|
+
/** the shape of `TypeToken` variants which represent a function */
|
|
10581
|
+
type TT_Function = TypeToken<TypeTokenFunctions>;
|
|
10582
|
+
/** the shape of `TypeToken` variants which represent a container */
|
|
10583
|
+
type TT_Container = TypeToken<TypeTokenContainers>;
|
|
10546
10584
|
/**
|
|
10547
10585
|
* **Shape**
|
|
10548
10586
|
*
|
|
@@ -10550,7 +10588,7 @@ type AsType<T extends SimpleToken | readonly SimpleToken[] | TypeToken> = T exte
|
|
|
10550
10588
|
* are produced as the runtime representation of a type by utilities
|
|
10551
10589
|
* like the `ShapeApi` and the `shape()` runtime function.
|
|
10552
10590
|
*/
|
|
10553
|
-
type Shape<T extends TypeTokenKind = TypeTokenKind> = `<<${T}${string}>>`;
|
|
10591
|
+
type Shape$1<T extends TypeTokenKind = TypeTokenKind> = `<<${T}${string}>>`;
|
|
10554
10592
|
interface StringTokenUtilities<T> {
|
|
10555
10593
|
/**
|
|
10556
10594
|
* **startsWith**
|
|
@@ -10713,22 +10751,27 @@ interface ShapeApi__Functions {
|
|
|
10713
10751
|
done: () => AsLiteralFn<FromDefn$1<TArgs>>;
|
|
10714
10752
|
});
|
|
10715
10753
|
}
|
|
10754
|
+
/** used in Shape callbacks */
|
|
10716
10755
|
type RecordKeyWideTokens = "string" | "symbol" | "string | symbol";
|
|
10756
|
+
type FromSimpleRecordKey<T extends RecordKeyWideTokens> = T extends "string" ? string : T extends "symbol" ? symbol : T extends "string | symbol" ? string | symbol : never;
|
|
10757
|
+
type RecordKeyDefn = RecordKeyWideTokens | ShapeCallback;
|
|
10758
|
+
type FromRecordKeyDefn<T extends RecordKeyDefn> = T extends ShapeCallback ? FromShapeCallback<T> extends ObjectKey ? FromShapeCallback<T> : never : T extends "string" ? string : T extends "symbol" ? symbol : T extends "string | symbol" ? string | symbol : never;
|
|
10717
10759
|
/**
|
|
10718
10760
|
* An input type for defining an object's "key".
|
|
10719
10761
|
*
|
|
10720
10762
|
* Note: use of `FromDefn<T>` will translate this into the actual key value.
|
|
10721
10763
|
*/
|
|
10722
10764
|
type ObjKeyDefn = RecordKeyWideTokens | ShapeCallback;
|
|
10723
|
-
type
|
|
10765
|
+
type FromObjKeyDefn<T extends ObjKeyDefn> = T extends ShapeCallback ? FromShapeCallback<T> extends ObjectKey ? FromShapeCallback<T> : never : FromRecordKeyDefn<T>;
|
|
10766
|
+
type ArrayTypeDefn = "Array<string>" | "Array<number>" | "Array<boolean>" | "Array<unknown>" | ShapeCallback;
|
|
10724
10767
|
type RecordValueTypeDefn = ShapeCallback | WideTokenNames;
|
|
10725
10768
|
type MapKeyDefn = ShapeCallback | WideTokenNames;
|
|
10726
10769
|
type MapValueDefn = ShapeCallback | WideTokenNames;
|
|
10727
10770
|
type WeakMapKeyDefn = WideContainerNames | ShapeCallback;
|
|
10728
10771
|
type WeakMapValueDefn = ShapeCallback | WideTokenNames;
|
|
10729
10772
|
interface ShapeApi__WideContainers {
|
|
10730
|
-
record: <TKey extends ObjKeyDefn = "string | symbol", TValue extends RecordValueTypeDefn = "unknown">(key?: TKey, value?: TValue) => Record<
|
|
10731
|
-
array: <T extends ArrayTypeDefn = "unknown
|
|
10773
|
+
record: <TKey extends ObjKeyDefn = "string | symbol", TValue extends RecordValueTypeDefn = "unknown">(key?: TKey, value?: TValue) => TKey extends string | symbol ? Record<FromObjKeyDefn<TKey>, FromDefn$1<TValue>> : never;
|
|
10774
|
+
array: <T extends ArrayTypeDefn = "Array<unknown>">(type?: T) => AsArray<FromDefn$1<T>>;
|
|
10732
10775
|
set: <T extends WideTokenNames | ShapeCallback = "unknown">(type?: T) => T extends ShapeCallback ? Set<HandleDoneFn<ReturnType<T>>> : T extends WideTokenNames ? Set<FromDefn$1<T>> : Set<unknown>;
|
|
10733
10776
|
map: <TKey extends MapKeyDefn = "unknown", TValue extends MapValueDefn = "unknown">(key?: TKey, value?: TValue) => Map<FromDefn$1<TKey>, FromDefn$1<TValue>>;
|
|
10734
10777
|
weakMap: <TKey extends WeakMapKeyDefn = "object", TValue extends WeakMapValueDefn = "unknown">(key?: TKey, value?: TValue) => WeakMap<As<FromDefn$1<TKey>, Container>, FromDefn$1<TValue>>;
|
|
@@ -10844,7 +10887,7 @@ type TypeTuple<TType extends Narrowable = Narrowable, TDesc extends string = str
|
|
|
10844
10887
|
* }
|
|
10845
10888
|
* ```
|
|
10846
10889
|
*
|
|
10847
|
-
* - typically used
|
|
10890
|
+
* - typically used alongside `FromDefn` or `FromDefineObject`
|
|
10848
10891
|
*/
|
|
10849
10892
|
interface DefineObject {
|
|
10850
10893
|
[key: string]: SimpleToken | ShapeCallback;
|
|
@@ -11406,7 +11449,7 @@ declare function getYesterday(): Iso8601Date<"explicit">;
|
|
|
11406
11449
|
*/
|
|
11407
11450
|
declare function isLeapYear(val: NumberLike | Record<string, any> | Date | number): boolean;
|
|
11408
11451
|
|
|
11409
|
-
type Returns$
|
|
11452
|
+
type Returns$2<T extends DefineObject, P extends readonly (keyof T & string)[]> = P["length"] extends 0 ? FromDefineObject<T> : MakeKeysOptional<T, P> extends DefineObject ? FromDefineObject<MakeKeysOptional<T, P>> : never;
|
|
11410
11453
|
/**
|
|
11411
11454
|
* Takes an object definition where the values are either
|
|
11412
11455
|
* `SimpleToken` representations of a type or a `ShapeCallback`.
|
|
@@ -11414,7 +11457,7 @@ type Returns$1<T extends DefineObject, P extends readonly (keyof T & string)[]>
|
|
|
11414
11457
|
* In both cases the runtime type is left unchanged but the
|
|
11415
11458
|
* type is converted to represent the designed object shape.
|
|
11416
11459
|
*/
|
|
11417
|
-
declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$
|
|
11460
|
+
declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$2<T, P>;
|
|
11418
11461
|
|
|
11419
11462
|
/**
|
|
11420
11463
|
* **entries**
|
|
@@ -11801,6 +11844,14 @@ type ConversionResult<TConvert extends Partial<ConverterDefn<any, any, any, any,
|
|
|
11801
11844
|
*/
|
|
11802
11845
|
declare function createConverter<TStr extends Narrowable = never, TNum extends Narrowable = never, TBool extends Narrowable = never, TObj extends Narrowable = never, TTuple extends Narrowable = never, TNothing extends Narrowable = never>(mapper: Partial<ConverterDefn<TStr, TNum, TBool, TObj, TTuple, TNothing>>): <TInput extends Narrowable | Tuple>(input: TInput) => ConversionResult<typeof mapper, TInput>;
|
|
11803
11846
|
|
|
11847
|
+
/**
|
|
11848
|
+
* **createFixedLengthArray**`(content, quantity)`
|
|
11849
|
+
*
|
|
11850
|
+
* Provides a type strong array of duplicates of what was
|
|
11851
|
+
* passed in as `content`
|
|
11852
|
+
*/
|
|
11853
|
+
declare function createFixedLengthArray<T extends Narrowable, C extends number>(content: T, quantity: C): FixedLengthArray<T, C>;
|
|
11854
|
+
|
|
11804
11855
|
declare const filter = "NOT READY";
|
|
11805
11856
|
|
|
11806
11857
|
/**
|
|
@@ -11887,7 +11938,7 @@ declare function logicalReturns<TConditions extends readonly (boolean | LogicFun
|
|
|
11887
11938
|
*/
|
|
11888
11939
|
declare function reverse<T extends readonly unknown[]>(list: T): Reverse<T>;
|
|
11889
11940
|
|
|
11890
|
-
type Rtn$
|
|
11941
|
+
type Rtn$2<T extends readonly K[] | K[] | undefined, K extends Narrowable> = IsUndefined<T> extends true ? undefined : T extends readonly K[] | K[] ? IsEqual<T["length"], number> extends true ? undefined | string : T["length"] extends 0 ? undefined : First<T> : never;
|
|
11891
11942
|
/**
|
|
11892
11943
|
* **shift**(list)
|
|
11893
11944
|
*
|
|
@@ -11905,7 +11956,7 @@ type Rtn$1<T extends readonly K[] | K[] | undefined, K extends Narrowable> = IsU
|
|
|
11905
11956
|
* `createLifoQueue()` or `createFifoQueue()`
|
|
11906
11957
|
*
|
|
11907
11958
|
*/
|
|
11908
|
-
declare function shift<T extends readonly K[] | K[] | undefined, K extends Narrowable>(list: T): Rtn$
|
|
11959
|
+
declare function shift<T extends readonly K[] | K[] | undefined, K extends Narrowable>(list: T): Rtn$2<T, K>;
|
|
11909
11960
|
|
|
11910
11961
|
/**
|
|
11911
11962
|
* **slice**(list, start, end)
|
|
@@ -11963,13 +12014,13 @@ declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
|
11963
12014
|
*/
|
|
11964
12015
|
declare function cssColor<TColorSpace extends CssColorSpace, TV1 extends ColorFnValue, TV2 extends ColorFnValue, TV3 extends ColorFnValue, TOp extends undefined | ColorFnOptOpacity>(color: TColorSpace, v1: TV1, v2: TV2, v3: TV3, opacity?: TOp): CssColorFn<TColorSpace, TV1, TV2, TV3, TOp extends ` / ${number}` ? TOp : "">;
|
|
11965
12016
|
|
|
11966
|
-
type Rtn<TColor extends TwColor, TLum extends TwLuminosity> = TLum extends keyof TwLuminosityLookup ? TLum extends keyof TwChromaLookup ? TColor extends keyof TwHue ? `oklch(${TwLuminosityLookup[TLum]} ${TwChromaLookup[TLum]} ${TwHue[TColor]}) ` : never : never : never;
|
|
12017
|
+
type Rtn$1<TColor extends TwColor, TLum extends TwLuminosity> = TLum extends keyof TwLuminosityLookup ? TLum extends keyof TwChromaLookup ? TColor extends keyof TwHue ? `oklch(${TwLuminosityLookup[TLum]} ${TwChromaLookup[TLum]} ${TwHue[TColor]}) ` : never : never : never;
|
|
11967
12018
|
/**
|
|
11968
12019
|
* Provides a Tailwind Color using the `oklch` color
|
|
11969
12020
|
* specification. The output is intended to put into
|
|
11970
12021
|
* a CSS property.
|
|
11971
12022
|
*/
|
|
11972
|
-
declare function twColor<TColor extends TwColor, TLum extends TwLuminosity>(color: TColor, luminosity: TLum): Rtn<TColor, TLum>;
|
|
12023
|
+
declare function twColor<TColor extends TwColor, TLum extends TwLuminosity>(color: TColor, luminosity: TLum): Rtn$1<TColor, TLum>;
|
|
11973
12024
|
|
|
11974
12025
|
/**
|
|
11975
12026
|
* **ensureLeading**(content, strip)
|
|
@@ -12009,14 +12060,14 @@ type _Index<T extends readonly string[], IF, ELSE, Results extends readonly unkn
|
|
|
12009
12060
|
...Results,
|
|
12010
12061
|
If<Extends<T, LowerAlphaChar>, IF, ELSE>
|
|
12011
12062
|
]>;
|
|
12012
|
-
type Returns<T extends string | readonly string[], IF, ELSE> = T extends string ? If<Extends<T, LowerAlphaChar>, IF, ELSE> : T extends readonly string[] ? _Index<T, IF, ELSE> : never;
|
|
12063
|
+
type Returns$1<T extends string | readonly string[], IF, ELSE> = T extends string ? If<Extends<T, LowerAlphaChar>, IF, ELSE> : T extends readonly string[] ? _Index<T, IF, ELSE> : never;
|
|
12013
12064
|
/**
|
|
12014
12065
|
* **ifLowercaseChar**(ch)
|
|
12015
12066
|
*
|
|
12016
12067
|
* Tests whether a passed in character is lowercase and then uses the appropriate callback to
|
|
12017
12068
|
* mutate the value.
|
|
12018
12069
|
*/
|
|
12019
|
-
declare function ifLowercaseChar<T extends string, IF, ELSE>(ch: T, callbackForMatch: <V extends T>(v: V) => IF, callbackForNoMatch: <V extends T>(v: V) => ELSE): Returns<T, IF, ELSE>;
|
|
12070
|
+
declare function ifLowercaseChar<T extends string, IF, ELSE>(ch: T, callbackForMatch: <V extends T>(v: V) => IF, callbackForNoMatch: <V extends T>(v: V) => ELSE): Returns$1<T, IF, ELSE>;
|
|
12020
12071
|
|
|
12021
12072
|
type Convert<T, IF, ELSE> = If<Extends<T, UpperAlphaChar>, IF, ELSE>;
|
|
12022
12073
|
/**
|
|
@@ -12031,6 +12082,22 @@ declare function ifUppercaseChar<T extends string, IF extends Narrowable, ELSE e
|
|
|
12031
12082
|
/** the character to be tested */
|
|
12032
12083
|
ch: T & IsSingleChar<T> extends true ? T : never, callbackForMatch: ValueCallback<T, IF>, callbackForNoMatch: ValueCallback<T, ELSE>): Convert<T, IF, ELSE>;
|
|
12033
12084
|
|
|
12085
|
+
type Ext = "string" | "number" | "boolean";
|
|
12086
|
+
type InferenceVars<T extends string, V extends readonly [str: string[], num: string[], bool: string[]] = [[], [], []]> = T extends `${string}{{${OptSpace}infer ${infer Var} extends ${infer Type extends Ext}${OptSpace}}}${infer REST}` ? Type extends "number" ? InferenceVars<REST, [V[0], [...V[1], Var], V[2]]> : Type extends "boolean" ? InferenceVars<REST, [V[0], V[1], [...V[2], Var]]> : InferenceVars<REST, [[...V[0], Var], V[1], V[2]]> : T extends `${string}{{${OptSpace}infer ${infer Var}${OptSpace}as ${infer Type extends Ext}${OptSpace}}}${infer REST}` ? Type extends "number" ? InferenceVars<REST, [V[0], [...V[1], Var], V[2]]> : Type extends "boolean" ? InferenceVars<REST, [V[0], V[1], [...V[2], Var]]> : InferenceVars<REST, [[...V[0], Var], V[1], V[2]]> : T extends `${string}{{${OptSpace}infer ${infer Var}${OptSpace}}}${infer REST}` ? InferenceVars<REST, [[...V[0], Var], V[1], V[2]]> : V;
|
|
12087
|
+
type StrVars<T extends string> = InferenceVars<T>[0];
|
|
12088
|
+
type NumVars<T extends string> = InferenceVars<T>[1];
|
|
12089
|
+
type BoolVars<T extends string> = InferenceVars<T>[2];
|
|
12090
|
+
type Shape<T extends string> = ExpandDictionary<Record<StrVars<T>[number], string> & Record<NumVars<T>[number], number> & Record<BoolVars<T>[number], boolean>>;
|
|
12091
|
+
type Lit$1 = "string" | "number" | "boolean";
|
|
12092
|
+
type LiteralSections<T extends string, V extends Lit$1[] = []> = T extends `${string}{{${OptSpace}${infer Section extends Lit$1}${OptSpace}}}${infer REST}` ? LiteralSections<REST, [...V, Section]> : V;
|
|
12093
|
+
/**
|
|
12094
|
+
* Boolean operator which indicates whether the string literal has any dynamic segments or not
|
|
12095
|
+
*/
|
|
12096
|
+
type IsDynamic<T extends string> = LiteralSections<T>["length"] extends 0 ? InferenceVars<T>["length"] extends 0 ? false : true : true;
|
|
12097
|
+
type GetInference<TPattern extends string> = <T extends string>(test: T) => Shape<TPattern> | false;
|
|
12098
|
+
type Returns<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
|
|
12099
|
+
declare function infer<TTempl extends string>(inference: TTempl): Returns<TTempl>;
|
|
12100
|
+
|
|
12034
12101
|
/**
|
|
12035
12102
|
* Takes an object as input --which has an `id` property and returns it as the same
|
|
12036
12103
|
* run-time content but with the _type_ of the `id` property being forced to a literal type
|
|
@@ -12467,6 +12534,8 @@ declare function tuple<N extends Narrowable, K extends PropertyKey, T extends re
|
|
|
12467
12534
|
*/
|
|
12468
12535
|
declare function uncapitalize<T extends string>(str: T): Uncapitalize<T>;
|
|
12469
12536
|
|
|
12537
|
+
declare const unset: Unset;
|
|
12538
|
+
|
|
12470
12539
|
/**
|
|
12471
12540
|
* **uppercase**()
|
|
12472
12541
|
*
|
|
@@ -12687,35 +12756,71 @@ declare function shape<T extends ShapeCallback>(cb: T): HandleDoneFn<ReturnType<
|
|
|
12687
12756
|
*
|
|
12688
12757
|
* Type guard which tests whether a value is a _type_ defined by a `Shape`.
|
|
12689
12758
|
*/
|
|
12690
|
-
declare function isShape(v: unknown): v is Shape;
|
|
12759
|
+
declare function isShape(v: unknown): v is Shape$1;
|
|
12691
12760
|
|
|
12692
|
-
|
|
12761
|
+
/**
|
|
12762
|
+
* A token representation of a **Parameter** definition inside
|
|
12763
|
+
* of a function token definition.
|
|
12764
|
+
*/
|
|
12765
|
+
type FnParam = string & {
|
|
12766
|
+
__brand: `parameter for function`;
|
|
12767
|
+
};
|
|
12768
|
+
type FnParams<T> = T extends readonly unknown[] ? IsLiteral<T["length"]> extends true ? Join<FixedLengthArray<FnParam, T["length"]>, ", "> : string : never;
|
|
12769
|
+
/**
|
|
12770
|
+
* A token representation of a **Parameter** definition inside
|
|
12771
|
+
* of a function token definition.
|
|
12772
|
+
*/
|
|
12773
|
+
type GenParam = string & {
|
|
12774
|
+
__brand: `parameter for generator function`;
|
|
12775
|
+
};
|
|
12776
|
+
type GenParams<T> = T extends readonly unknown[] ? IsLiteral<T["length"]> extends true ? Join<FixedLengthArray<GenParam, T["length"]>, ", "> : string : never;
|
|
12777
|
+
type Rtn = string & {
|
|
12778
|
+
__brand: `return type for a function`;
|
|
12779
|
+
};
|
|
12780
|
+
|
|
12781
|
+
type VariantClosure<TVariant extends TypeTokenKind> = TVariant extends TypeTokenAtomics ? `<<${TVariant}>>` : TVariant extends TypeTokenSingletons ? SingletonClosure<TVariant> : TVariant extends TypeTokenSets ? TokenSetClosure<TVariant> : TVariant extends TypeTokenFunctions ? TokenFunctionClosure<TVariant, Unset, Unset> : TVariant extends TypeTokenContainers ? TokenContainerClosure<TVariant> : never;
|
|
12693
12782
|
type UnionClosure = <T extends readonly unknown[]>(...elements: T) => `union::[${Join<T, ", ">}]`;
|
|
12694
12783
|
/**
|
|
12695
12784
|
* **SingletonClosure**
|
|
12696
12785
|
*
|
|
12697
12786
|
* Closes out the `string` or `number` base types to conclude as
|
|
12698
|
-
*
|
|
12699
|
-
|
|
12700
|
-
|
|
12787
|
+
* a valid Singleton Token.
|
|
12788
|
+
*/
|
|
12789
|
+
interface SingletonClosure<T extends "string" | "number"> {
|
|
12790
|
+
wide: () => `<<${T}>>`;
|
|
12791
|
+
literal: <TLit extends T extends "string" ? string : number>(val: TLit) => `<<${T}::${TLit}>>`;
|
|
12792
|
+
}
|
|
12793
|
+
/**
|
|
12794
|
+
* **TokenSetClosure**
|
|
12701
12795
|
*
|
|
12702
|
-
*
|
|
12703
|
-
*
|
|
12704
|
-
* const a = closure<"string">();
|
|
12705
|
-
* // <<string::foo>>
|
|
12706
|
-
* const b = closure<"string">("foo");
|
|
12707
|
-
* // <<string::${UnionClosure("foo", "bar")}>>
|
|
12708
|
-
* const c = closure<"string">("foo","bar");
|
|
12709
|
-
* ```
|
|
12796
|
+
* Closes out the `string` or `number` base types to conclude as
|
|
12797
|
+
* a valid Singleton Token.
|
|
12710
12798
|
*/
|
|
12711
|
-
type
|
|
12799
|
+
type TokenSetClosure<T extends TypeTokenSets> = <P extends TypeTokenLookup<T>>(_p: P) => any;
|
|
12800
|
+
type TokenContainerClosure<_T> = any;
|
|
12801
|
+
/**
|
|
12802
|
+
* Closes out the definition of a `TypeToken` for a _function_ based token
|
|
12803
|
+
*/
|
|
12804
|
+
interface TokenFunctionClosure<T extends TypeTokenFunctions, P extends (readonly (SimpleToken | ShapeCallback)[]) | Unset, R extends Unset | SimpleToken | ShapeCallback> {
|
|
12805
|
+
params: P extends Unset ? <TParams extends (readonly (SimpleToken | ShapeCallback)[])>(...p: TParams) => TokenFunctionClosure<T, TParams, R> : never;
|
|
12806
|
+
returns: R extends Unset ? <TReturns extends SimpleToken | ShapeCallback>(r: TReturns) => TokenFunctionClosure<T, P, TReturns> : never;
|
|
12807
|
+
done: () => IsUnset<P> extends true ? IsUnset<R> extends true ? `<<${T}>>` : `<<${T}::any::${string}>>` : IsUnset<R> extends true ? `<<${T}::${string}>>` : `<<${T}::${string}>>`;
|
|
12808
|
+
}
|
|
12712
12809
|
/**
|
|
12713
12810
|
* **createTypeToken**`(base) => (secondary) => ...`
|
|
12714
12811
|
*
|
|
12715
12812
|
* A higher order function designed to creating a valid
|
|
12716
12813
|
* `TypeToken` simple through a compound process.
|
|
12717
12814
|
*/
|
|
12718
|
-
declare function createTypeToken<TBase extends
|
|
12815
|
+
declare function createTypeToken<TBase extends TypeTokenKind>(kind: TBase): VariantClosure<TBase>;
|
|
12816
|
+
|
|
12817
|
+
/**
|
|
12818
|
+
* **getTokenKind**`(token)`
|
|
12819
|
+
*
|
|
12820
|
+
* Given a `TypeToken`, this function will extract the
|
|
12821
|
+
* `kind` variant name.
|
|
12822
|
+
*/
|
|
12823
|
+
declare function getTokenKind<T extends TypeToken>(token: T): TypeTokenKind;
|
|
12719
12824
|
|
|
12720
12825
|
/**
|
|
12721
12826
|
* **simpleToken**`(token)`
|
|
@@ -13532,18 +13637,6 @@ declare function isNotNull<T>(value: T): value is T & NotNull;
|
|
|
13532
13637
|
*/
|
|
13533
13638
|
declare function isNull<T>(value: T): value is T & null;
|
|
13534
13639
|
|
|
13535
|
-
/**
|
|
13536
|
-
* **isNumber**(value)
|
|
13537
|
-
*
|
|
13538
|
-
* Type guard to test whether passed in value is a numeric type.
|
|
13539
|
-
*/
|
|
13540
|
-
declare function isNumber<T>(value: T): value is T & number;
|
|
13541
|
-
|
|
13542
|
-
/**
|
|
13543
|
-
* Type guard which validates that the passed in `val` is a string array.
|
|
13544
|
-
*/
|
|
13545
|
-
declare function isNumericArray(val: unknown): val is number[];
|
|
13546
|
-
|
|
13547
13640
|
/**
|
|
13548
13641
|
* **isNumericString**(value)
|
|
13549
13642
|
*
|
|
@@ -13690,13 +13783,6 @@ declare function isTrue(value: unknown): value is true;
|
|
|
13690
13783
|
*/
|
|
13691
13784
|
declare function isTruthy<V>(val: V): val is Exclude<V, FalsyValue>;
|
|
13692
13785
|
|
|
13693
|
-
/**
|
|
13694
|
-
* **isTypeToken**(val)
|
|
13695
|
-
*
|
|
13696
|
-
* Type guard which checks whether the given value is a valid `TypeToken`
|
|
13697
|
-
*/
|
|
13698
|
-
declare function isTypeToken(val: unknown): val is TypeToken;
|
|
13699
|
-
|
|
13700
13786
|
/**
|
|
13701
13787
|
* **isTypeTuple**(value)
|
|
13702
13788
|
*
|
|
@@ -13849,40 +13935,65 @@ declare function isUrlSource<T>(val: T): val is (T & DomainName<AsString<T>>) |
|
|
|
13849
13935
|
declare function hasUrlQueryParameter<T extends string, P extends string>(val: T, prop: P): boolean;
|
|
13850
13936
|
|
|
13851
13937
|
/**
|
|
13852
|
-
* **
|
|
13938
|
+
* **isNumber**(value)
|
|
13853
13939
|
*
|
|
13854
|
-
* Type guard
|
|
13855
|
-
|
|
13940
|
+
* Type guard to test whether passed in value is a numeric type.
|
|
13941
|
+
*/
|
|
13942
|
+
declare function isNumber<T>(value: T): value is T & number;
|
|
13943
|
+
|
|
13944
|
+
/**
|
|
13945
|
+
* Type guard which validates that the passed in `val` is a string array.
|
|
13856
13946
|
*/
|
|
13857
|
-
declare function
|
|
13947
|
+
declare function isNumericArray(val: unknown): val is number[];
|
|
13858
13948
|
|
|
13859
|
-
declare function isObjectToken(val: unknown): val is ObjectToken;
|
|
13860
|
-
declare function isRecordToken(val: unknown): val is RecordToken;
|
|
13861
|
-
declare function isTupleToken(val: unknown): val is TupleToken;
|
|
13862
|
-
declare function isArrayToken(val: unknown): val is ArrayToken;
|
|
13863
|
-
declare function isMapToken(val: unknown): val is MapToken;
|
|
13864
|
-
declare function isSetToken(val: unknown): val is SetToken;
|
|
13865
|
-
declare function isWeakMapToken(val: unknown): val is WeakMapToken;
|
|
13866
13949
|
/**
|
|
13867
|
-
*
|
|
13950
|
+
* A _multi-granularity_ type guard for validating whether `val` is
|
|
13951
|
+
* a `TypeToken`.
|
|
13952
|
+
*
|
|
13953
|
+
* - when used without the `kind` parameter it will check whether `val`
|
|
13954
|
+
* is _any_ kind of `TypeToken`
|
|
13955
|
+
* - specifying a kind will narrow the check to that specific kind variant
|
|
13868
13956
|
*/
|
|
13869
|
-
declare function
|
|
13957
|
+
declare function isTypeToken<T extends TypeTokenKind = TypeTokenKind>(val: unknown, kind?: T): val is TypeToken<T>;
|
|
13870
13958
|
/**
|
|
13871
|
-
*
|
|
13959
|
+
* type guard which validates that `val` is a `TypeTokenKind`
|
|
13872
13960
|
*/
|
|
13873
|
-
declare function
|
|
13961
|
+
declare function isTypeTokenKind(val: unknown): val is TypeTokenKind;
|
|
13962
|
+
|
|
13963
|
+
/**
|
|
13964
|
+
* **isAtomicToken**`(val)`
|
|
13965
|
+
*
|
|
13966
|
+
* Type guard which validates whether the value passed in is a
|
|
13967
|
+
* valid `AtomicToken`.
|
|
13968
|
+
*/
|
|
13969
|
+
declare function isAtomicToken(val: unknown): val is TT_Atomic;
|
|
13970
|
+
declare function isAtomicKind(val: unknown): val is TypeTokenAtomics;
|
|
13971
|
+
|
|
13972
|
+
declare function isObjectToken(val: unknown): val is TypeToken<"obj">;
|
|
13973
|
+
declare function isRecordToken(val: unknown): val is TypeToken<"rec">;
|
|
13974
|
+
declare function isTupleToken(val: unknown): val is TypeToken<"tuple">;
|
|
13975
|
+
declare function isArrayToken(val: unknown): val is TypeToken<"arr">;
|
|
13976
|
+
declare function isMapToken(val: unknown): val is TypeToken<"map">;
|
|
13977
|
+
declare function isSetToken(val: unknown): val is TypeToken<"set">;
|
|
13874
13978
|
/**
|
|
13875
13979
|
* **isContainerToken**`(val)`: **val** is `ContainerToken`
|
|
13876
13980
|
*/
|
|
13877
|
-
declare function isContainerToken(val: unknown): val is
|
|
13981
|
+
declare function isContainerToken(val: unknown): val is TT_Container;
|
|
13878
13982
|
|
|
13879
13983
|
/**
|
|
13880
13984
|
* type guard which validates whether the `val` passed in a `DefineObject`
|
|
13881
13985
|
*/
|
|
13882
13986
|
declare function isDefineObject(val: unknown): val is DefineObject;
|
|
13883
13987
|
|
|
13884
|
-
|
|
13885
|
-
|
|
13988
|
+
/**
|
|
13989
|
+
* type guard which validates that `val` is a _function based_ `TypeToken`
|
|
13990
|
+
*/
|
|
13991
|
+
declare function isFnBasedToken(val: unknown): boolean | undefined;
|
|
13992
|
+
/**
|
|
13993
|
+
* type guard which validates that `val` is a `TypeTokenKind` which
|
|
13994
|
+
* represents a _function based_ token (excluding "-set" types)
|
|
13995
|
+
*/
|
|
13996
|
+
declare function isFnBasedKind(val: unknown): val is TT_Function;
|
|
13886
13997
|
|
|
13887
13998
|
/**
|
|
13888
13999
|
* type guard which validates that the `val` passed in is a `ShapeCallback`
|
|
@@ -13942,12 +14053,22 @@ declare function isSimpleScalarTokenTuple(val: unknown): val is SimpleScalarToke
|
|
|
13942
14053
|
declare function isSimpleContainerTokenTuple(val: unknown): val is SimpleContainerToken[];
|
|
13943
14054
|
|
|
13944
14055
|
/**
|
|
13945
|
-
* **
|
|
14056
|
+
* **isSetBasedToken**`(val)`
|
|
14057
|
+
*
|
|
14058
|
+
* Type guard which validates whether the value passed in is a
|
|
14059
|
+
* valid `TypeToken` who's name "kind" ends in `-set`.
|
|
14060
|
+
*/
|
|
14061
|
+
declare function isSetBasedToken(val: unknown): val is TT_Set;
|
|
14062
|
+
declare function isSetBasedKind(val: unknown): val is TypeTokenSets;
|
|
14063
|
+
|
|
14064
|
+
/**
|
|
14065
|
+
* **isSingletonKind**`(val)`
|
|
13946
14066
|
*
|
|
13947
14067
|
* Type guard which validates whether the value passed in is a
|
|
13948
|
-
* valid
|
|
14068
|
+
* valid Singleton token kind of some sort.
|
|
13949
14069
|
*/
|
|
13950
|
-
declare function
|
|
14070
|
+
declare function isSingletonKind(val: unknown): val is TypeTokenSingletons;
|
|
14071
|
+
declare function isSingletonToken(val: unknown): val is TT_Singleton;
|
|
13951
14072
|
|
|
13952
14073
|
/**
|
|
13953
14074
|
* **isTailwindColor**`(val)`
|
|
@@ -14476,4 +14597,4 @@ declare function isYouTubeVideosInPlaylist<T>(val: T): val is T & YouTubeVideosI
|
|
|
14476
14597
|
*/
|
|
14477
14598
|
declare function asVueRef<T extends Narrowable>(value: T): VueRef<T>;
|
|
14478
14599
|
|
|
14479
|
-
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type EndingWithTypeGuard, type EqualTo, type Finder, type GetEachOptions, type GetOptions, type Joiner, type KeyframeApi, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createTypeToken, cssColor, csv, defineCss, defineObj, defineObject, defineTuple, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, find, fnMeta, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTomorrow, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasDefaultValue, hasIndexOf, hasKeys, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCssAspectRatio, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy,
|
|
14600
|
+
export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type EndingWithTypeGuard, type EqualTo, type Finder, type FnParam, type FnParams, type GenParam, type GenParams, type GetEachOptions, type GetInference, type GetOptions, type Joiner, type KeyframeApi, type Rtn, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type TokenContainerClosure, type TokenFunctionClosure, type TokenSetClosure, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createTypeToken, cssColor, csv, defineCss, defineObj, defineObject, defineTuple, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, find, fnMeta, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTokenKind, getTomorrow, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasDefaultValue, hasIndexOf, hasKeys, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, infer, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicKind, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCssAspectRatio, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy, isFnBasedKind, isFnBasedToken, isFnWithParams, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtmlElement, isIkeaUrl, isIndexable, isIndianNewsUrl, isInlineSvg, isIp4Address, isIp6Address, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoTime, isIsoYear, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDateTime, isMacysUrl, isMapToken, isMassMetric, isMassUom, isMetric, isMexicanNewsUrl, isMoment, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistance, isResistanceUom, isRetailUrl, isSameTypeOf, isScalar, isSemanticVersion, isSet, isSetBasedKind, isSetBasedToken, isSetToken, isShape, isShapeCallback, isSimpleContainerToken, isSimpleContainerTokenTuple, isSimpleScalarToken, isSimpleScalarTokenTuple, isSimpleToken, isSimpleTokenTuple, isSingletonKind, isSingletonToken, isSocialMediaProfileUrl, isSocialMediaUrl, isSouthKoreanNewsUrl, isSpanishNewsUrl, isSpecificConstant, isSpeedMetric, isSpeedUom, isString, isStringArray, isSwissNewsUrl, isSymbol, isTailwindColor, isTailwindColorClass, isTailwindColorName, isTailwindColorTarget, isTailwindColorWithLuminosity, isTailwindColorWithLuminosityAndOpacity, isTailwindModifier, isTargetUrl, isTemperatureMetric, isTemperatureUom, isThenable, isThisMonth, isThisWeek, isThisYear, isTimeMetric, isTimeUom, isToday, isTomorrow, isTrimable, isTrue, isTruthy, isTuple, isTupleToken, isTurkishNewsUrl, isTypeOf, isTypeToken, isTypeTokenKind, isTypeTuple, isUkNewsUrl, isUndefined, isUnset, isUom, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsStateAbbreviation, isUsStateName, isVoltageMetric, isVoltageUom, isVolumeMetric, isVolumeUom, isWalgreensUrl, isWalmartUrl, isWayfairUrl, isWholeFoodsUrl, isYesterday, isYouTubeCreatorUrl, isYouTubeFeedHistoryUrl, isYouTubeFeedUrl, isYouTubePlaylistUrl, isYouTubePlaylistsUrl, isYouTubeShareUrl, isYouTubeSubscriptionsUrl, isYouTubeTrendingUrl, isYouTubeUrl, isYouTubeVideoUrl, isYouTubeVideosInPlaylist, isZaraUrl, isZipCode, isZipCode5, isZipPlus4, joinWith, jsonValue, jsonValues, keysOf, kindLiteral, last, list, literal, logicalReturns, lookupCountryAlpha2, lookupCountryAlpha3, lookupCountryCode, lookupCountryName, lowercase, mergeObjects, mergeScalars, mergeTuples, nameLiteral, narrow, never, omit, optional, optionalOrNull, or, orNull, pathJoin, pluralize, removePhoneCountryCode, removeTailwindModifiers, removeUrlProtocol, result, retain, retainAfter, retainAfterInclusive, retainChars, retainUntil, retainUntilInclusive, retainWhile, reverse, rightWhitespace, shape, sharedKeys, shift, simpleContainerToken, simpleContainerTokenToTypeToken, simpleContainerType, simpleScalarToken, simpleScalarTokenToTypeToken, simpleScalarType, simpleToken, simpleType, simpleUnionTokenToTypeToken, slice, split, startsWith, stripAfter, stripBefore, stripChars, stripLeading, stripParenthesis, stripSurround, stripTrailing, stripUntil, stripWhile, surround, takeNumericCharacters, takeProp, toCamelCase, toKebabCase, toNumber, toNumericArray, toPascalCase, toSnakeCase, toString, toUppercase, trim, trimEnd, trimLeft, trimRight, trimStart, truncate, tuple, twColor, unbox, uncapitalize, union, unionize, unique, uniqueKeys, unset, uppercase, urlMeta, valuesOf, widen, withDefaults, withKeys, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };
|