typia 3.6.0 → 3.6.1
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 +2 -2
- package/lib/programmers/AssertCloneProgrammer.js.map +1 -1
- package/lib/programmers/AssertParseProgrammer.d.ts +1 -1
- package/lib/programmers/AssertParseProgrammer.js +2 -2
- package/lib/programmers/AssertParseProgrammer.js.map +1 -1
- package/lib/programmers/AssertProgrammer.d.ts +1 -1
- package/lib/programmers/AssertProgrammer.js +2 -2
- package/lib/programmers/AssertProgrammer.js.map +1 -1
- package/lib/programmers/AssertPruneProgrammer.d.ts +1 -1
- package/lib/programmers/AssertPruneProgrammer.js +2 -2
- package/lib/programmers/AssertPruneProgrammer.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 +2 -2
- package/lib/programmers/IsCloneProgrammer.js.map +1 -1
- package/lib/programmers/IsParseProgrammer.d.ts +1 -1
- package/lib/programmers/IsParseProgrammer.js +2 -2
- 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 +2 -2
- package/lib/programmers/IsPruneProgrammer.js.map +1 -1
- package/lib/programmers/IsStringifyProgrammer.d.ts +1 -1
- package/lib/programmers/IsStringifyProgrammer.js +2 -2
- 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 +2 -2
- package/lib/programmers/ValidateCloneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateParseProgrammer.d.ts +1 -1
- package/lib/programmers/ValidateParseProgrammer.js +2 -2
- package/lib/programmers/ValidateParseProgrammer.js.map +1 -1
- package/lib/programmers/ValidateProgrammer.d.ts +1 -1
- package/lib/programmers/ValidateProgrammer.js +2 -2
- package/lib/programmers/ValidateProgrammer.js.map +1 -1
- package/lib/programmers/ValidatePruneProgrammer.d.ts +1 -1
- package/lib/programmers/ValidatePruneProgrammer.js +2 -2
- package/lib/programmers/ValidatePruneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateStringifyProgrammer.d.ts +1 -1
- package/lib/programmers/ValidateStringifyProgrammer.js +2 -2
- 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 +4 -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 +4 -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 +7 -0
- package/lib/transformers/internal/GenericTransformer.js +68 -0
- package/lib/transformers/internal/GenericTransformer.js.map +1 -0
- package/package.json +1 -1
- package/src/programmers/AssertCloneProgrammer.ts +4 -5
- package/src/programmers/AssertParseProgrammer.ts +4 -5
- package/src/programmers/AssertProgrammer.ts +2 -2
- package/src/programmers/AssertPruneProgrammer.ts +2 -2
- 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 +5 -5
- package/src/programmers/IsParseProgrammer.ts +4 -5
- package/src/programmers/IsPruneProgrammer.ts +2 -2
- package/src/programmers/IsStringifyProgrammer.ts +3 -2
- 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 +4 -5
- package/src/programmers/ValidateParseProgrammer.ts +4 -5
- package/src/programmers/ValidateProgrammer.ts +4 -5
- package/src/programmers/ValidatePruneProgrammer.ts +4 -5
- package/src/programmers/ValidateStringifyProgrammer.ts +3 -2
- 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 +8 -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 +8 -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 +98 -0
|
@@ -1,38 +1,10 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertStringifyProgrammer } from "../../../programmers/AssertStringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace AssertStringifyTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
AssertStringifyProgrammer.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.assertStringify(): no input value.",
|
|
37
|
-
GENERIC_ARGUMENT = "Error on typia.assertStringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("assertStringify")(
|
|
7
|
+
(project, modulo) =>
|
|
8
|
+
AssertStringifyProgrammer.generate(project, modulo),
|
|
9
|
+
);
|
|
38
10
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertStringifyProgrammer } from "../../../programmers/AssertStringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateAssertStringifyTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
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 AssertStringifyProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.assertStringify(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.assertStringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory(
|
|
7
|
+
"createAssertStringify",
|
|
8
|
+
)((project, modulo) => AssertStringifyProgrammer.generate(project, modulo));
|
|
32
9
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsStringifyProgrammer } from "../../../programmers/IsStringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateIsStringifyTransformer {
|
|
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 IsStringifyProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.isStringify(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.isStringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createIsStringify")(
|
|
7
|
+
(project, modulo) => IsStringifyProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
32
9
|
}
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { StringifyProgrammer } from "../../../programmers/StringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateStringifyTransformer {
|
|
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 StringifyProgrammer.generate(project, modulo)(type);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const enum ErrorMessages {
|
|
29
|
-
NOT_SPECIFIED = "Error on typia.stringify(): generic argument is not specified.",
|
|
30
|
-
GENERIC_ARGUMENT = "Error on typia.stringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory("createStringify")(
|
|
7
|
+
(project, modulo) => StringifyProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
31
9
|
}
|
|
@@ -1,32 +1,11 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { ValidateStringifyProgrammer } from "../../../programmers/ValidateStringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateValidateStringifyTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
)
|
|
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 ValidateStringifyProgrammer.generate(project, modulo)(type);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const enum ErrorMessages {
|
|
30
|
-
NOT_SPECIFIED = "Error on typia.validateStringify(): generic argument is not specified.",
|
|
31
|
-
GENERIC_ARGUMENT = "Error on typia.validateStringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.factory(
|
|
7
|
+
"createValidateStringify",
|
|
8
|
+
)((project, modulo) =>
|
|
9
|
+
ValidateStringifyProgrammer.generate(project, modulo),
|
|
10
|
+
);
|
|
32
11
|
}
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsStringifyProgrammer } from "../../../programmers/IsStringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace IsStringifyTransformer {
|
|
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
|
-
IsStringifyProgrammer.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.isStringify(): no input value.",
|
|
37
|
-
GENERIC_ARGUMENT = "Error on typia.isStringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("isStringify")(
|
|
7
|
+
(project, modulo) => IsStringifyProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
38
9
|
}
|
|
@@ -1,46 +1,9 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { StringifyProgrammer } from "../../../programmers/StringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace StringifyTransformer {
|
|
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
|
-
StringifyProgrammer.generate(
|
|
27
|
-
{
|
|
28
|
-
...project,
|
|
29
|
-
options: {
|
|
30
|
-
...project.options,
|
|
31
|
-
functional: false,
|
|
32
|
-
numeric: true,
|
|
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.stringify(): no input value.",
|
|
45
|
-
GENERIC_ARGUMENT = "Error on typia.stringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("stringify")(
|
|
7
|
+
(project, modulo) => StringifyProgrammer.generate(project, modulo),
|
|
8
|
+
);
|
|
46
9
|
}
|
|
@@ -1,38 +1,10 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { ValidateStringifyProgrammer } from "../../../programmers/ValidateStringifyProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace ValidateStringifyTransformer {
|
|
8
|
-
export
|
|
9
|
-
project
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
ValidateStringifyProgrammer.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.validateStringify(): no input value.",
|
|
37
|
-
GENERIC_ARGUMENT = "Error on typia.validateStringify(): non-specified generic argument.",
|
|
6
|
+
export const transform = GenericTransformer.scalar("validatStringify")(
|
|
7
|
+
(project, modulo) =>
|
|
8
|
+
ValidateStringifyProgrammer.generate(project, modulo),
|
|
9
|
+
);
|
|
38
10
|
}
|
|
@@ -1,43 +1,11 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertProgrammer } from "../../../programmers/AssertProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace AssertTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
if (expression.arguments.length !== 1)
|
|
21
|
-
throw new Error(MESSAGES.NO_INPUT_VALUE);
|
|
22
|
-
|
|
23
|
-
// GET TYPE INFO
|
|
24
|
-
const type: ts.Type =
|
|
25
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
26
|
-
? project.checker.getTypeFromTypeNode(
|
|
27
|
-
expression.typeArguments[0],
|
|
28
|
-
)
|
|
29
|
-
: project.checker.getTypeAtLocation(
|
|
30
|
-
expression.arguments[0]!,
|
|
31
|
-
);
|
|
32
|
-
if (type.isTypeParameter())
|
|
33
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
34
|
-
|
|
35
|
-
// DO TRANSFORM
|
|
36
|
-
return ts.factory.createCallExpression(
|
|
37
|
-
AssertProgrammer.generate(project, modulo, equals)(type),
|
|
38
|
-
undefined,
|
|
39
|
-
[expression.arguments[0]!],
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
6
|
+
export const transform = (equals: boolean) =>
|
|
7
|
+
GenericTransformer.scalar(equals ? "assertEquals" : "assert")(
|
|
8
|
+
(project, modulo) =>
|
|
9
|
+
AssertProgrammer.generate(project, modulo, equals),
|
|
10
|
+
);
|
|
43
11
|
}
|
|
@@ -1,35 +1,12 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { AssertProgrammer } from "../../../programmers/AssertProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateAssertTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
-
if (!expression.typeArguments?.[0])
|
|
22
|
-
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
-
|
|
24
|
-
// GET TYPE INFO
|
|
25
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
-
expression.typeArguments[0],
|
|
27
|
-
);
|
|
28
|
-
if (type.isTypeParameter())
|
|
29
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
-
|
|
31
|
-
// DO TRANSFORM
|
|
32
|
-
return AssertProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
6
|
+
export const transform = (equals: boolean) =>
|
|
7
|
+
GenericTransformer.factory(
|
|
8
|
+
equals ? "createAssertEquals" : "createAssert",
|
|
9
|
+
)((project, modulo) =>
|
|
10
|
+
AssertProgrammer.generate(project, modulo, equals),
|
|
11
|
+
);
|
|
35
12
|
}
|
|
@@ -1,35 +1,10 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsProgrammer } from "../../../programmers/IsProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateIsTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
-
if (!expression.typeArguments?.[0])
|
|
22
|
-
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
-
|
|
24
|
-
// GET TYPE INFO
|
|
25
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
-
expression.typeArguments[0],
|
|
27
|
-
);
|
|
28
|
-
if (type.isTypeParameter())
|
|
29
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
-
|
|
31
|
-
// DO TRANSFORM
|
|
32
|
-
return IsProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
6
|
+
export const transform = (equals: boolean) =>
|
|
7
|
+
GenericTransformer.factory(equals ? "createEquals" : "createIs")(
|
|
8
|
+
(project, modulo) => IsProgrammer.generate(project, modulo, equals),
|
|
9
|
+
);
|
|
35
10
|
}
|
|
@@ -1,35 +1,12 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { ValidateProgrammer } from "../../../programmers/ValidateProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace CreateValidateTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
-
if (!expression.typeArguments?.[0])
|
|
22
|
-
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
-
|
|
24
|
-
// GET TYPE INFO
|
|
25
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
-
expression.typeArguments[0],
|
|
27
|
-
);
|
|
28
|
-
if (type.isTypeParameter())
|
|
29
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
-
|
|
31
|
-
// DO TRANSFORM
|
|
32
|
-
return ValidateProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
6
|
+
export const transform = (equals: boolean) =>
|
|
7
|
+
GenericTransformer.factory(
|
|
8
|
+
equals ? "createValidateEquals" : "createValidate",
|
|
9
|
+
)((project, modulo) =>
|
|
10
|
+
ValidateProgrammer.generate(project, modulo, equals),
|
|
11
|
+
);
|
|
35
12
|
}
|
|
@@ -1,43 +1,10 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { IsProgrammer } from "../../../programmers/IsProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace IsTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
if (expression.arguments.length !== 1)
|
|
21
|
-
throw new Error(MESSAGES.NO_INPUT_VALUE);
|
|
22
|
-
|
|
23
|
-
// GET TYPE INFO
|
|
24
|
-
const type: ts.Type =
|
|
25
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
26
|
-
? project.checker.getTypeFromTypeNode(
|
|
27
|
-
expression.typeArguments[0],
|
|
28
|
-
)
|
|
29
|
-
: project.checker.getTypeAtLocation(
|
|
30
|
-
expression.arguments[0]!,
|
|
31
|
-
);
|
|
32
|
-
if (type.isTypeParameter())
|
|
33
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
34
|
-
|
|
35
|
-
// DO TRANSFORM
|
|
36
|
-
return ts.factory.createCallExpression(
|
|
37
|
-
IsProgrammer.generate(project, modulo, equals)(type),
|
|
38
|
-
undefined,
|
|
39
|
-
[expression.arguments[0]!],
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
6
|
+
export const transform = (equals: boolean) =>
|
|
7
|
+
GenericTransformer.scalar(equals ? "equals" : "is")((project, modulo) =>
|
|
8
|
+
IsProgrammer.generate(project, modulo, equals),
|
|
9
|
+
);
|
|
43
10
|
}
|
|
@@ -1,43 +1,11 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
1
|
import { ValidateProgrammer } from "../../../programmers/ValidateProgrammer";
|
|
4
2
|
|
|
5
|
-
import {
|
|
3
|
+
import { GenericTransformer } from "../../internal/GenericTransformer";
|
|
6
4
|
|
|
7
5
|
export namespace ValidateTransformer {
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
if (expression.arguments.length !== 1)
|
|
21
|
-
throw new Error(MESSAGES.NO_INPUT_VALUE);
|
|
22
|
-
|
|
23
|
-
// GET TYPE INFO
|
|
24
|
-
const type: ts.Type =
|
|
25
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
26
|
-
? project.checker.getTypeFromTypeNode(
|
|
27
|
-
expression.typeArguments[0],
|
|
28
|
-
)
|
|
29
|
-
: project.checker.getTypeAtLocation(
|
|
30
|
-
expression.arguments[0]!,
|
|
31
|
-
);
|
|
32
|
-
if (type.isTypeParameter())
|
|
33
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
34
|
-
|
|
35
|
-
// DO TRANSFORM
|
|
36
|
-
return ts.factory.createCallExpression(
|
|
37
|
-
ValidateProgrammer.generate(project, modulo, equals)(type),
|
|
38
|
-
undefined,
|
|
39
|
-
[expression.arguments[0]!],
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
6
|
+
export const transform = (equals: boolean) =>
|
|
7
|
+
GenericTransformer.scalar(equals ? "validateEquals" : "validate")(
|
|
8
|
+
(project, modulo) =>
|
|
9
|
+
ValidateProgrammer.generate(project, modulo, equals),
|
|
10
|
+
);
|
|
43
11
|
}
|