inferred-types 0.48.3 → 0.48.5
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/dist/constants/TypeTokens.d.ts +12 -7
- package/dist/constants/TypeTokens.d.ts.map +1 -1
- package/dist/constants/TypeTokens.js +71 -49
- package/dist/constants/tsconfig.tsbuildinfo +1 -1
- package/dist/inferred-types/index.cjs +89 -64
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/literals/tuple.d.ts +2 -2
- package/dist/runtime/literals/tuple.d.ts.map +1 -1
- package/dist/runtime/runtime-types/asToken.d.ts.map +1 -1
- package/dist/runtime/runtime-types/asToken.js +10 -14
- package/dist/runtime/runtime-types/asType.d.ts +6 -1
- package/dist/runtime/runtime-types/asType.d.ts.map +1 -1
- package/dist/runtime/runtime-types/asType.js +7 -2
- package/dist/runtime/runtime-types/tokens/simpleToken.d.ts.map +1 -1
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-guards/isContainer.d.ts +4 -2
- package/dist/runtime/type-guards/isContainer.d.ts.map +1 -1
- package/dist/runtime/type-guards/isContainer.js +3 -1
- package/dist/types/boolean-logic/operators/HasSameValues.d.ts +3 -2
- package/dist/types/boolean-logic/operators/HasSameValues.d.ts.map +1 -1
- package/dist/types/runtime-types/AsType.d.ts +3 -3
- package/dist/types/runtime-types/AsType.d.ts.map +1 -1
- package/dist/types/runtime-types/SimpleType.d.ts +7 -20
- package/dist/types/runtime-types/SimpleType.d.ts.map +1 -1
- package/dist/types/runtime-types/TypeToken.d.ts +30 -4
- package/dist/types/runtime-types/TypeToken.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flatten, Narrowable } from "../../types/index";
|
|
2
2
|
/**
|
|
3
3
|
* **tuple**(value)
|
|
4
4
|
*
|
|
@@ -9,5 +9,5 @@ import { First, If, IsUnion, Length, Narrowable, UnionToTuple } from "../../type
|
|
|
9
9
|
* const t2 = tuple([1,2,3]);
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
export declare const tuple: <N extends Narrowable, K extends PropertyKey, T extends readonly (Record<K, N> | Narrowable)[]>(...values: T) =>
|
|
12
|
+
export declare const tuple: <N extends Narrowable, K extends PropertyKey, T extends readonly (Record<K, N> | Narrowable)[]>(...values: T) => Flatten<T>;
|
|
13
13
|
//# sourceMappingURL=tuple.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../src/runtime/literals/tuple.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../src/runtime/literals/tuple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAuB,UAAU,EAAgB,0BAAwB;AAGhG;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAChB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,aACrC,CAAC,KAkBsB,OAAO,CAAC,CAAC,CAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asToken.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime-types/asToken.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EACjB,0BAAwB;
|
|
1
|
+
{"version":3,"file":"asToken.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime-types/asToken.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EACjB,0BAAwB;AAczB,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,QAAQ,CAAC,WAE1D,CAAA;AAoCD;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS,iBAAiB,OAAO,CAAC,KAazE,UAAU,CAAC,CAAC,CAClB,CAAA;AA6BD;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,GAAI,CAAC,SAAS,gBAAgB,OAAO,CAAC,KAKvE,UAAU,CAAC,CAAC,CAClB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,GAAI,CAAC,SAAS,oBAAoB,QAAQ,CAAC,SAEtF,CAAA;AAID,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,UAAU,QAAQ,CAAC,WAExD,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isBooleanLike, isNumberLike, isSimpleContainerToken, isSimpleScalarToken, simpleScalarToken, stripAfter, stripBefore, stripSurround } from "../index.js";
|
|
2
|
+
import { Never } from "../../constants/Never.js";
|
|
2
3
|
// TODO
|
|
3
4
|
export const asSimpleToken = (_val) => {
|
|
4
5
|
return "not ready";
|
|
@@ -21,12 +22,12 @@ const _containerToToken = {
|
|
|
21
22
|
"array(number)": "",
|
|
22
23
|
"array(unknown)": "",
|
|
23
24
|
};
|
|
24
|
-
const unionToToken = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
25
|
+
// const unionToToken : Record<string, unknown> = {
|
|
26
|
+
// "Opt<string>": "<<union::[ <<string>>, <<undefined>> ]>>" as unknown ,
|
|
27
|
+
// "Opt<number>": "<<union::[ <<number>>, <<undefined>> ]>>" as unknown,
|
|
28
|
+
// "Opt<unknown>": "<<union::[ <<unknown>>, <<undefined>> ]>>" as unknown,
|
|
29
|
+
// "Opt<boolean>": "<<union::[ <<boolean>>, <<undefined>> ]>>" as unknown,
|
|
30
|
+
// } satisfies Record<SimpleUnionToken, unknown>
|
|
30
31
|
const stringLiteral = (str) => {
|
|
31
32
|
return stripAfter(stripBefore(str, "string("), ")");
|
|
32
33
|
};
|
|
@@ -76,7 +77,6 @@ const union = (nodes) => {
|
|
|
76
77
|
? nodes.split(/,\s{0,1}/).map(n => unionNode(n)).join(", ")
|
|
77
78
|
: unionNode(nodes);
|
|
78
79
|
};
|
|
79
|
-
const stripOpt = stripSurround("opt(", ")");
|
|
80
80
|
const stripUnion = stripSurround("Union(", ")");
|
|
81
81
|
/**
|
|
82
82
|
* **simpleUnionTokenToTypeToken**`(val)`
|
|
@@ -89,13 +89,9 @@ const stripUnion = stripSurround("Union(", ")");
|
|
|
89
89
|
* as being a numeric or a boolean literal and use that type if it is
|
|
90
90
|
*/
|
|
91
91
|
export const simpleUnionTokenToTypeToken = (val) => {
|
|
92
|
-
return (val
|
|
93
|
-
?
|
|
94
|
-
:
|
|
95
|
-
? `<<union::[ ${union(stripUnion(val))} ]>>`
|
|
96
|
-
: val.startsWith(`opt(`) && val.endsWith(`)`)
|
|
97
|
-
? `<<union::[ ${union(stripOpt(val))}, <<undefined>> ]>>`
|
|
98
|
-
: `<<never>>`);
|
|
92
|
+
return (val.startsWith(`Union(`) && val.endsWith(`)`)
|
|
93
|
+
? `<<union::[ ${union(stripUnion(val))} ]>>`
|
|
94
|
+
: Never);
|
|
99
95
|
};
|
|
100
96
|
/**
|
|
101
97
|
* **simpleContainerTokenToTypeToken**`(val)`
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { SimpleScalarToken, SimpleToken, SimpleType } from "../../types/runtime-types";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* **asType**(token)**
|
|
4
|
+
*
|
|
5
|
+
* Converts a `SimpleToken` into it's corresponding _type_.
|
|
6
|
+
*/
|
|
7
|
+
export declare const asType: <T extends SimpleToken>(token: T) => SimpleType<T>;
|
|
3
8
|
export declare const asStringLiteral: <T extends readonly SimpleScalarToken[]>(...values: T) => any[];
|
|
4
9
|
//# sourceMappingURL=asType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asType.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime-types/asType.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,WAAW,EACX,UAAU,EACX,kCAAgC;
|
|
1
|
+
{"version":3,"file":"asType.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime-types/asType.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,WAAW,EACX,UAAU,EACX,kCAAgC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,MAAM,GACjB,CAAC,SAAS,WAAW,SACd,CAAC,KAIQ,UAAU,CAAC,CAAC,CAC7B,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,CAAC,SAAS,SAAS,iBAAiB,EAAE,aAC3B,CAAC,UAGb,CAAA"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* **asType**(token)**
|
|
3
|
+
*
|
|
4
|
+
* Converts a `SimpleToken` into it's corresponding _type_.
|
|
5
|
+
*/
|
|
6
|
+
export const asType = (token) => {
|
|
7
|
+
return (token);
|
|
3
8
|
};
|
|
4
9
|
export const asStringLiteral = (...values) => {
|
|
5
10
|
return values.map(i => i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleToken.d.ts","sourceRoot":"","sources":["../../../../src/runtime/runtime-types/tokens/simpleToken.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,UAAU,EACX,6BAAwB;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,SAAS,CAAC,MAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"simpleToken.d.ts","sourceRoot":"","sources":["../../../../src/runtime/runtime-types/tokens/simpleToken.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,UAAU,EACX,6BAAwB;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,SAAS,CAAC,MAAU,CAAC;AAGtE;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,iBAAiB,SAAS,CAAC,MAAU,CAAC;AAElF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,oBAAoB,SAAS,CAAC,MAAU,CAAC;AAGxF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,iBAAiB,SAAS,CAAC,KAGpD,UAAU,CAAC,CAAC,CAC7B,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,oBAAoB,SAAS,CAAC,KAG1D,UAAU,CAAC,CAAC,CAC7B,CAAA;AAGD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,SAAS,CAAC,KASxC,UAAU,CAAC,CAAC,CAC7B,CAAA"}
|