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.
Files changed (237) hide show
  1. package/README.md +14 -9
  2. package/lib/programmers/AssertCloneProgrammer.d.ts +1 -1
  3. package/lib/programmers/AssertCloneProgrammer.js +4 -4
  4. package/lib/programmers/AssertCloneProgrammer.js.map +1 -1
  5. package/lib/programmers/AssertParseProgrammer.d.ts +1 -1
  6. package/lib/programmers/AssertParseProgrammer.js +3 -3
  7. package/lib/programmers/AssertParseProgrammer.js.map +1 -1
  8. package/lib/programmers/AssertProgrammer.d.ts +1 -1
  9. package/lib/programmers/AssertProgrammer.js +3 -3
  10. package/lib/programmers/AssertProgrammer.js.map +1 -1
  11. package/lib/programmers/AssertPruneProgrammer.d.ts +1 -1
  12. package/lib/programmers/AssertPruneProgrammer.js +4 -4
  13. package/lib/programmers/AssertPruneProgrammer.js.map +1 -1
  14. package/lib/programmers/AssertStringifyProgrammer.d.ts +1 -1
  15. package/lib/programmers/AssertStringifyProgrammer.js +3 -3
  16. package/lib/programmers/AssertStringifyProgrammer.js.map +1 -1
  17. package/lib/programmers/CheckerProgrammer.d.ts +1 -1
  18. package/lib/programmers/CheckerProgrammer.js +2 -2
  19. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  20. package/lib/programmers/CloneProgrammer.d.ts +1 -1
  21. package/lib/programmers/CloneProgrammer.js +4 -4
  22. package/lib/programmers/CloneProgrammer.js.map +1 -1
  23. package/lib/programmers/FeatureProgrammer.d.ts +3 -3
  24. package/lib/programmers/FeatureProgrammer.js +2 -2
  25. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  26. package/lib/programmers/IsCloneProgrammer.d.ts +1 -1
  27. package/lib/programmers/IsCloneProgrammer.js +4 -4
  28. package/lib/programmers/IsCloneProgrammer.js.map +1 -1
  29. package/lib/programmers/IsParseProgrammer.d.ts +1 -1
  30. package/lib/programmers/IsParseProgrammer.js +3 -3
  31. package/lib/programmers/IsParseProgrammer.js.map +1 -1
  32. package/lib/programmers/IsProgrammer.d.ts +1 -1
  33. package/lib/programmers/IsPruneProgrammer.d.ts +1 -1
  34. package/lib/programmers/IsPruneProgrammer.js +4 -4
  35. package/lib/programmers/IsPruneProgrammer.js.map +1 -1
  36. package/lib/programmers/IsStringifyProgrammer.d.ts +1 -1
  37. package/lib/programmers/IsStringifyProgrammer.js +4 -4
  38. package/lib/programmers/IsStringifyProgrammer.js.map +1 -1
  39. package/lib/programmers/PruneProgrammer.d.ts +1 -1
  40. package/lib/programmers/PruneProgrammer.js +2 -2
  41. package/lib/programmers/PruneProgrammer.js.map +1 -1
  42. package/lib/programmers/RandomProgrammer.d.ts +1 -1
  43. package/lib/programmers/RandomProgrammer.js +2 -2
  44. package/lib/programmers/RandomProgrammer.js.map +1 -1
  45. package/lib/programmers/StringifyProgrammer.d.ts +1 -1
  46. package/lib/programmers/StringifyProgrammer.js +2 -2
  47. package/lib/programmers/StringifyProgrammer.js.map +1 -1
  48. package/lib/programmers/ValidateCloneProgrammer.d.ts +1 -1
  49. package/lib/programmers/ValidateCloneProgrammer.js +4 -4
  50. package/lib/programmers/ValidateCloneProgrammer.js.map +1 -1
  51. package/lib/programmers/ValidateParseProgrammer.d.ts +1 -1
  52. package/lib/programmers/ValidateParseProgrammer.js +3 -3
  53. package/lib/programmers/ValidateParseProgrammer.js.map +1 -1
  54. package/lib/programmers/ValidateProgrammer.d.ts +1 -1
  55. package/lib/programmers/ValidateProgrammer.js +3 -3
  56. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  57. package/lib/programmers/ValidatePruneProgrammer.d.ts +1 -1
  58. package/lib/programmers/ValidatePruneProgrammer.js +4 -4
  59. package/lib/programmers/ValidatePruneProgrammer.js.map +1 -1
  60. package/lib/programmers/ValidateStringifyProgrammer.d.ts +1 -1
  61. package/lib/programmers/ValidateStringifyProgrammer.js +4 -4
  62. package/lib/programmers/ValidateStringifyProgrammer.js.map +1 -1
  63. package/lib/transformers/features/miscellaneous/AssertCloneTransformer.d.ts +1 -3
  64. package/lib/transformers/features/miscellaneous/AssertCloneTransformer.js +2 -15
  65. package/lib/transformers/features/miscellaneous/AssertCloneTransformer.js.map +1 -1
  66. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.d.ts +1 -3
  67. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js +2 -15
  68. package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js.map +1 -1
  69. package/lib/transformers/features/miscellaneous/CloneTransformer.d.ts +1 -3
  70. package/lib/transformers/features/miscellaneous/CloneTransformer.js +2 -26
  71. package/lib/transformers/features/miscellaneous/CloneTransformer.js.map +1 -1
  72. package/lib/transformers/features/miscellaneous/CreateAssertCloneTransformer.d.ts +1 -3
  73. package/lib/transformers/features/miscellaneous/CreateAssertCloneTransformer.js +2 -10
  74. package/lib/transformers/features/miscellaneous/CreateAssertCloneTransformer.js.map +1 -1
  75. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.d.ts +1 -3
  76. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js +2 -10
  77. package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js.map +1 -1
  78. package/lib/transformers/features/miscellaneous/CreateCloneTransformer.d.ts +1 -3
  79. package/lib/transformers/features/miscellaneous/CreateCloneTransformer.js +2 -10
  80. package/lib/transformers/features/miscellaneous/CreateCloneTransformer.js.map +1 -1
  81. package/lib/transformers/features/miscellaneous/CreateIsCloneTransformer.d.ts +1 -3
  82. package/lib/transformers/features/miscellaneous/CreateIsCloneTransformer.js +2 -10
  83. package/lib/transformers/features/miscellaneous/CreateIsCloneTransformer.js.map +1 -1
  84. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.d.ts +1 -3
  85. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js +2 -10
  86. package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js.map +1 -1
  87. package/lib/transformers/features/miscellaneous/CreatePruneTransformer.d.ts +1 -3
  88. package/lib/transformers/features/miscellaneous/CreatePruneTransformer.js +2 -10
  89. package/lib/transformers/features/miscellaneous/CreatePruneTransformer.js.map +1 -1
  90. package/lib/transformers/features/miscellaneous/CreateRandomGenerator.js +3 -2
  91. package/lib/transformers/features/miscellaneous/CreateRandomGenerator.js.map +1 -1
  92. package/lib/transformers/features/miscellaneous/CreateValidateCloneTransformer.d.ts +1 -3
  93. package/lib/transformers/features/miscellaneous/CreateValidateCloneTransformer.js +2 -10
  94. package/lib/transformers/features/miscellaneous/CreateValidateCloneTransformer.js.map +1 -1
  95. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.d.ts +1 -3
  96. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js +2 -10
  97. package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js.map +1 -1
  98. package/lib/transformers/features/miscellaneous/IsCloneTransformer.d.ts +1 -3
  99. package/lib/transformers/features/miscellaneous/IsCloneTransformer.js +2 -15
  100. package/lib/transformers/features/miscellaneous/IsCloneTransformer.js.map +1 -1
  101. package/lib/transformers/features/miscellaneous/IsPruneTransformer.d.ts +1 -3
  102. package/lib/transformers/features/miscellaneous/IsPruneTransformer.js +2 -15
  103. package/lib/transformers/features/miscellaneous/IsPruneTransformer.js.map +1 -1
  104. package/lib/transformers/features/miscellaneous/PruneTransformer.d.ts +1 -3
  105. package/lib/transformers/features/miscellaneous/PruneTransformer.js +2 -26
  106. package/lib/transformers/features/miscellaneous/PruneTransformer.js.map +1 -1
  107. package/lib/transformers/features/miscellaneous/RandomTransformer.js +3 -2
  108. package/lib/transformers/features/miscellaneous/RandomTransformer.js.map +1 -1
  109. package/lib/transformers/features/miscellaneous/ValidateCloneTransformer.d.ts +1 -3
  110. package/lib/transformers/features/miscellaneous/ValidateCloneTransformer.js +2 -15
  111. package/lib/transformers/features/miscellaneous/ValidateCloneTransformer.js.map +1 -1
  112. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.d.ts +1 -3
  113. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js +2 -15
  114. package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js.map +1 -1
  115. package/lib/transformers/features/parsers/AssertParseTransformer.d.ts +1 -3
  116. package/lib/transformers/features/parsers/AssertParseTransformer.js +2 -14
  117. package/lib/transformers/features/parsers/AssertParseTransformer.js.map +1 -1
  118. package/lib/transformers/features/parsers/CreateAssertParseTransformer.d.ts +1 -3
  119. package/lib/transformers/features/parsers/CreateAssertParseTransformer.js +2 -10
  120. package/lib/transformers/features/parsers/CreateAssertParseTransformer.js.map +1 -1
  121. package/lib/transformers/features/parsers/CreateIsParseTransformer.d.ts +1 -3
  122. package/lib/transformers/features/parsers/CreateIsParseTransformer.js +2 -10
  123. package/lib/transformers/features/parsers/CreateIsParseTransformer.js.map +1 -1
  124. package/lib/transformers/features/parsers/CreateValidateParseTransformer.d.ts +1 -3
  125. package/lib/transformers/features/parsers/CreateValidateParseTransformer.js +2 -10
  126. package/lib/transformers/features/parsers/CreateValidateParseTransformer.js.map +1 -1
  127. package/lib/transformers/features/parsers/IsParseTransformer.d.ts +1 -3
  128. package/lib/transformers/features/parsers/IsParseTransformer.js +2 -14
  129. package/lib/transformers/features/parsers/IsParseTransformer.js.map +1 -1
  130. package/lib/transformers/features/parsers/ValidateParseTransformer.d.ts +1 -3
  131. package/lib/transformers/features/parsers/ValidateParseTransformer.js +2 -14
  132. package/lib/transformers/features/parsers/ValidateParseTransformer.js.map +1 -1
  133. package/lib/transformers/features/stringifiers/AssertStringifyTransformer.d.ts +1 -3
  134. package/lib/transformers/features/stringifiers/AssertStringifyTransformer.js +4 -15
  135. package/lib/transformers/features/stringifiers/AssertStringifyTransformer.js.map +1 -1
  136. package/lib/transformers/features/stringifiers/CreateAssertStringifyTransformer.d.ts +1 -3
  137. package/lib/transformers/features/stringifiers/CreateAssertStringifyTransformer.js +2 -10
  138. package/lib/transformers/features/stringifiers/CreateAssertStringifyTransformer.js.map +1 -1
  139. package/lib/transformers/features/stringifiers/CreateIsStringifyTransformer.d.ts +1 -3
  140. package/lib/transformers/features/stringifiers/CreateIsStringifyTransformer.js +2 -10
  141. package/lib/transformers/features/stringifiers/CreateIsStringifyTransformer.js.map +1 -1
  142. package/lib/transformers/features/stringifiers/CreateStringifyTransformer.d.ts +1 -3
  143. package/lib/transformers/features/stringifiers/CreateStringifyTransformer.js +2 -10
  144. package/lib/transformers/features/stringifiers/CreateStringifyTransformer.js.map +1 -1
  145. package/lib/transformers/features/stringifiers/CreateValidateStringifyProgrammer.d.ts +1 -3
  146. package/lib/transformers/features/stringifiers/CreateValidateStringifyProgrammer.js +4 -10
  147. package/lib/transformers/features/stringifiers/CreateValidateStringifyProgrammer.js.map +1 -1
  148. package/lib/transformers/features/stringifiers/IsStringifyTransformer.d.ts +1 -3
  149. package/lib/transformers/features/stringifiers/IsStringifyTransformer.js +2 -15
  150. package/lib/transformers/features/stringifiers/IsStringifyTransformer.js.map +1 -1
  151. package/lib/transformers/features/stringifiers/StringifyTransformer.d.ts +1 -3
  152. package/lib/transformers/features/stringifiers/StringifyTransformer.js +2 -26
  153. package/lib/transformers/features/stringifiers/StringifyTransformer.js.map +1 -1
  154. package/lib/transformers/features/stringifiers/ValidateStringifyTransformer.d.ts +1 -3
  155. package/lib/transformers/features/stringifiers/ValidateStringifyTransformer.js +4 -15
  156. package/lib/transformers/features/stringifiers/ValidateStringifyTransformer.js.map +1 -1
  157. package/lib/transformers/features/validators/AssertTransformer.d.ts +1 -3
  158. package/lib/transformers/features/validators/AssertTransformer.js +6 -22
  159. package/lib/transformers/features/validators/AssertTransformer.js.map +1 -1
  160. package/lib/transformers/features/validators/CreateAssertTransformer.d.ts +1 -3
  161. package/lib/transformers/features/validators/CreateAssertTransformer.js +6 -17
  162. package/lib/transformers/features/validators/CreateAssertTransformer.js.map +1 -1
  163. package/lib/transformers/features/validators/CreateIsTransformer.d.ts +1 -3
  164. package/lib/transformers/features/validators/CreateIsTransformer.js +4 -17
  165. package/lib/transformers/features/validators/CreateIsTransformer.js.map +1 -1
  166. package/lib/transformers/features/validators/CreateValidateTransformer.d.ts +1 -3
  167. package/lib/transformers/features/validators/CreateValidateTransformer.js +6 -17
  168. package/lib/transformers/features/validators/CreateValidateTransformer.js.map +1 -1
  169. package/lib/transformers/features/validators/IsTransformer.d.ts +1 -3
  170. package/lib/transformers/features/validators/IsTransformer.js +6 -22
  171. package/lib/transformers/features/validators/IsTransformer.js.map +1 -1
  172. package/lib/transformers/features/validators/ValidateTransformer.d.ts +1 -3
  173. package/lib/transformers/features/validators/ValidateTransformer.js +6 -22
  174. package/lib/transformers/features/validators/ValidateTransformer.js.map +1 -1
  175. package/lib/transformers/internal/GenericTransformer.d.ts +6 -0
  176. package/lib/transformers/internal/GenericTransformer.js +72 -0
  177. package/lib/transformers/internal/GenericTransformer.js.map +1 -0
  178. package/package.json +2 -1
  179. package/src/programmers/AssertCloneProgrammer.ts +6 -7
  180. package/src/programmers/AssertParseProgrammer.ts +5 -6
  181. package/src/programmers/AssertProgrammer.ts +3 -3
  182. package/src/programmers/AssertPruneProgrammer.ts +4 -4
  183. package/src/programmers/AssertStringifyProgrammer.ts +3 -3
  184. package/src/programmers/CheckerProgrammer.ts +3 -2
  185. package/src/programmers/CloneProgrammer.ts +6 -7
  186. package/src/programmers/FeatureProgrammer.ts +5 -5
  187. package/src/programmers/IsCloneProgrammer.ts +7 -7
  188. package/src/programmers/IsParseProgrammer.ts +5 -6
  189. package/src/programmers/IsPruneProgrammer.ts +4 -4
  190. package/src/programmers/IsStringifyProgrammer.ts +5 -4
  191. package/src/programmers/PruneProgrammer.ts +2 -2
  192. package/src/programmers/RandomProgrammer.ts +4 -5
  193. package/src/programmers/StringifyProgrammer.ts +2 -2
  194. package/src/programmers/ValidateCloneProgrammer.ts +6 -7
  195. package/src/programmers/ValidateParseProgrammer.ts +5 -6
  196. package/src/programmers/ValidateProgrammer.ts +5 -6
  197. package/src/programmers/ValidatePruneProgrammer.ts +6 -7
  198. package/src/programmers/ValidateStringifyProgrammer.ts +5 -4
  199. package/src/transformers/features/miscellaneous/AssertCloneTransformer.ts +4 -33
  200. package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +4 -33
  201. package/src/transformers/features/miscellaneous/CloneTransformer.ts +4 -41
  202. package/src/transformers/features/miscellaneous/CreateAssertCloneTransformer.ts +4 -27
  203. package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +4 -27
  204. package/src/transformers/features/miscellaneous/CreateCloneTransformer.ts +4 -26
  205. package/src/transformers/features/miscellaneous/CreateIsCloneTransformer.ts +4 -27
  206. package/src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts +4 -27
  207. package/src/transformers/features/miscellaneous/CreatePruneTransformer.ts +4 -26
  208. package/src/transformers/features/miscellaneous/CreateRandomGenerator.ts +7 -4
  209. package/src/transformers/features/miscellaneous/CreateValidateCloneTransformer.ts +4 -27
  210. package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +4 -27
  211. package/src/transformers/features/miscellaneous/IsCloneTransformer.ts +4 -33
  212. package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +4 -33
  213. package/src/transformers/features/miscellaneous/PruneTransformer.ts +4 -41
  214. package/src/transformers/features/miscellaneous/RandomTransformer.ts +7 -4
  215. package/src/transformers/features/miscellaneous/ValidateCloneTransformer.ts +4 -33
  216. package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +4 -33
  217. package/src/transformers/features/parsers/AssertParseTransformer.ts +4 -31
  218. package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +4 -27
  219. package/src/transformers/features/parsers/CreateIsParseTransformer.ts +4 -27
  220. package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +4 -27
  221. package/src/transformers/features/parsers/IsParseTransformer.ts +4 -31
  222. package/src/transformers/features/parsers/ValidateParseTransformer.ts +4 -31
  223. package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +5 -33
  224. package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +4 -27
  225. package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +4 -27
  226. package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +4 -26
  227. package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +6 -27
  228. package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +4 -33
  229. package/src/transformers/features/stringifiers/StringifyTransformer.ts +4 -41
  230. package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +5 -33
  231. package/src/transformers/features/validators/AssertTransformer.ts +6 -38
  232. package/src/transformers/features/validators/CreateAssertTransformer.ts +7 -30
  233. package/src/transformers/features/validators/CreateIsTransformer.ts +5 -30
  234. package/src/transformers/features/validators/CreateValidateTransformer.ts +7 -30
  235. package/src/transformers/features/validators/IsTransformer.ts +5 -38
  236. package/src/transformers/features/validators/ValidateTransformer.ts +6 -38
  237. package/src/transformers/internal/GenericTransformer.ts +99 -0
