typia 3.5.8 → 3.6.0-dev.20230225
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 +2 -0
- package/lib/Primitive.d.ts +2 -1
- package/lib/executable/TypiaGenerateWizard.d.ts +8 -0
- package/lib/executable/TypiaGenerateWizard.js +182 -0
- package/lib/executable/TypiaGenerateWizard.js.map +1 -0
- package/lib/executable/typia.js +11 -4
- package/lib/executable/typia.js.map +1 -1
- package/lib/factories/IdentifierFactory.d.ts +1 -1
- package/lib/factories/IdentifierFactory.js +3 -3
- package/lib/factories/IdentifierFactory.js.map +1 -1
- package/lib/factories/TypeFactory.d.ts +1 -0
- package/lib/factories/TypeFactory.js +17 -1
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/factories/TypiaFileFactory.d.ts +8 -0
- package/lib/factories/TypiaFileFactory.js +236 -0
- package/lib/factories/TypiaFileFactory.js.map +1 -0
- package/lib/programmers/AssertCloneProgrammer.js +4 -1
- package/lib/programmers/AssertCloneProgrammer.js.map +1 -1
- package/lib/programmers/AssertParseProgrammer.js +4 -1
- package/lib/programmers/AssertParseProgrammer.js.map +1 -1
- package/lib/programmers/AssertProgrammer.js +4 -1
- package/lib/programmers/AssertProgrammer.js.map +1 -1
- package/lib/programmers/AssertPruneProgrammer.js +4 -1
- package/lib/programmers/AssertPruneProgrammer.js.map +1 -1
- package/lib/programmers/AssertStringifyProgrammer.js +4 -1
- package/lib/programmers/AssertStringifyProgrammer.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.d.ts +1 -1
- package/lib/programmers/CheckerProgrammer.js +8 -0
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/CloneProgrammer.d.ts +1 -1
- package/lib/programmers/CloneProgrammer.js +17 -2
- package/lib/programmers/CloneProgrammer.js.map +1 -1
- package/lib/programmers/FeatureProgrammer.d.ts +10 -1
- package/lib/programmers/FeatureProgrammer.js +24 -16
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/IsCloneProgrammer.js +7 -1
- package/lib/programmers/IsCloneProgrammer.js.map +1 -1
- package/lib/programmers/IsParseProgrammer.js +5 -2
- package/lib/programmers/IsParseProgrammer.js.map +1 -1
- package/lib/programmers/IsProgrammer.d.ts +1 -1
- package/lib/programmers/IsPruneProgrammer.js +4 -1
- package/lib/programmers/IsPruneProgrammer.js.map +1 -1
- package/lib/programmers/IsStringifyProgrammer.js +7 -1
- package/lib/programmers/IsStringifyProgrammer.js.map +1 -1
- package/lib/programmers/PruneProgrammer.d.ts +1 -1
- package/lib/programmers/PruneProgrammer.js +7 -0
- package/lib/programmers/PruneProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.js +9 -8
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/StringifyProgrammer.d.ts +1 -1
- package/lib/programmers/StringifyProgrammer.js +7 -0
- package/lib/programmers/StringifyProgrammer.js.map +1 -1
- package/lib/programmers/ValidateCloneProgrammer.js +5 -2
- package/lib/programmers/ValidateCloneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateParseProgrammer.js +4 -1
- package/lib/programmers/ValidateParseProgrammer.js.map +1 -1
- package/lib/programmers/ValidateProgrammer.js +7 -4
- package/lib/programmers/ValidateProgrammer.js.map +1 -1
- package/lib/programmers/ValidatePruneProgrammer.js +4 -1
- package/lib/programmers/ValidatePruneProgrammer.js.map +1 -1
- package/lib/programmers/ValidateStringifyProgrammer.js +5 -2
- package/lib/programmers/ValidateStringifyProgrammer.js.map +1 -1
- package/lib/programmers/helpers/CloneJoiner.js +5 -4
- package/lib/programmers/helpers/CloneJoiner.js.map +1 -1
- package/lib/programmers/helpers/FunctionImporeter.js +2 -1
- package/lib/programmers/helpers/FunctionImporeter.js.map +1 -1
- package/lib/programmers/helpers/RandomJoiner.js +3 -2
- package/lib/programmers/helpers/RandomJoiner.js.map +1 -1
- package/lib/programmers/internal/check_everything.js +4 -1
- package/lib/programmers/internal/check_everything.js.map +1 -1
- package/lib/programmers/internal/check_union_array_like.js +10 -3
- package/lib/programmers/internal/check_union_array_like.js.map +1 -1
- package/lib/programmers/internal/stringify_dynamic_properties.js +1 -1
- package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
- package/lib/transformers/CallExpressionTransformer.js +4 -1
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/ImportTransformer.d.ts +4 -0
- package/lib/transformers/ImportTransformer.js +51 -0
- package/lib/transformers/ImportTransformer.js.map +1 -0
- package/package.json +1 -1
- package/src/IRandomGenerator.ts +16 -16
- package/src/IValidation.ts +21 -21
- package/src/Primitive.ts +104 -82
- package/src/TypeGuardError.ts +36 -36
- package/src/executable/TypiaGenerateWizard.ts +87 -0
- package/src/executable/TypiaSetupWizard.ts +142 -142
- package/src/executable/setup/ArgumentParser.ts +91 -91
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/FileRetriever.ts +33 -33
- package/src/executable/setup/PackageManager.ts +92 -92
- package/src/executable/setup/PluginConfigurator.ts +99 -99
- package/src/executable/typia.ts +38 -29
- package/src/factories/CommentFactory.ts +10 -10
- package/src/factories/ExpressionFactory.ts +77 -77
- package/src/factories/IdentifierFactory.ts +73 -72
- package/src/factories/LiteralFactory.ts +44 -44
- package/src/factories/MetadataCollection.ts +122 -122
- package/src/factories/MetadataFactory.ts +51 -51
- package/src/factories/MetadataTagFactory.ts +265 -265
- package/src/factories/StatementFactory.ts +60 -60
- package/src/factories/TemplateFactory.ts +56 -56
- package/src/factories/TypeFactory.ts +129 -101
- package/src/factories/TypiaFileFactory.ts +117 -0
- package/src/factories/ValueFactory.ts +12 -12
- package/src/factories/internal/metadata/MetadataHelper.ts +12 -12
- package/src/factories/internal/metadata/emplace_metadata_object.ts +140 -140
- package/src/factories/internal/metadata/explore_metadata.ts +92 -92
- package/src/factories/internal/metadata/iterate_metadata.ts +80 -80
- package/src/factories/internal/metadata/iterate_metadata_array.ts +29 -29
- package/src/factories/internal/metadata/iterate_metadata_atomic.ts +59 -59
- package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +58 -58
- package/src/factories/internal/metadata/iterate_metadata_map.ts +41 -41
- package/src/factories/internal/metadata/iterate_metadata_native.ts +222 -222
- package/src/factories/internal/metadata/iterate_metadata_object.ts +48 -48
- package/src/factories/internal/metadata/iterate_metadata_resolve.ts +27 -27
- package/src/factories/internal/metadata/iterate_metadata_set.ts +33 -33
- package/src/factories/internal/metadata/iterate_metadata_template.ts +38 -38
- package/src/factories/internal/metadata/iterate_metadata_tuple.ts +45 -45
- package/src/factories/internal/metadata/iterate_metadata_union.ts +59 -59
- package/src/functional/$any.ts +3 -3
- package/src/functional/$every.ts +11 -11
- package/src/functional/$guard.ts +35 -35
- package/src/functional/$is_between.ts +7 -7
- package/src/functional/$is_email.ts +5 -5
- package/src/functional/$is_ipv4.ts +5 -5
- package/src/functional/$is_ipv6.ts +5 -5
- package/src/functional/$is_url.ts +5 -5
- package/src/functional/$is_uuid.ts +5 -5
- package/src/functional/$join.ts +50 -50
- package/src/functional/$number.ts +12 -12
- package/src/functional/$report.ts +15 -15
- package/src/functional/$rest.ts +3 -3
- package/src/functional/$string.ts +37 -37
- package/src/functional/$tail.ts +6 -6
- package/src/functional/Namespace.ts +121 -121
- package/src/index.ts +4 -4
- package/src/metadata/IJsDocTagInfo.ts +10 -10
- package/src/metadata/IMetadata.ts +25 -25
- package/src/metadata/IMetadataApplication.ts +7 -7
- package/src/metadata/IMetadataConstant.ts +16 -16
- package/src/metadata/IMetadataEntry.ts +6 -6
- package/src/metadata/IMetadataObject.ts +29 -29
- package/src/metadata/IMetadataProperty.ts +11 -11
- package/src/metadata/IMetadataTag.ts +113 -113
- package/src/metadata/Metadata.ts +534 -534
- package/src/metadata/MetadataConstant.ts +3 -3
- package/src/metadata/MetadataObject.ts +131 -131
- package/src/metadata/MetadataProperty.ts +64 -64
- package/src/module.ts +1946 -1946
- package/src/programmers/ApplicationProgrammer.ts +55 -55
- package/src/programmers/AssertCloneProgrammer.ts +71 -60
- package/src/programmers/AssertParseProgrammer.ts +66 -55
- package/src/programmers/AssertProgrammer.ts +232 -435
- package/src/programmers/AssertPruneProgrammer.ts +67 -59
- package/src/programmers/AssertStringifyProgrammer.ts +71 -65
- package/src/programmers/CheckerProgrammer.ts +892 -879
- package/src/programmers/CloneProgrammer.ts +387 -361
- package/src/programmers/FeatureProgrammer.ts +505 -462
- package/src/programmers/IsCloneProgrammer.ts +80 -66
- package/src/programmers/IsParseProgrammer.ts +75 -61
- package/src/programmers/IsProgrammer.ts +200 -200
- package/src/programmers/IsPruneProgrammer.ts +75 -63
- package/src/programmers/IsStringifyProgrammer.ts +80 -69
- package/src/programmers/PruneProgrammer.ts +341 -333
- package/src/programmers/RandomProgrammer.ts +392 -373
- package/src/programmers/StringifyProgrammer.ts +795 -787
- package/src/programmers/ValidateCloneProgrammer.ts +91 -77
- package/src/programmers/ValidateParseProgrammer.ts +70 -59
- package/src/programmers/ValidateProgrammer.ts +267 -238
- package/src/programmers/ValidatePruneProgrammer.ts +84 -73
- package/src/programmers/ValidateStringifyProgrammer.ts +88 -77
- package/src/programmers/helpers/AtomicPredicator.ts +31 -31
- package/src/programmers/helpers/CloneJoiner.ts +134 -124
- package/src/programmers/helpers/FunctionImporeter.ts +55 -46
- package/src/programmers/helpers/IExpressionEntry.ts +12 -12
- package/src/programmers/helpers/OptionPredicator.ts +19 -19
- package/src/programmers/helpers/PruneJoiner.ts +52 -52
- package/src/programmers/helpers/RandomJoiner.ts +149 -142
- package/src/programmers/helpers/RandomRanger.ts +216 -216
- package/src/programmers/helpers/StringifyJoinder.ts +114 -114
- package/src/programmers/helpers/StringifyPredicator.ts +18 -18
- package/src/programmers/helpers/UnionExplorer.ts +274 -274
- package/src/programmers/helpers/UnionPredicator.ts +81 -81
- package/src/programmers/internal/application_array.ts +37 -37
- package/src/programmers/internal/application_boolean.ts +17 -17
- package/src/programmers/internal/application_constant.ts +29 -29
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_default_string.ts +32 -32
- package/src/programmers/internal/application_native.ts +29 -29
- package/src/programmers/internal/application_number.ts +70 -70
- package/src/programmers/internal/application_object.ts +153 -153
- package/src/programmers/internal/application_schema.ts +184 -184
- package/src/programmers/internal/application_string.ts +41 -41
- package/src/programmers/internal/application_templates.ts +27 -27
- package/src/programmers/internal/application_tuple.ts +29 -29
- package/src/programmers/internal/check_array.ts +22 -22
- package/src/programmers/internal/check_array_length.ts +44 -44
- package/src/programmers/internal/check_bigint.ts +64 -64
- package/src/programmers/internal/check_dynamic_properties.ts +197 -197
- package/src/programmers/internal/check_everything.ts +28 -25
- package/src/programmers/internal/check_native.ts +21 -21
- package/src/programmers/internal/check_number.ts +145 -145
- package/src/programmers/internal/check_object.ts +48 -48
- package/src/programmers/internal/check_string.ts +24 -24
- package/src/programmers/internal/check_string_tags.ts +63 -63
- package/src/programmers/internal/check_template.ts +50 -50
- package/src/programmers/internal/check_union_array_like.ts +260 -244
- package/src/programmers/internal/check_union_tuple.ts +33 -33
- package/src/programmers/internal/decode_union_object.ts +73 -73
- package/src/programmers/internal/feature_object_entries.ts +59 -59
- package/src/programmers/internal/metadata_to_pattern.ts +31 -31
- package/src/programmers/internal/prune_object_properties.ts +60 -60
- package/src/programmers/internal/stringify_dynamic_properties.ts +165 -164
- package/src/programmers/internal/stringify_native.ts +8 -8
- package/src/programmers/internal/stringify_regular_properties.ts +81 -81
- package/src/programmers/internal/template_to_pattern.ts +15 -15
- package/src/schemas/IJsonApplication.ts +9 -9
- package/src/schemas/IJsonComponents.ts +26 -26
- package/src/schemas/IJsonSchema.ts +127 -127
- package/src/transform.ts +21 -21
- package/src/transformers/CallExpressionTransformer.ts +172 -165
- package/src/transformers/ExpressionWithArgumentTransformer.ts +66 -66
- package/src/transformers/FileTransformer.ts +49 -49
- package/src/transformers/IProject.ts +11 -11
- package/src/transformers/ITransformOptions.ts +62 -62
- package/src/transformers/ImportTransformer.ts +60 -0
- package/src/transformers/NodeTransformer.ts +19 -19
- package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +120 -120
- package/src/transformers/features/miscellaneous/AssertCloneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/CloneTransformer.ts +46 -46
- package/src/transformers/features/miscellaneous/CreateAssertCloneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateCloneTransformer.ts +31 -31
- package/src/transformers/features/miscellaneous/CreateIsCloneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreatePruneTransformer.ts +31 -31
- package/src/transformers/features/miscellaneous/CreateRandomGenerator.ts +39 -39
- package/src/transformers/features/miscellaneous/CreateValidateCloneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +32 -32
- package/src/transformers/features/miscellaneous/IsCloneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/MetadataTransformer.ts +55 -55
- package/src/transformers/features/miscellaneous/PruneTransformer.ts +46 -46
- package/src/transformers/features/miscellaneous/RandomTransformer.ts +45 -45
- package/src/transformers/features/miscellaneous/ValidateCloneTransformer.ts +38 -38
- package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +38 -38
- package/src/transformers/features/parsers/AssertParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateIsParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/IsParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/ValidateParseTransformer.ts +36 -36
- package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +31 -31
- package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +32 -32
- package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/StringifyTransformer.ts +46 -46
- package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +38 -38
- package/src/transformers/features/validators/AssertTransformer.ts +43 -43
- package/src/transformers/features/validators/CreateAssertTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateIsTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateValidateTransformer.ts +35 -35
- package/src/transformers/features/validators/IsTransformer.ts +43 -43
- package/src/transformers/features/validators/ValidateTransformer.ts +43 -43
- package/src/typings/Atomic.ts +17 -17
- package/src/typings/ClassProperties.ts +5 -5
- package/src/typings/OmitNever.ts +3 -3
- package/src/typings/SpecialFields.ts +3 -3
- package/src/typings/Writable.ts +11 -11
- package/src/utils/ArrayUtil.ts +49 -49
- package/src/utils/Escaper.ts +50 -50
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/PatternUtil.ts +30 -30
- package/src/utils/RandomGenerator.ts +90 -90
- package/src/utils/Singleton.ts +17 -17
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { CloneProgrammer } from "../../../programmers/CloneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateCloneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
31
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { CloneProgrammer } from "../../../programmers/CloneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateCloneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
31
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IsCloneProgrammer } from "../../../programmers/IsCloneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateIsCloneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsCloneProgrammer } from "../../../programmers/IsCloneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateIsCloneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateIsPruneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateIsPruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { PruneProgrammer } from "../../../programmers/PruneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreatePruneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
31
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { PruneProgrammer } from "../../../programmers/PruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreatePruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
31
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { RandomProgrammer } from "../../../programmers/RandomProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateRandomTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
11
|
-
expression: ts.CallExpression,
|
|
12
|
-
): ts.Expression {
|
|
13
|
-
if (!expression.typeArguments?.[0])
|
|
14
|
-
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
15
|
-
|
|
16
|
-
const type: ts.Type | undefined = project.checker.getTypeFromTypeNode(
|
|
17
|
-
expression.typeArguments[0],
|
|
18
|
-
);
|
|
19
|
-
if (type.isTypeParameter())
|
|
20
|
-
throw new Error(ErrorMessages.NO_GENERIC_ARGUMENT);
|
|
21
|
-
|
|
22
|
-
return RandomProgrammer.generate(
|
|
23
|
-
{
|
|
24
|
-
...project,
|
|
25
|
-
options: {
|
|
26
|
-
...project.options,
|
|
27
|
-
functional: false,
|
|
28
|
-
numeric: false,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
modulo,
|
|
32
|
-
)(type);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const enum ErrorMessages {
|
|
37
|
-
NOT_SPECIFIED = "Error on typia.createRandom(): generic argument is not specified.",
|
|
38
|
-
NO_GENERIC_ARGUMENT = "Error on typia.createRandom(): non-specified generic argument.",
|
|
39
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { RandomProgrammer } from "../../../programmers/RandomProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateRandomTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
if (!expression.typeArguments?.[0])
|
|
14
|
+
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
15
|
+
|
|
16
|
+
const type: ts.Type | undefined = project.checker.getTypeFromTypeNode(
|
|
17
|
+
expression.typeArguments[0],
|
|
18
|
+
);
|
|
19
|
+
if (type.isTypeParameter())
|
|
20
|
+
throw new Error(ErrorMessages.NO_GENERIC_ARGUMENT);
|
|
21
|
+
|
|
22
|
+
return RandomProgrammer.generate(
|
|
23
|
+
{
|
|
24
|
+
...project,
|
|
25
|
+
options: {
|
|
26
|
+
...project.options,
|
|
27
|
+
functional: false,
|
|
28
|
+
numeric: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
modulo,
|
|
32
|
+
)(type);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const enum ErrorMessages {
|
|
37
|
+
NOT_SPECIFIED = "Error on typia.createRandom(): generic argument is not specified.",
|
|
38
|
+
NO_GENERIC_ARGUMENT = "Error on typia.createRandom(): non-specified generic argument.",
|
|
39
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { ValidateCloneProgrammer } from "../../../programmers/ValidateCloneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateValidateCloneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ValidateCloneProgrammer } from "../../../programmers/ValidateCloneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateValidateCloneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { ValidatePruneProgrammer } from "../../../programmers/ValidatePruneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateValidatePruneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ValidatePruneProgrammer } from "../../../programmers/ValidatePruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateValidatePruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
32
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IsCloneProgrammer } from "../../../programmers/IsCloneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace IsCloneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
38
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsCloneProgrammer } from "../../../programmers/IsCloneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace IsCloneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
38
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace IsPruneTransformer {
|
|
8
|
-
export function transform(
|
|
9
|
-
project: IProject,
|
|
10
|
-
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
38
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace IsPruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
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.",
|
|
38
|
+
}
|