typia 6.7.2 → 6.8.0-dev.20240811
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/lib/programmers/internal/application_bigint.d.ts +1 -0
- package/lib/programmers/internal/application_bigint.js +14 -0
- package/lib/programmers/internal/application_bigint.js.map +1 -0
- package/lib/programmers/internal/application_v30_schema.js +10 -12
- package/lib/programmers/internal/application_v30_schema.js.map +1 -1
- package/lib/programmers/internal/application_v31_constant.js +3 -1
- package/lib/programmers/internal/application_v31_constant.js.map +1 -1
- package/lib/programmers/internal/application_v31_schema.js +10 -12
- package/lib/programmers/internal/application_v31_schema.js.map +1 -1
- package/lib/tags/Constant.d.ts +2 -2
- package/lib/tags/Default.d.ts +5 -1
- package/lib/tags/ExclusiveMaximum.d.ts +9 -5
- package/lib/tags/ExclusiveMinimum.d.ts +9 -5
- package/lib/tags/JsonSchemaPlugin.d.ts +1 -1
- package/lib/tags/Maximum.d.ts +8 -5
- package/lib/tags/Minimum.d.ts +8 -5
- package/lib/tags/MultipleOf.d.ts +7 -4
- package/package.json +2 -2
- package/src/factories/CommentFactory.ts +79 -79
- package/src/factories/MetadataCollection.ts +274 -274
- package/src/factories/MetadataFactory.ts +272 -272
- package/src/factories/StatementFactory.ts +74 -74
- package/src/factories/TypeFactory.ts +118 -118
- package/src/factories/internal/metadata/emplace_metadata_array_type.ts +42 -42
- package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -176
- package/src/factories/internal/metadata/iterate_metadata.ts +94 -94
- package/src/factories/internal/metadata/iterate_metadata_array.ts +63 -63
- package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
- package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +76 -76
- package/src/factories/internal/metadata/iterate_metadata_intersection.ts +213 -213
- package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
- package/src/factories/internal/metadata/iterate_metadata_native.ts +220 -220
- package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
- package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
- package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
- package/src/programmers/internal/application_bigint.ts +25 -0
- package/src/programmers/internal/application_v30_alias.ts +52 -52
- package/src/programmers/internal/application_v30_object.ts +149 -149
- package/src/programmers/internal/application_v30_schema.ts +162 -159
- package/src/programmers/internal/application_v30_tuple.ts +33 -33
- package/src/programmers/internal/application_v31_constant.ts +4 -1
- package/src/programmers/internal/application_v31_schema.ts +159 -157
- package/src/programmers/json/JsonApplicationProgrammer.ts +82 -82
- package/src/schemas/metadata/IMetadataConstantValue.ts +11 -11
- package/src/schemas/metadata/IMetadataTemplate.ts +7 -7
- package/src/tags/Constant.ts +2 -2
- package/src/tags/Default.ts +7 -3
- package/src/tags/ExclusiveMaximum.ts +12 -6
- package/src/tags/ExclusiveMinimum.ts +12 -6
- package/src/tags/JsonSchemaPlugin.ts +1 -1
- package/src/tags/Maximum.ts +9 -8
- package/src/tags/Minimum.ts +9 -8
- package/src/tags/MultipleOf.ts +9 -8
- package/src/tags/Type.ts +32 -32
- package/src/transformers/FileTransformer.ts +91 -91
- package/src/transformers/features/CreateRandomTransformer.ts +40 -40
- package/src/transformers/features/RandomTransformer.ts +44 -44
- package/src/transformers/features/json/JsonApplicationTransformer.ts +124 -124
- package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
- package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
- package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +62 -62
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { TypeFactory } from "./TypeFactory";
|
|
4
|
-
|
|
5
|
-
export namespace StatementFactory {
|
|
6
|
-
export const mut = (name: string, initializer?: ts.Expression) =>
|
|
7
|
-
ts.factory.createVariableStatement(
|
|
8
|
-
undefined,
|
|
9
|
-
ts.factory.createVariableDeclarationList(
|
|
10
|
-
[
|
|
11
|
-
ts.factory.createVariableDeclaration(
|
|
12
|
-
name,
|
|
13
|
-
undefined,
|
|
14
|
-
initializer === undefined ? TypeFactory.keyword("any") : undefined,
|
|
15
|
-
initializer,
|
|
16
|
-
),
|
|
17
|
-
],
|
|
18
|
-
ts.NodeFlags.Let,
|
|
19
|
-
),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export const constant = (name: string, initializer?: ts.Expression) =>
|
|
23
|
-
ts.factory.createVariableStatement(
|
|
24
|
-
undefined,
|
|
25
|
-
ts.factory.createVariableDeclarationList(
|
|
26
|
-
[
|
|
27
|
-
ts.factory.createVariableDeclaration(
|
|
28
|
-
name,
|
|
29
|
-
undefined,
|
|
30
|
-
undefined,
|
|
31
|
-
initializer,
|
|
32
|
-
),
|
|
33
|
-
],
|
|
34
|
-
ts.NodeFlags.Const,
|
|
35
|
-
),
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export const entry = (key: string) => (value: string) =>
|
|
39
|
-
ts.factory.createVariableDeclarationList(
|
|
40
|
-
[
|
|
41
|
-
ts.factory.createVariableDeclaration(
|
|
42
|
-
ts.factory.createArrayBindingPattern([
|
|
43
|
-
ts.factory.createBindingElement(
|
|
44
|
-
undefined,
|
|
45
|
-
undefined,
|
|
46
|
-
ts.factory.createIdentifier(key),
|
|
47
|
-
undefined,
|
|
48
|
-
),
|
|
49
|
-
ts.factory.createBindingElement(
|
|
50
|
-
undefined,
|
|
51
|
-
undefined,
|
|
52
|
-
ts.factory.createIdentifier(value),
|
|
53
|
-
undefined,
|
|
54
|
-
),
|
|
55
|
-
]),
|
|
56
|
-
undefined,
|
|
57
|
-
undefined,
|
|
58
|
-
undefined,
|
|
59
|
-
),
|
|
60
|
-
],
|
|
61
|
-
ts.NodeFlags.Const,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
export const transpile = (script: string) =>
|
|
65
|
-
ts.factory.createExpressionStatement(
|
|
66
|
-
ts.factory.createIdentifier(ts.transpile(script)),
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
export const block = (expression: ts.Expression) =>
|
|
70
|
-
ts.factory.createBlock(
|
|
71
|
-
[ts.factory.createExpressionStatement(expression)],
|
|
72
|
-
true,
|
|
73
|
-
);
|
|
74
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { TypeFactory } from "./TypeFactory";
|
|
4
|
+
|
|
5
|
+
export namespace StatementFactory {
|
|
6
|
+
export const mut = (name: string, initializer?: ts.Expression) =>
|
|
7
|
+
ts.factory.createVariableStatement(
|
|
8
|
+
undefined,
|
|
9
|
+
ts.factory.createVariableDeclarationList(
|
|
10
|
+
[
|
|
11
|
+
ts.factory.createVariableDeclaration(
|
|
12
|
+
name,
|
|
13
|
+
undefined,
|
|
14
|
+
initializer === undefined ? TypeFactory.keyword("any") : undefined,
|
|
15
|
+
initializer,
|
|
16
|
+
),
|
|
17
|
+
],
|
|
18
|
+
ts.NodeFlags.Let,
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const constant = (name: string, initializer?: ts.Expression) =>
|
|
23
|
+
ts.factory.createVariableStatement(
|
|
24
|
+
undefined,
|
|
25
|
+
ts.factory.createVariableDeclarationList(
|
|
26
|
+
[
|
|
27
|
+
ts.factory.createVariableDeclaration(
|
|
28
|
+
name,
|
|
29
|
+
undefined,
|
|
30
|
+
undefined,
|
|
31
|
+
initializer,
|
|
32
|
+
),
|
|
33
|
+
],
|
|
34
|
+
ts.NodeFlags.Const,
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const entry = (key: string) => (value: string) =>
|
|
39
|
+
ts.factory.createVariableDeclarationList(
|
|
40
|
+
[
|
|
41
|
+
ts.factory.createVariableDeclaration(
|
|
42
|
+
ts.factory.createArrayBindingPattern([
|
|
43
|
+
ts.factory.createBindingElement(
|
|
44
|
+
undefined,
|
|
45
|
+
undefined,
|
|
46
|
+
ts.factory.createIdentifier(key),
|
|
47
|
+
undefined,
|
|
48
|
+
),
|
|
49
|
+
ts.factory.createBindingElement(
|
|
50
|
+
undefined,
|
|
51
|
+
undefined,
|
|
52
|
+
ts.factory.createIdentifier(value),
|
|
53
|
+
undefined,
|
|
54
|
+
),
|
|
55
|
+
]),
|
|
56
|
+
undefined,
|
|
57
|
+
undefined,
|
|
58
|
+
undefined,
|
|
59
|
+
),
|
|
60
|
+
],
|
|
61
|
+
ts.NodeFlags.Const,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export const transpile = (script: string) =>
|
|
65
|
+
ts.factory.createExpressionStatement(
|
|
66
|
+
ts.factory.createIdentifier(ts.transpile(script)),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
export const block = (expression: ts.Expression) =>
|
|
70
|
+
ts.factory.createBlock(
|
|
71
|
+
[ts.factory.createExpressionStatement(expression)],
|
|
72
|
+
true,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
export namespace TypeFactory {
|
|
4
|
-
export const isFunction = (type: ts.Type): boolean =>
|
|
5
|
-
getFunction(type) !== null;
|
|
6
|
-
|
|
7
|
-
const getFunction = (type: ts.Type) => {
|
|
8
|
-
const node = type.symbol?.declarations?.[0];
|
|
9
|
-
if (node === undefined) return null;
|
|
10
|
-
|
|
11
|
-
return ts.isFunctionLike(node)
|
|
12
|
-
? node
|
|
13
|
-
: ts.isPropertyAssignment(node) || ts.isPropertyDeclaration(node)
|
|
14
|
-
? ts.isFunctionLike(node.initializer)
|
|
15
|
-
? node.initializer
|
|
16
|
-
: null
|
|
17
|
-
: null;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const getReturnType =
|
|
21
|
-
(checker: ts.TypeChecker) =>
|
|
22
|
-
(type: ts.Type) =>
|
|
23
|
-
(name: string): ts.Type | null => {
|
|
24
|
-
// FIND TO-JSON METHOD
|
|
25
|
-
const symbol: ts.Symbol | undefined = type.getProperty(name);
|
|
26
|
-
if (!symbol) return null;
|
|
27
|
-
else if (!symbol.valueDeclaration) return null;
|
|
28
|
-
|
|
29
|
-
// GET FUNCTION DECLARATION
|
|
30
|
-
const functor: ts.Type = checker.getTypeOfSymbolAtLocation(
|
|
31
|
-
symbol,
|
|
32
|
-
symbol.valueDeclaration,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// RETURNS THE RETURN-TYPE
|
|
36
|
-
const signature: ts.Signature | undefined = checker.getSignaturesOfType(
|
|
37
|
-
functor,
|
|
38
|
-
ts.SignatureKind.Call,
|
|
39
|
-
)[0];
|
|
40
|
-
return signature ? signature.getReturnType() : null;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const getFullName =
|
|
44
|
-
(checker: ts.TypeChecker) =>
|
|
45
|
-
(type: ts.Type, symbol?: ts.Symbol): string => {
|
|
46
|
-
// PRIMITIVE
|
|
47
|
-
symbol ??= type.aliasSymbol ?? type.getSymbol();
|
|
48
|
-
if (symbol === undefined) return checker.typeToString(type);
|
|
49
|
-
|
|
50
|
-
// UNION OR INTERSECT
|
|
51
|
-
if (type.aliasSymbol === undefined && type.isUnionOrIntersection()) {
|
|
52
|
-
const joiner: string = type.isIntersection() ? " & " : " | ";
|
|
53
|
-
return type.types
|
|
54
|
-
.map((child) => getFullName(checker)(child))
|
|
55
|
-
.join(joiner);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
//----
|
|
59
|
-
// SPECIALIZATION
|
|
60
|
-
//----
|
|
61
|
-
const name: string = get_name(symbol);
|
|
62
|
-
|
|
63
|
-
// CHECK GENERIC
|
|
64
|
-
const generic: readonly ts.Type[] = type.aliasSymbol
|
|
65
|
-
? type.aliasTypeArguments || []
|
|
66
|
-
: checker.getTypeArguments(type as ts.TypeReference);
|
|
67
|
-
return generic.length
|
|
68
|
-
? name === "Promise"
|
|
69
|
-
? getFullName(checker)(generic[0]!)
|
|
70
|
-
: `${name}<${generic
|
|
71
|
-
.map((child) => getFullName(checker)(child))
|
|
72
|
-
.join(", ")}>`
|
|
73
|
-
: name;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const explore_name =
|
|
77
|
-
(decl: ts.Node) =>
|
|
78
|
-
(name: string): string =>
|
|
79
|
-
ts.isModuleBlock(decl)
|
|
80
|
-
? explore_name(decl.parent.parent)(
|
|
81
|
-
`${decl.parent.name.getFullText().trim()}.${name}`,
|
|
82
|
-
)
|
|
83
|
-
: name;
|
|
84
|
-
|
|
85
|
-
const get_name = (symbol: ts.Symbol): string => {
|
|
86
|
-
const parent = symbol.getDeclarations()?.[0]?.parent;
|
|
87
|
-
return parent
|
|
88
|
-
? explore_name(parent)(symbol.escapedName.toString())
|
|
89
|
-
: "__type";
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const keyword = (
|
|
93
|
-
type:
|
|
94
|
-
| "void"
|
|
95
|
-
| "any"
|
|
96
|
-
| "unknown"
|
|
97
|
-
| "boolean"
|
|
98
|
-
| "number"
|
|
99
|
-
| "bigint"
|
|
100
|
-
| "string",
|
|
101
|
-
) => {
|
|
102
|
-
return ts.factory.createKeywordTypeNode(
|
|
103
|
-
type === "void"
|
|
104
|
-
? ts.SyntaxKind.VoidKeyword
|
|
105
|
-
: type === "any"
|
|
106
|
-
? ts.SyntaxKind.AnyKeyword
|
|
107
|
-
: type === "unknown"
|
|
108
|
-
? ts.SyntaxKind.UnknownKeyword
|
|
109
|
-
: type === "boolean"
|
|
110
|
-
? ts.SyntaxKind.BooleanKeyword
|
|
111
|
-
: type === "number"
|
|
112
|
-
? ts.SyntaxKind.NumberKeyword
|
|
113
|
-
: type === "bigint"
|
|
114
|
-
? ts.SyntaxKind.BigIntKeyword
|
|
115
|
-
: ts.SyntaxKind.StringKeyword,
|
|
116
|
-
);
|
|
117
|
-
};
|
|
118
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
export namespace TypeFactory {
|
|
4
|
+
export const isFunction = (type: ts.Type): boolean =>
|
|
5
|
+
getFunction(type) !== null;
|
|
6
|
+
|
|
7
|
+
const getFunction = (type: ts.Type) => {
|
|
8
|
+
const node = type.symbol?.declarations?.[0];
|
|
9
|
+
if (node === undefined) return null;
|
|
10
|
+
|
|
11
|
+
return ts.isFunctionLike(node)
|
|
12
|
+
? node
|
|
13
|
+
: ts.isPropertyAssignment(node) || ts.isPropertyDeclaration(node)
|
|
14
|
+
? ts.isFunctionLike(node.initializer)
|
|
15
|
+
? node.initializer
|
|
16
|
+
: null
|
|
17
|
+
: null;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const getReturnType =
|
|
21
|
+
(checker: ts.TypeChecker) =>
|
|
22
|
+
(type: ts.Type) =>
|
|
23
|
+
(name: string): ts.Type | null => {
|
|
24
|
+
// FIND TO-JSON METHOD
|
|
25
|
+
const symbol: ts.Symbol | undefined = type.getProperty(name);
|
|
26
|
+
if (!symbol) return null;
|
|
27
|
+
else if (!symbol.valueDeclaration) return null;
|
|
28
|
+
|
|
29
|
+
// GET FUNCTION DECLARATION
|
|
30
|
+
const functor: ts.Type = checker.getTypeOfSymbolAtLocation(
|
|
31
|
+
symbol,
|
|
32
|
+
symbol.valueDeclaration,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// RETURNS THE RETURN-TYPE
|
|
36
|
+
const signature: ts.Signature | undefined = checker.getSignaturesOfType(
|
|
37
|
+
functor,
|
|
38
|
+
ts.SignatureKind.Call,
|
|
39
|
+
)[0];
|
|
40
|
+
return signature ? signature.getReturnType() : null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const getFullName =
|
|
44
|
+
(checker: ts.TypeChecker) =>
|
|
45
|
+
(type: ts.Type, symbol?: ts.Symbol): string => {
|
|
46
|
+
// PRIMITIVE
|
|
47
|
+
symbol ??= type.aliasSymbol ?? type.getSymbol();
|
|
48
|
+
if (symbol === undefined) return checker.typeToString(type);
|
|
49
|
+
|
|
50
|
+
// UNION OR INTERSECT
|
|
51
|
+
if (type.aliasSymbol === undefined && type.isUnionOrIntersection()) {
|
|
52
|
+
const joiner: string = type.isIntersection() ? " & " : " | ";
|
|
53
|
+
return type.types
|
|
54
|
+
.map((child) => getFullName(checker)(child))
|
|
55
|
+
.join(joiner);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//----
|
|
59
|
+
// SPECIALIZATION
|
|
60
|
+
//----
|
|
61
|
+
const name: string = get_name(symbol);
|
|
62
|
+
|
|
63
|
+
// CHECK GENERIC
|
|
64
|
+
const generic: readonly ts.Type[] = type.aliasSymbol
|
|
65
|
+
? type.aliasTypeArguments || []
|
|
66
|
+
: checker.getTypeArguments(type as ts.TypeReference);
|
|
67
|
+
return generic.length
|
|
68
|
+
? name === "Promise"
|
|
69
|
+
? getFullName(checker)(generic[0]!)
|
|
70
|
+
: `${name}<${generic
|
|
71
|
+
.map((child) => getFullName(checker)(child))
|
|
72
|
+
.join(", ")}>`
|
|
73
|
+
: name;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const explore_name =
|
|
77
|
+
(decl: ts.Node) =>
|
|
78
|
+
(name: string): string =>
|
|
79
|
+
ts.isModuleBlock(decl)
|
|
80
|
+
? explore_name(decl.parent.parent)(
|
|
81
|
+
`${decl.parent.name.getFullText().trim()}.${name}`,
|
|
82
|
+
)
|
|
83
|
+
: name;
|
|
84
|
+
|
|
85
|
+
const get_name = (symbol: ts.Symbol): string => {
|
|
86
|
+
const parent = symbol.getDeclarations()?.[0]?.parent;
|
|
87
|
+
return parent
|
|
88
|
+
? explore_name(parent)(symbol.escapedName.toString())
|
|
89
|
+
: "__type";
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const keyword = (
|
|
93
|
+
type:
|
|
94
|
+
| "void"
|
|
95
|
+
| "any"
|
|
96
|
+
| "unknown"
|
|
97
|
+
| "boolean"
|
|
98
|
+
| "number"
|
|
99
|
+
| "bigint"
|
|
100
|
+
| "string",
|
|
101
|
+
) => {
|
|
102
|
+
return ts.factory.createKeywordTypeNode(
|
|
103
|
+
type === "void"
|
|
104
|
+
? ts.SyntaxKind.VoidKeyword
|
|
105
|
+
: type === "any"
|
|
106
|
+
? ts.SyntaxKind.AnyKeyword
|
|
107
|
+
: type === "unknown"
|
|
108
|
+
? ts.SyntaxKind.UnknownKeyword
|
|
109
|
+
: type === "boolean"
|
|
110
|
+
? ts.SyntaxKind.BooleanKeyword
|
|
111
|
+
: type === "number"
|
|
112
|
+
? ts.SyntaxKind.NumberKeyword
|
|
113
|
+
: type === "bigint"
|
|
114
|
+
? ts.SyntaxKind.BigIntKeyword
|
|
115
|
+
: ts.SyntaxKind.StringKeyword,
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { Metadata } from "../../../schemas/metadata/Metadata";
|
|
4
|
-
import { MetadataArrayType } from "../../../schemas/metadata/MetadataArrayType";
|
|
5
|
-
|
|
6
|
-
import { ArrayUtil } from "../../../utils/ArrayUtil";
|
|
7
|
-
|
|
8
|
-
import { MetadataCollection } from "../../MetadataCollection";
|
|
9
|
-
import { MetadataFactory } from "../../MetadataFactory";
|
|
10
|
-
import { explore_metadata } from "./explore_metadata";
|
|
11
|
-
|
|
12
|
-
export const emplace_metadata_array_type =
|
|
13
|
-
(checker: ts.TypeChecker) =>
|
|
14
|
-
(options: MetadataFactory.IOptions) =>
|
|
15
|
-
(collection: MetadataCollection) =>
|
|
16
|
-
(errors: MetadataFactory.IError[]) =>
|
|
17
|
-
(
|
|
18
|
-
aliasType: ts.Type,
|
|
19
|
-
arrayType: ts.Type,
|
|
20
|
-
nullable: boolean,
|
|
21
|
-
explore: MetadataFactory.IExplore,
|
|
22
|
-
): MetadataArrayType => {
|
|
23
|
-
// CHECK EXISTENCE
|
|
24
|
-
const [array, newbie, setValue] = collection.emplaceArray(
|
|
25
|
-
checker,
|
|
26
|
-
aliasType,
|
|
27
|
-
);
|
|
28
|
-
ArrayUtil.add(array.nullables, nullable);
|
|
29
|
-
if (newbie === false) return array;
|
|
30
|
-
|
|
31
|
-
// CONSTRUCT VALUE TYPE
|
|
32
|
-
const value: Metadata = explore_metadata(checker)(options)(collection)(
|
|
33
|
-
errors,
|
|
34
|
-
)(arrayType.getNumberIndexType()!, {
|
|
35
|
-
...explore,
|
|
36
|
-
escaped: false,
|
|
37
|
-
aliased: false,
|
|
38
|
-
});
|
|
39
|
-
setValue(value);
|
|
40
|
-
|
|
41
|
-
return array;
|
|
42
|
-
};
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { Metadata } from "../../../schemas/metadata/Metadata";
|
|
4
|
+
import { MetadataArrayType } from "../../../schemas/metadata/MetadataArrayType";
|
|
5
|
+
|
|
6
|
+
import { ArrayUtil } from "../../../utils/ArrayUtil";
|
|
7
|
+
|
|
8
|
+
import { MetadataCollection } from "../../MetadataCollection";
|
|
9
|
+
import { MetadataFactory } from "../../MetadataFactory";
|
|
10
|
+
import { explore_metadata } from "./explore_metadata";
|
|
11
|
+
|
|
12
|
+
export const emplace_metadata_array_type =
|
|
13
|
+
(checker: ts.TypeChecker) =>
|
|
14
|
+
(options: MetadataFactory.IOptions) =>
|
|
15
|
+
(collection: MetadataCollection) =>
|
|
16
|
+
(errors: MetadataFactory.IError[]) =>
|
|
17
|
+
(
|
|
18
|
+
aliasType: ts.Type,
|
|
19
|
+
arrayType: ts.Type,
|
|
20
|
+
nullable: boolean,
|
|
21
|
+
explore: MetadataFactory.IExplore,
|
|
22
|
+
): MetadataArrayType => {
|
|
23
|
+
// CHECK EXISTENCE
|
|
24
|
+
const [array, newbie, setValue] = collection.emplaceArray(
|
|
25
|
+
checker,
|
|
26
|
+
aliasType,
|
|
27
|
+
);
|
|
28
|
+
ArrayUtil.add(array.nullables, nullable);
|
|
29
|
+
if (newbie === false) return array;
|
|
30
|
+
|
|
31
|
+
// CONSTRUCT VALUE TYPE
|
|
32
|
+
const value: Metadata = explore_metadata(checker)(options)(collection)(
|
|
33
|
+
errors,
|
|
34
|
+
)(arrayType.getNumberIndexType()!, {
|
|
35
|
+
...explore,
|
|
36
|
+
escaped: false,
|
|
37
|
+
aliased: false,
|
|
38
|
+
});
|
|
39
|
+
setValue(value);
|
|
40
|
+
|
|
41
|
+
return array;
|
|
42
|
+
};
|