@@ -1,46 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { PruneProgrammer } from "../../../programmers/PruneProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace PruneTransformer {
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
- 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
- PruneProgrammer.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.prune(): no input value.",
45
- GENERIC_ARGUMENT = "Error on typia.prune(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.scalar("prune")(
7
+ (project, modulo) => PruneProgrammer.generate(project, modulo),
8
+ );
46
9
  }
@@ -10,15 +10,18 @@ export namespace RandomTransformer {
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
- const type: ts.Type | undefined = project.checker.getTypeFromTypeNode(
17
- expression.typeArguments[0],
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 ts.factory.createCallExpression(
23
26
  RandomProgrammer.generate(
24
27
  {
@@ -30,7 +33,7 @@ export namespace RandomTransformer {
30
33
  },
31
34
  },
32
35
  modulo,
33
- )(type),
36
+ )(type, node.getText()),
34
37
  undefined,
35
38
  expression.arguments.length
36
39
  ? [expression.arguments[0]!]
@@ -1,38 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { ValidateCloneProgrammer } from "../../../programmers/ValidateCloneProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace ValidateCloneTransformer {
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
- ValidateCloneProgrammer.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.validateClone(): no input value.",
37
- GENERIC_ARGUMENT = "Error on typia.validateClone(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.scalar("validatClone")(
7
+ (project, modulo) => ValidateCloneProgrammer.generate(project, modulo),
8
+ );
38
9
  }
