typia 3.6.0 → 3.6.2
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/README.md +14 -9
- package/lib/programmers/AssertCloneProgrammer.d.ts +1 -1
- package/lib/programmers/AssertCloneProgrammer.js +4 -4
- package/lib/programmers/AssertCloneProgrammer.js.map +1 -1
- package/lib/programmers/AssertParseProgrammer.d.ts +1 -1
- package/lib/programmers/AssertParseProgrammer.js +3 -3
- package/lib/programmers/AssertParseProgrammer.js.map +1 -1
- package/lib/programmers/AssertProgrammer.d.ts +1 -1
- package/lib/programmers/AssertProgrammer.js +3 -3
- package/lib/programmers/AssertProgrammer.js.map +1 -1
- package/lib/programmers/AssertPruneProgrammer.d.ts +1 -1
- package/lib/programmers/AssertPruneProgrammer.js +4 -4
- package/lib/programmers/AssertPruneProgrammer.js.map +1 -1
- package/lib/programmers/AssertStringifyProgrammer.d.ts +1 -1
- package/lib/programmers/AssertStringifyProgrammer.js +3 -3
- package/lib/programmers/AssertStringifyProgrammer.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.d.ts +1 -1
- package/lib/programmers/CheckerProgrammer.js +2 -2
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/CloneProgrammer.d.ts +1 -1
- package/lib/programmers/CloneProgrammer.js +4 -4
- package/lib/programmers/CloneProgrammer.js.map +1 -1
- package/lib/programmers/FeatureProgrammer.d.ts +3 -3
- package/lib/programmers/FeatureProgrammer.js +2 -2
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/IsCloneProgrammer.d.ts +1 -1
- package/lib/programmers/IsCloneProgrammer.js +4 -4
- package/lib/programmers/IsCloneProgrammer.js.map +1 -1
- package/lib/programmers/IsParseProgrammer.d.ts +1 -1
- package/lib/programmers/IsParseProgrammer.js +3 -3
- package/lib/programmers/IsParseProgrammer.js.map +1 -1
- package/lib/programmers/IsProgrammer.d.ts +1 -1
- package/lib/programmers/IsPruneProgrammer.d.ts +1 -1
- package/lib/programmers/IsPruneProgrammer.js +4 -4
- package/lib/programmers/IsPruneProgrammer.js.map +1 -1
- package/lib/programmers/IsStringifyProgrammer.d.ts +1 -1
- package/lib/programmers/IsStringifyProgrammer.js +4 -4
- package/lib/programmers/IsStringifyProgrammer.js.map +1 -1
- package/lib/programmers/PruneProgrammer.d.ts +1 -1
- package/lib/programmers/PruneProgrammer.js +2 -2
- package/lib/programmers/PruneProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.d.ts +1 -1
- package/lib/programmers/RandomProgrammer.js +2 -2
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/StringifyProgrammer.d.ts +1 -1
- package/lib/programmers/StringifyProgrammer.js +2 -2
- package/lib/programmers/StringifyProgrammer.js.map +1 -1
- package/lib/programmers/ValidateCloneProgrammer.d.ts +1 -1
- package/lib/programmers/ValidateCloneProgrammer.js +4 -4
- package/lib/programmers/ValidateCloneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateParseProgrammer.d.ts +1 -1
- package/lib/programmers/ValidateParseProgrammer.js +3 -3
- package/lib/programmers/ValidateParseProgrammer.js.map +1 -1
- package/lib/programmers/ValidateProgrammer.d.ts +1 -1
- package/lib/programmers/ValidateProgrammer.js +3 -3
- package/lib/programmers/ValidateProgrammer.js.map +1 -1
- package/lib/programmers/ValidatePruneProgrammer.d.ts +1 -1
- package/lib/programmers/ValidatePruneProgrammer.js +4 -4
- package/lib/programmers/ValidatePruneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateStringifyProgrammer.d.ts +1 -1
- package/lib/programmers/ValidateStringifyProgrammer.js +4 -4
- package/lib/programmers/ValidateStringifyProgrammer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/AssertCloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/AssertCloneTransformer.js +2 -15
- package/lib/transformers/features/miscellaneous/AssertCloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/AssertPruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js +2 -15
- package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CloneTransformer.js +2 -26
- package/lib/transformers/features/miscellaneous/CloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateAssertCloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreateAssertCloneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreateAssertCloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateCloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreateCloneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreateCloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateIsCloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreateIsCloneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreateIsCloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreatePruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreatePruneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreatePruneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateRandomGenerator.js +3 -2
- package/lib/transformers/features/miscellaneous/CreateRandomGenerator.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateValidateCloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreateValidateCloneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreateValidateCloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js +2 -10
- package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/IsCloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/IsCloneTransformer.js +2 -15
- package/lib/transformers/features/miscellaneous/IsCloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/IsPruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/IsPruneTransformer.js +2 -15
- package/lib/transformers/features/miscellaneous/IsPruneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/PruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/PruneTransformer.js +2 -26
- package/lib/transformers/features/miscellaneous/PruneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/RandomTransformer.js +3 -2
- package/lib/transformers/features/miscellaneous/RandomTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/ValidateCloneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/ValidateCloneTransformer.js +2 -15
- package/lib/transformers/features/miscellaneous/ValidateCloneTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.d.ts +1 -3
- package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js +2 -15
- package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js.map +1 -1
- package/lib/transformers/features/parsers/AssertParseTransformer.d.ts +1 -3
- package/lib/transformers/features/parsers/AssertParseTransformer.js +2 -14
- package/lib/transformers/features/parsers/AssertParseTransformer.js.map +1 -1
- package/lib/transformers/features/parsers/CreateAssertParseTransformer.d.ts +1 -3
- package/lib/transformers/features/parsers/CreateAssertParseTransformer.js +2 -10
- package/lib/transformers/features/parsers/CreateAssertParseTransformer.js.map +1 -1
- package/lib/transformers/features/parsers/CreateIsParseTransformer.d.ts +1 -3
- package/lib/transformers/features/parsers/CreateIsParseTransformer.js +2 -10
- package/lib/transformers/features/parsers/CreateIsParseTransformer.js.map +1 -1
- package/lib/transformers/features/parsers/CreateValidateParseTransformer.d.ts +1 -3
- package/lib/transformers/features/parsers/CreateValidateParseTransformer.js +2 -10
- package/lib/transformers/features/parsers/CreateValidateParseTransformer.js.map +1 -1
- package/lib/transformers/features/parsers/IsParseTransformer.d.ts +1 -3
- package/lib/transformers/features/parsers/IsParseTransformer.js +2 -14
- package/lib/transformers/features/parsers/IsParseTransformer.js.map +1 -1
- package/lib/transformers/features/parsers/ValidateParseTransformer.d.ts +1 -3
- package/lib/transformers/features/parsers/ValidateParseTransformer.js +2 -14
- package/lib/transformers/features/parsers/ValidateParseTransformer.js.map +1 -1
- package/lib/transformers/features/stringifiers/AssertStringifyTransformer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/AssertStringifyTransformer.js +4 -15
- package/lib/transformers/features/stringifiers/AssertStringifyTransformer.js.map +1 -1
- package/lib/transformers/features/stringifiers/CreateAssertStringifyTransformer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/CreateAssertStringifyTransformer.js +2 -10
- package/lib/transformers/features/stringifiers/CreateAssertStringifyTransformer.js.map +1 -1
- package/lib/transformers/features/stringifiers/CreateIsStringifyTransformer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/CreateIsStringifyTransformer.js +2 -10
- package/lib/transformers/features/stringifiers/CreateIsStringifyTransformer.js.map +1 -1
- package/lib/transformers/features/stringifiers/CreateStringifyTransformer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/CreateStringifyTransformer.js +2 -10
- package/lib/transformers/features/stringifiers/CreateStringifyTransformer.js.map +1 -1
- package/lib/transformers/features/stringifiers/CreateValidateStringifyProgrammer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/CreateValidateStringifyProgrammer.js +4 -10
- package/lib/transformers/features/stringifiers/CreateValidateStringifyProgrammer.js.map +1 -1
- package/lib/transformers/features/stringifiers/IsStringifyTransformer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/IsStringifyTransformer.js +2 -15
- package/lib/transformers/features/stringifiers/IsStringifyTransformer.js.map +1 -1
- package/lib/transformers/features/stringifiers/StringifyTransformer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/StringifyTransformer.js +2 -26
- package/lib/transformers/features/stringifiers/StringifyTransformer.js.map +1 -1
- package/lib/transformers/features/stringifiers/ValidateStringifyTransformer.d.ts +1 -3
- package/lib/transformers/features/stringifiers/ValidateStringifyTransformer.js +4 -15
- package/lib/transformers/features/stringifiers/ValidateStringifyTransformer.js.map +1 -1
- package/lib/transformers/features/validators/AssertTransformer.d.ts +1 -3
- package/lib/transformers/features/validators/AssertTransformer.js +6 -22
- package/lib/transformers/features/validators/AssertTransformer.js.map +1 -1
- package/lib/transformers/features/validators/CreateAssertTransformer.d.ts +1 -3
- package/lib/transformers/features/validators/CreateAssertTransformer.js +6 -17
- package/lib/transformers/features/validators/CreateAssertTransformer.js.map +1 -1
- package/lib/transformers/features/validators/CreateIsTransformer.d.ts +1 -3
- package/lib/transformers/features/validators/CreateIsTransformer.js +4 -17
- package/lib/transformers/features/validators/CreateIsTransformer.js.map +1 -1
- package/lib/transformers/features/validators/CreateValidateTransformer.d.ts +1 -3
- package/lib/transformers/features/validators/CreateValidateTransformer.js +6 -17
- package/lib/transformers/features/validators/CreateValidateTransformer.js.map +1 -1
- package/lib/transformers/features/validators/IsTransformer.d.ts +1 -3
- package/lib/transformers/features/validators/IsTransformer.js +6 -22
- package/lib/transformers/features/validators/IsTransformer.js.map +1 -1
- package/lib/transformers/features/validators/ValidateTransformer.d.ts +1 -3
- package/lib/transformers/features/validators/ValidateTransformer.js +6 -22
- package/lib/transformers/features/validators/ValidateTransformer.js.map +1 -1
- package/lib/transformers/internal/GenericTransformer.d.ts +6 -0
- package/lib/transformers/internal/GenericTransformer.js +72 -0
- package/lib/transformers/internal/GenericTransformer.js.map +1 -0
- package/package.json +2 -1
- package/src/programmers/AssertCloneProgrammer.ts +6 -7
- package/src/programmers/AssertParseProgrammer.ts +5 -6
- package/src/programmers/AssertProgrammer.ts +3 -3
- package/src/programmers/AssertPruneProgrammer.ts +4 -4
- package/src/programmers/AssertStringifyProgrammer.ts +3 -3
- package/src/programmers/CheckerProgrammer.ts +3 -2
- package/src/programmers/CloneProgrammer.ts +6 -7
- package/src/programmers/FeatureProgrammer.ts +5 -5
- package/src/programmers/IsCloneProgrammer.ts +7 -7
- package/src/programmers/IsParseProgrammer.ts +5 -6
- package/src/programmers/IsPruneProgrammer.ts +4 -4
- package/src/programmers/IsStringifyProgrammer.ts +5 -4
- package/src/programmers/PruneProgrammer.ts +2 -2
- package/src/programmers/RandomProgrammer.ts +4 -5
- package/src/programmers/StringifyProgrammer.ts +2 -2
- package/src/programmers/ValidateCloneProgrammer.ts +6 -7
- package/src/programmers/ValidateParseProgrammer.ts +5 -6
- package/src/programmers/ValidateProgrammer.ts +5 -6
- package/src/programmers/ValidatePruneProgrammer.ts +6 -7
- package/src/programmers/ValidateStringifyProgrammer.ts +5 -4
- package/src/transformers/features/miscellaneous/AssertCloneTransformer.ts +4 -33
- package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +4 -33
- package/src/transformers/features/miscellaneous/CloneTransformer.ts +4 -41
- package/src/transformers/features/miscellaneous/CreateAssertCloneTransformer.ts +4 -27
- package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +4 -27
- package/src/transformers/features/miscellaneous/CreateCloneTransformer.ts +4 -26
- package/src/transformers/features/miscellaneous/CreateIsCloneTransformer.ts +4 -27
- package/src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts +4 -27
- package/src/transformers/features/miscellaneous/CreatePruneTransformer.ts +4 -26
- package/src/transformers/features/miscellaneous/CreateRandomGenerator.ts +7 -4
- package/src/transformers/features/miscellaneous/CreateValidateCloneTransformer.ts +4 -27
- package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +4 -27
- package/src/transformers/features/miscellaneous/IsCloneTransformer.ts +4 -33
- package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +4 -33
- package/src/transformers/features/miscellaneous/PruneTransformer.ts +4 -41
- package/src/transformers/features/miscellaneous/RandomTransformer.ts +7 -4
- package/src/transformers/features/miscellaneous/ValidateCloneTransformer.ts +4 -33
- package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +4 -33
- package/src/transformers/features/parsers/AssertParseTransformer.ts +4 -31
- package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +4 -27
- package/src/transformers/features/parsers/CreateIsParseTransformer.ts +4 -27
- package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +4 -27
- package/src/transformers/features/parsers/IsParseTransformer.ts +4 -31
- package/src/transformers/features/parsers/ValidateParseTransformer.ts +4 -31
- package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +5 -33
- package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +4 -27
- package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +4 -27
- package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +4 -26
- package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +6 -27
- package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +4 -33
- package/src/transformers/features/stringifiers/StringifyTransformer.ts +4 -41
- package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +5 -33
- package/src/transformers/features/validators/AssertTransformer.ts +6 -38
- package/src/transformers/features/validators/CreateAssertTransformer.ts +7 -30
- package/src/transformers/features/validators/CreateIsTransformer.ts +5 -30
- package/src/transformers/features/validators/CreateValidateTransformer.ts +7 -30
- package/src/transformers/features/validators/IsTransformer.ts +5 -38
- package/src/transformers/features/validators/ValidateTransformer.ts +6 -38
- package/src/transformers/internal/GenericTransformer.ts +99 -0
|
@@ -12,7 +12,7 @@ import { ValidateProgrammer } from "./ValidateProgrammer";
|
|
|
12
12
|
export namespace ValidatePruneProgrammer {
|
|
13
13
|
export const generate =
|
|
14
14
|
(project: IProject, modulo: ts.LeftHandSideExpression) =>
|
|
15
|
-
(type: ts.Type) =>
|
|
15
|
+
(type: ts.Type, name?: string) =>
|
|
16
16
|
ts.factory.createArrowFunction(
|
|
17
17
|
undefined,
|
|
18
18
|
undefined,
|
|
@@ -23,10 +23,9 @@ export namespace ValidatePruneProgrammer {
|
|
|
23
23
|
),
|
|
24
24
|
],
|
|
25
25
|
ts.factory.createTypeReferenceNode(
|
|
26
|
-
`typia.IValidation<${
|
|
27
|
-
project.checker,
|
|
28
|
-
|
|
29
|
-
)}>`,
|
|
26
|
+
`typia.IValidation<${
|
|
27
|
+
name ?? TypeFactory.getFullName(project.checker, type)
|
|
28
|
+
}>`,
|
|
30
29
|
),
|
|
31
30
|
undefined,
|
|
32
31
|
ts.factory.createBlock([
|
|
@@ -42,7 +41,7 @@ export namespace ValidatePruneProgrammer {
|
|
|
42
41
|
},
|
|
43
42
|
},
|
|
44
43
|
modulo,
|
|
45
|
-
)(type),
|
|
44
|
+
)(type, name),
|
|
46
45
|
),
|
|
47
46
|
StatementFactory.constant(
|
|
48
47
|
"prune",
|
|
@@ -56,7 +55,7 @@ export namespace ValidatePruneProgrammer {
|
|
|
56
55
|
},
|
|
57
56
|
},
|
|
58
57
|
modulo,
|
|
59
|
-
)(type),
|
|
58
|
+
)(type, name),
|
|
60
59
|
),
|
|
61
60
|
StatementFactory.constant(
|
|
62
61
|
"output",
|
|
@@ -12,7 +12,7 @@ import { ValidateProgrammer } from "./ValidateProgrammer";
|
|
|
12
12
|
export namespace ValidateStringifyProgrammer {
|
|
13
13
|
export const generate =
|
|
14
14
|
(project: IProject, modulo: ts.LeftHandSideExpression) =>
|
|
15
|
-
(type: ts.Type) =>
|
|
15
|
+
(type: ts.Type, name?: string) =>
|
|
16
16
|
ts.factory.createArrowFunction(
|
|
17
17
|
undefined,
|
|
18
18
|
undefined,
|
|
@@ -20,7 +20,8 @@ export namespace ValidateStringifyProgrammer {
|
|
|
20
20
|
IdentifierFactory.parameter(
|
|
21
21
|
"input",
|
|
22
22
|
ts.factory.createTypeReferenceNode(
|
|
23
|
-
|
|
23
|
+
name ??
|
|
24
|
+
TypeFactory.getFullName(project.checker, type),
|
|
24
25
|
),
|
|
25
26
|
),
|
|
26
27
|
],
|
|
@@ -39,7 +40,7 @@ export namespace ValidateStringifyProgrammer {
|
|
|
39
40
|
},
|
|
40
41
|
},
|
|
41
42
|
modulo,
|
|
42
|
-
)(type),
|
|
43
|
+
)(type, name),
|
|
43
44
|
),
|
|
44
45
|
StatementFactory.constant(
|
|
45
46
|
"stringify",
|
|
@@ -53,7 +54,7 @@ export namespace ValidateStringifyProgrammer {
|
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
56
|
modulo,
|
|
56
|
-
)(type),
|
|
57
|
+
)(type, name),
|
|
57
58
|
),
|
|
58
59
|
StatementFactory.constant(
|
|
59
60
|
"output",
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertCloneProgrammer } from "../../../programmers/AssertCloneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace AssertCloneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
if (expression.arguments.length !== 1)
|
|
14
|
-
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
-
|
|
16
|
-
// GET TYPE INFO
|
|
17
|
-
const type: ts.Type =
|
|
18
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
19
|
-
? project.checker.getTypeFromTypeNode(
|
|
20
|
-
expression.typeArguments[0],
|
|
21
|
-
)
|
|
22
|
-
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
23
|
-
if (type.isTypeParameter())
|
|
24
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
25
|
-
|
|
26
|
-
// DO TRANSFORM
|
|
27
|
-
return ts.factory.createCallExpression(
|
|
28
|
-
AssertCloneProgrammer.generate(project, modulo)(type),
|
|
29
|
-
undefined,
|
|
30
|
-
[expression.arguments[0]!],
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const enum ErrorMessages {
|
|
36
|
-
NO_INPUT_VALUE = "Error on typia.assertClone(): no input value.",
|
|
37
|
-
GENERIC_ARGUMENT = "Error on typia.assertClone(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("assertClone")(
|
|
7
|
+
(project, modulo) => AssertCloneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
38
9
|
}
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertPruneProgrammer } from "../../../programmers/AssertPruneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace AssertPruneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
if (expression.arguments.length !== 1)
|
|
14
|
-
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
-
|
|
16
|
-
// GET TYPE INFO
|
|
17
|
-
const type: ts.Type =
|
|
18
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
19
|
-
? project.checker.getTypeFromTypeNode(
|
|
20
|
-
expression.typeArguments[0],
|
|
21
|
-
)
|
|
22
|
-
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
23
|
-
if (type.isTypeParameter())
|
|
24
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
25
|
-
|
|
26
|
-
// DO TRANSFORM
|
|
27
|
-
return ts.factory.createCallExpression(
|
|
28
|
-
AssertPruneProgrammer.generate(project, modulo)(type),
|
|
29
|
-
undefined,
|
|
30
|
-
[expression.arguments[0]!],
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const enum ErrorMessages {
|
|
36
|
-
NO_INPUT_VALUE = "Error on typia.assertPrune(): no input value.",
|
|
37
|
-
GENERIC_ARGUMENT = "Error on typia.assertPrune(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("assertPrune")(
|
|
7
|
+
(project, modulo) => AssertPruneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
38
9
|
}
|
|
@@ -1,46 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { CloneProgrammer } from "../../../programmers/CloneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CloneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
if (expression.arguments.length !== 1)
|
|
14
|
-
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
-
|
|
16
|
-
const type: ts.Type =
|
|
17
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
18
|
-
? project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
)
|
|
21
|
-
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
22
|
-
if (type.isTypeParameter())
|
|
23
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
24
|
-
|
|
25
|
-
return ts.factory.createCallExpression(
|
|
26
|
-
CloneProgrammer.generate(
|
|
27
|
-
{
|
|
28
|
-
...project,
|
|
29
|
-
options: {
|
|
30
|
-
...project.options,
|
|
31
|
-
functional: false,
|
|
32
|
-
numeric: false,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
modulo,
|
|
36
|
-
)(type),
|
|
37
|
-
undefined,
|
|
38
|
-
[expression.arguments[0]!],
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const enum ErrorMessages {
|
|
44
|
-
NO_INPUT_VALUE = "Error on typia.clone(): no input value.",
|
|
45
|
-
GENERIC_ARGUMENT = "Error on typia.clone(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("clone")(
|
|
7
|
+
(project, modulo) => CloneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
46
9
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertCloneProgrammer } from "../../../programmers/AssertCloneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateAssertCloneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
// DO TRANSFORM
|
|
25
|
-
return AssertCloneProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.assertClone(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.assertClone(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createAssertClone")(
|
|
7
|
+
(project, modulo) => AssertCloneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
32
9
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertPruneProgrammer } from "../../../programmers/AssertPruneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateAssertPruneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
// DO TRANSFORM
|
|
25
|
-
return AssertPruneProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.assertPrune(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.assertPrune(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createAssertPrune")(
|
|
7
|
+
(project, modulo) => AssertPruneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
32
9
|
}
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { CloneProgrammer } from "../../../programmers/CloneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateCloneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
return CloneProgrammer.generate(project, modulo)(type);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const enum ErrorMessages {
|
|
29
|
-
NOT_SPECIFIED = "Error on typia.clone(): generic argument is not specified.",
|
|
30
|
-
GENERIC_ARGUMENT = "Error on typia.clone(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createClone")(
|
|
7
|
+
(project, modulo) => CloneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
31
9
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsCloneProgrammer } from "../../../programmers/IsCloneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateIsCloneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
// DO TRANSFORM
|
|
25
|
-
return IsCloneProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.isClone(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.isClone(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createIsClone")(
|
|
7
|
+
(project, modulo) => IsCloneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
32
9
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateIsPruneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
// DO TRANSFORM
|
|
25
|
-
return IsPruneProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.isPrune(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.isPrune(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createIsPrune")(
|
|
7
|
+
(project, modulo) => IsPruneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
32
9
|
}
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { PruneProgrammer } from "../../../programmers/PruneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreatePruneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
return PruneProgrammer.generate(project, modulo)(type);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const enum ErrorMessages {
|
|
29
|
-
NOT_SPECIFIED = "Error on typia.prune(): generic argument is not specified.",
|
|
30
|
-
GENERIC_ARGUMENT = "Error on typia.prune(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createPrune")(
|
|
7
|
+
(project, modulo) => PruneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
31
9
|
}
|
|
@@ -10,15 +10,18 @@ export namespace CreateRandomTransformer {
|
|
|
10
10
|
modulo: ts.LeftHandSideExpression,
|
|
11
11
|
expression: ts.CallExpression,
|
|
12
12
|
): ts.Expression {
|
|
13
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
13
14
|
if (!expression.typeArguments?.[0])
|
|
14
15
|
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
);
|
|
17
|
+
// GET TYPE INFO
|
|
18
|
+
const node: ts.TypeNode = expression.typeArguments[0];
|
|
19
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(node);
|
|
20
|
+
|
|
19
21
|
if (type.isTypeParameter())
|
|
20
22
|
throw new Error(ErrorMessages.NO_GENERIC_ARGUMENT);
|
|
21
23
|
|
|
24
|
+
// DO TRANSFORM
|
|
22
25
|
return RandomProgrammer.generate(
|
|
23
26
|
{
|
|
24
27
|
...project,
|
|
@@ -29,7 +32,7 @@ export namespace CreateRandomTransformer {
|
|
|
29
32
|
},
|
|
30
33
|
},
|
|
31
34
|
modulo,
|
|
32
|
-
)(type);
|
|
35
|
+
)(type, node.getText());
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { ValidateCloneProgrammer } from "../../../programmers/ValidateCloneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateValidateCloneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
// DO TRANSFORM
|
|
25
|
-
return ValidateCloneProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.validateClone(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.validateClone(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createValidateClone")(
|
|
7
|
+
(project, modulo) => ValidateCloneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
32
9
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { ValidatePruneProgrammer } from "../../../programmers/ValidatePruneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateValidatePruneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
-
if (!expression.typeArguments?.[0])
|
|
15
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
-
|
|
17
|
-
// GET TYPE INFO
|
|
18
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
-
expression.typeArguments[0],
|
|
20
|
-
);
|
|
21
|
-
if (type.isTypeParameter())
|
|
22
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
-
|
|
24
|
-
// DO TRANSFORM
|
|
25
|
-
return ValidatePruneProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.validatePrune(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.validatePrune(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createValidatePrune")(
|
|
7
|
+
(project, modulo) => ValidatePruneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
32
9
|
}
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsCloneProgrammer } from "../../../programmers/IsCloneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace IsCloneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
if (expression.arguments.length !== 1)
|
|
14
|
-
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
-
|
|
16
|
-
// GET TYPE INFO
|
|
17
|
-
const type: ts.Type =
|
|
18
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
19
|
-
? project.checker.getTypeFromTypeNode(
|
|
20
|
-
expression.typeArguments[0],
|
|
21
|
-
)
|
|
22
|
-
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
23
|
-
if (type.isTypeParameter())
|
|
24
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
25
|
-
|
|
26
|
-
// DO TRANSFORM
|
|
27
|
-
return ts.factory.createCallExpression(
|
|
28
|
-
IsCloneProgrammer.generate(project, modulo)(type),
|
|
29
|
-
undefined,
|
|
30
|
-
[expression.arguments[0]!],
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const enum ErrorMessages {
|
|
36
|
-
NO_INPUT_VALUE = "Error on typia.isClone(): no input value.",
|
|
37
|
-
GENERIC_ARGUMENT = "Error on typia.isClone(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("isClone")(
|
|
7
|
+
(project, modulo) => IsCloneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
38
9
|
}
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace IsPruneTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
if (expression.arguments.length !== 1)
|
|
14
|
-
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
-
|
|
16
|
-
// GET TYPE INFO
|
|
17
|
-
const type: ts.Type =
|
|
18
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
19
|
-
? project.checker.getTypeFromTypeNode(
|
|
20
|
-
expression.typeArguments[0],
|
|
21
|
-
)
|
|
22
|
-
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
23
|
-
if (type.isTypeParameter())
|
|
24
|
-
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
25
|
-
|
|
26
|
-
// DO TRANSFORM
|
|
27
|
-
return ts.factory.createCallExpression(
|
|
28
|
-
IsPruneProgrammer.generate(project, modulo)(type),
|
|
29
|
-
undefined,
|
|
30
|
-
[expression.arguments[0]!],
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const enum ErrorMessages {
|
|
36
|
-
NO_INPUT_VALUE = "Error on typia.isPrune(): no input value.",
|
|
37
|
-
GENERIC_ARGUMENT = "Error on typia.isPrune(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("isPrune")(
|
|
7
|
+
(project, modulo) => IsPruneProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
38
9
|
}
|