@@ -1,38 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { ValidatePruneProgrammer } from "../../../programmers/ValidatePruneProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace ValidatePruneTransformer {
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
- ValidatePruneProgrammer.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.validatePrune(): no input value.",
37
- GENERIC_ARGUMENT = "Error on typia.validatePrune(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.scalar("validatPrune")(
7
+ (project, modulo) => ValidatePruneProgrammer.generate(project, modulo),
8
+ );
38
9
  }
@@ -1,36 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { AssertParseProgrammer } from "../../../programmers/AssertParseProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace AssertParseTransformer {
8
- export function transform(
9
- project: IProject,
10
- modulo: ts.LeftHandSideExpression,
11
- expression: ts.CallExpression,
12
- ): ts.Expression {
13
- // CHECK GENERIC ARGUMENT EXVALIDATETENCE
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 ts.factory.createCallExpression(
26
- AssertParseProgrammer.generate(project, modulo)(type),
27
- undefined,
28
- [expression.arguments[0]!],
29
- );
30
- }
31
- }
32
-
33
- const enum ErrorMessages {
34
- NOT_SPECIFIED = "Error on typia.assertParse(): generic argument is not specified",
35
- GENERIC_ARGUMENT = "Error on typia.assertParse(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.scalar("assertParse")(
7
+ (project, modulo) => AssertParseProgrammer.generate(project, modulo),
8
+ );
36
9
  }
@@ -1,32 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { AssertParseProgrammer } from "../../../programmers/AssertParseProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace CreateAssertParseTransformer {
8
- export function transform(
9
- project: IProject,
10
- modulo: ts.LeftHandSideExpression,
11
- expression: ts.CallExpression,
12
- ): ts.Expression {
13
- // CHECK GENERIC ARGUMENT EXASSERTTENCE
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 AssertParseProgrammer.generate(project, modulo)(type);
26
- }
27
- }
28
-
29
- const enum ErrorMessages {
30
- NOT_SPECIFIED = "Error on typia.assertParse(): generic argument is not specified.",
31
- GENERIC_ARGUMENT = "Error on typia.assertParse(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.factory("createAssertParse")(
7
+ (project, modulo) => AssertParseProgrammer.generate(project, modulo),
8
+ );
32
9
  }
@@ -1,32 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { IsParseProgrammer } from "../../../programmers/IsParseProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace CreateIsParseTransformer {
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 IsParseProgrammer.generate(project, modulo)(type);
26
- }
27
- }
28
-
29
- const enum ErrorMessages {
30
- NOT_SPECIFIED = "Error on typia.isParse(): generic argument is not specified.",
31
- GENERIC_ARGUMENT = "Error on typia.isParse(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.factory("createIsParse")(
7
+ (project, modulo) => IsParseProgrammer.generate(project, modulo),
8
+ );
32
9
  }
@@ -1,32 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { ValidateParseProgrammer } from "../../../programmers/ValidateParseProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace CreateValidateParseTransformer {
8
- export function transform(
9
- project: IProject,
10
- modulo: ts.LeftHandSideExpression,
11
- expression: ts.CallExpression,
12
- ): ts.Expression {
13
- // CHECK GENERIC ARGUMENT EXVALIDATETENCE
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 ValidateParseProgrammer.generate(project, modulo)(type);
26
- }
27
- }
28
-
29
- const enum ErrorMessages {
30
- NOT_SPECIFIED = "Error on typia.validateParse(): generic argument is not specified.",
31
- GENERIC_ARGUMENT = "Error on typia.validateParse(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.factory("createValidateParse")(
7
+ (project, modulo) => ValidateParseProgrammer.generate(project, modulo),
8
+ );
32
9
  }
@@ -1,36 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { IsParseProgrammer } from "../../../programmers/IsParseProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace IsParseTransformer {
8
- export function transform(
9
- project: IProject,
10
- modulo: ts.LeftHandSideExpression,
11
- expression: ts.CallExpression,
12
- ): ts.Expression {
13
- // CHECK GENERIC ARGUMENT EXVALIDATETENCE
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 ts.factory.createCallExpression(
26
- IsParseProgrammer.generate(project, modulo)(type),
27
- undefined,
28
- [expression.arguments[0]!],
29
- );
30
- }
31
- }
32
-
33
- const enum ErrorMessages {
34
- NOT_SPECIFIED = "Error on typia.isParse(): generic argument is not specified.",
35
- GENERIC_ARGUMENT = "Error on typia.isParse(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.scalar("isParse")(
7
+ (project, modulo) => IsParseProgrammer.generate(project, modulo),
8
+ );
36
9
  }
@@ -1,36 +1,9 @@
1
- import ts from "typescript";
2
-
3
1
  import { ValidateParseProgrammer } from "../../../programmers/ValidateParseProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace ValidateParseTransformer {
8
- export function transform(
9
- project: IProject,
10
- modulo: ts.LeftHandSideExpression,
11
- expression: ts.CallExpression,
12
- ): ts.Expression {
13
- // CHECK GENERIC ARGUMENT EXVALIDATETENCE
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 ts.factory.createCallExpression(
26
- ValidateParseProgrammer.generate(project, modulo)(type),
27
- undefined,
28
- [expression.arguments[0]!],
29
- );
30
- }
31
- }
32
-
33
- const enum ErrorMessages {
34
- NOT_SPECIFIED = "Error on typia.validateParse(): generic argument is not specified.",
35
- GENERIC_ARGUMENT = "Error on typia.validateParse(): non-specified generic argument.",
6
+ export const transform = GenericTransformer.scalar("validatParse")(
7
+ (project, modulo) => ValidateParseProgrammer.generate(project, modulo),
8
+ );
36
9
  }
@@ -1,38 +1,10 @@
1
- import ts from "typescript";
2
-
3
1
  import { AssertStringifyProgrammer } from "../../../programmers/AssertStringifyProgrammer";
4
2
 
5
- import { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace AssertStringifyTransformer {
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
- 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 { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace CreateAssertStringifyTransformer {
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 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 { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace CreateIsStringifyTransformer {
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 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 { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace CreateStringifyTransformer {
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 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 { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace CreateValidateStringifyTransformer {
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 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 { IProject } from "../../IProject";
3
+ import { GenericTransformer } from "../../internal/GenericTransformer";
6
4
 
7
5
  export namespace IsStringifyTransformer {
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
- 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
  }