typia 3.8.4-dev.20230502 → 4.0.0-dev.20230502

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 (283) hide show
  1. package/README.md +9 -1
  2. package/lib/factories/ProtocolFactory.d.ts +8 -0
  3. package/lib/factories/ProtocolFactory.js +112 -0
  4. package/lib/factories/ProtocolFactory.js.map +1 -0
  5. package/lib/factories/internal/protocols/ProtocolMetadataUtil.d.ts +16 -0
  6. package/lib/factories/internal/protocols/ProtocolMetadataUtil.js +160 -0
  7. package/lib/factories/internal/protocols/ProtocolMetadataUtil.js.map +1 -0
  8. package/lib/factories/internal/protocols/emplace_protocol_object.d.ts +3 -0
  9. package/lib/factories/internal/protocols/emplace_protocol_object.js +47 -0
  10. package/lib/factories/internal/protocols/emplace_protocol_object.js.map +1 -0
  11. package/lib/factories/internal/protocols/emplace_protocol_property.d.ts +4 -0
  12. package/lib/factories/internal/protocols/emplace_protocol_property.js +20 -0
  13. package/lib/factories/internal/protocols/emplace_protocol_property.js.map +1 -0
  14. package/lib/factories/internal/protocols/iterate_protocol_atomic.d.ts +3 -0
  15. package/lib/factories/internal/protocols/iterate_protocol_atomic.js +69 -0
  16. package/lib/factories/internal/protocols/iterate_protocol_atomic.js.map +1 -0
  17. package/lib/factories/internal/protocols/iterate_protocol_constant.d.ts +2 -0
  18. package/lib/factories/internal/protocols/iterate_protocol_constant.js +30 -0
  19. package/lib/factories/internal/protocols/iterate_protocol_constant.js.map +1 -0
  20. package/lib/factories/internal/protocols/iterate_protocol_main.d.ts +3 -0
  21. package/lib/factories/internal/protocols/iterate_protocol_main.js +17 -0
  22. package/lib/factories/internal/protocols/iterate_protocol_main.js.map +1 -0
  23. package/lib/factories/internal/protocols/iterate_protocol_map.d.ts +4 -0
  24. package/lib/factories/internal/protocols/iterate_protocol_map.js +75 -0
  25. package/lib/factories/internal/protocols/iterate_protocol_map.js.map +1 -0
  26. package/lib/factories/internal/protocols/iterate_protocol_metadata.d.ts +5 -0
  27. package/lib/factories/internal/protocols/iterate_protocol_metadata.js +190 -0
  28. package/lib/factories/internal/protocols/iterate_protocol_metadata.js.map +1 -0
  29. package/lib/factories/internal/protocols/iterate_protocol_native.d.ts +2 -0
  30. package/lib/factories/internal/protocols/iterate_protocol_native.js +33 -0
  31. package/lib/factories/internal/protocols/iterate_protocol_native.js.map +1 -0
  32. package/lib/factories/internal/protocols/iterate_protocol_never.d.ts +1 -0
  33. package/lib/factories/internal/protocols/iterate_protocol_never.js +6 -0
  34. package/lib/factories/internal/protocols/iterate_protocol_never.js.map +1 -0
  35. package/lib/factories/internal/protocols/iterate_protocol_object.d.ts +4 -0
  36. package/lib/factories/internal/protocols/iterate_protocol_object.js +157 -0
  37. package/lib/factories/internal/protocols/iterate_protocol_object.js.map +1 -0
  38. package/lib/factories/internal/protocols/iterate_protocol_repeated.d.ts +5 -0
  39. package/lib/factories/internal/protocols/iterate_protocol_repeated.js +25 -0
  40. package/lib/factories/internal/protocols/iterate_protocol_repeated.js.map +1 -0
  41. package/lib/factories/internal/protocols/iterate_protocol_tuple.d.ts +3 -0
  42. package/lib/factories/internal/protocols/iterate_protocol_tuple.js +46 -0
  43. package/lib/factories/internal/protocols/iterate_protocol_tuple.js.map +1 -0
  44. package/lib/functional/$proto_bytes.d.ts +2 -0
  45. package/lib/functional/$proto_bytes.js +37 -0
  46. package/lib/functional/$proto_bytes.js.map +1 -0
  47. package/lib/functional/$proto_field.d.ts +10 -0
  48. package/lib/functional/$proto_field.js +42 -0
  49. package/lib/functional/$proto_field.js.map +1 -0
  50. package/lib/functional/$proto_float.d.ts +4 -0
  51. package/lib/functional/$proto_float.js +28 -0
  52. package/lib/functional/$proto_float.js.map +1 -0
  53. package/lib/functional/$proto_i32.d.ts +2 -0
  54. package/lib/functional/$proto_i32.js +23 -0
  55. package/lib/functional/$proto_i32.js.map +1 -0
  56. package/lib/functional/$proto_i64.d.ts +2 -0
  57. package/lib/functional/$proto_i64.js +31 -0
  58. package/lib/functional/$proto_i64.js.map +1 -0
  59. package/lib/functional/$proto_size.d.ts +6 -0
  60. package/lib/functional/$proto_size.js +76 -0
  61. package/lib/functional/$proto_size.js.map +1 -0
  62. package/lib/functional/$proto_string.d.ts +2 -0
  63. package/lib/functional/$proto_string.js +34 -0
  64. package/lib/functional/$proto_string.js.map +1 -0
  65. package/lib/functional/$varint.d.ts +6 -0
  66. package/lib/functional/$varint.js +99 -0
  67. package/lib/functional/$varint.js.map +1 -0
  68. package/lib/functional/$zigzag.d.ts +4 -0
  69. package/lib/functional/$zigzag.js +34 -0
  70. package/lib/functional/$zigzag.js.map +1 -0
  71. package/lib/messages/IProtocolMap.d.ts +5 -0
  72. package/lib/messages/IProtocolMap.js +3 -0
  73. package/lib/messages/IProtocolMap.js.map +1 -0
  74. package/lib/messages/IProtocolMessage.d.ts +5 -0
  75. package/lib/messages/IProtocolMessage.js +3 -0
  76. package/lib/messages/IProtocolMessage.js.map +1 -0
  77. package/lib/messages/IProtocolProperty.d.ts +12 -0
  78. package/lib/messages/IProtocolProperty.js +3 -0
  79. package/lib/messages/IProtocolProperty.js.map +1 -0
  80. package/lib/metadata/IMetadataTag.d.ts +3 -3
  81. package/lib/metadata/Metadata.js +1 -1
  82. package/lib/metadata/Metadata.js.map +1 -1
  83. package/lib/module.d.ts +2 -0
  84. package/lib/module.js +6 -1
  85. package/lib/module.js.map +1 -1
  86. package/lib/programmers/MessageProgrammer.d.ts +5 -0
  87. package/lib/programmers/MessageProgrammer.js +141 -0
  88. package/lib/programmers/MessageProgrammer.js.map +1 -0
  89. package/lib/transformers/CallExpressionTransformer.js +5 -3
  90. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  91. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js +1 -3
  92. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js.map +1 -1
  93. package/lib/transformers/features/protocols/MessageTransformer.d.ts +5 -0
  94. package/lib/transformers/features/protocols/MessageTransformer.js +20 -0
  95. package/lib/transformers/features/protocols/MessageTransformer.js.map +1 -0
  96. package/lib/utils/NameEncoder.d.ts +4 -0
  97. package/lib/utils/NameEncoder.js +89 -0
  98. package/lib/utils/NameEncoder.js.map +1 -0
  99. package/package.json +1 -1
  100. package/src/Primitive.ts +123 -123
  101. package/src/executable/TypiaGenerateWizard.ts +85 -85
  102. package/src/executable/TypiaSetupWizard.ts +133 -133
  103. package/src/executable/setup/CommandExecutor.ts +8 -8
  104. package/src/executable/setup/PackageManager.ts +71 -71
  105. package/src/executable/setup/PluginConfigurator.ts +70 -70
  106. package/src/executable/typia.ts +52 -52
  107. package/src/factories/CommentFactory.ts +14 -14
  108. package/src/factories/ExpressionFactory.ts +70 -70
  109. package/src/factories/IdentifierFactory.ts +63 -63
  110. package/src/factories/LiteralFactory.ts +39 -39
  111. package/src/factories/MetadataCollection.ts +121 -121
  112. package/src/factories/MetadataFactory.ts +62 -62
  113. package/src/factories/MetadataTagFactory.ts +297 -297
  114. package/src/factories/ProtocolFactory.ts +79 -0
  115. package/src/factories/StatementFactory.ts +24 -24
  116. package/src/factories/TemplateFactory.ts +58 -58
  117. package/src/factories/TypeFactory.ts +124 -124
  118. package/src/factories/internal/metadata/MetadataHelper.ts +12 -12
  119. package/src/factories/internal/metadata/emplace_metadata_object.ts +143 -143
  120. package/src/factories/internal/metadata/iterate_metadata.ts +67 -67
  121. package/src/factories/internal/metadata/iterate_metadata_map.ts +41 -41
  122. package/src/factories/internal/metadata/iterate_metadata_native.ts +219 -219
  123. package/src/factories/internal/metadata/iterate_metadata_resolve.ts +27 -27
  124. package/src/factories/internal/metadata/iterate_metadata_set.ts +33 -33
  125. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +48 -48
  126. package/src/factories/internal/metadata/iterate_metadata_union.ts +57 -57
  127. package/src/factories/internal/protocols/ProtocolMetadataUtil.ts +167 -0
  128. package/src/factories/internal/protocols/emplace_protocol_object.ts +25 -0
  129. package/src/factories/internal/protocols/emplace_protocol_property.ts +12 -0
  130. package/src/factories/internal/protocols/iterate_protocol_atomic.ts +34 -0
  131. package/src/factories/internal/protocols/iterate_protocol_constant.ts +27 -0
  132. package/src/factories/internal/protocols/iterate_protocol_main.ts +19 -0
  133. package/src/factories/internal/protocols/iterate_protocol_map.ts +58 -0
  134. package/src/factories/internal/protocols/iterate_protocol_metadata.ts +96 -0
  135. package/src/factories/internal/protocols/iterate_protocol_native.ts +34 -0
  136. package/src/factories/internal/protocols/iterate_protocol_never.ts +1 -0
  137. package/src/factories/internal/protocols/iterate_protocol_object.ts +110 -0
  138. package/src/factories/internal/protocols/iterate_protocol_repeated.ts +34 -0
  139. package/src/factories/internal/protocols/iterate_protocol_tuple.ts +29 -0
  140. package/src/functional/$any.ts +2 -2
  141. package/src/functional/$dictionary.ts +25 -25
  142. package/src/functional/$is_between.ts +2 -2
  143. package/src/functional/$is_custom.ts +14 -14
  144. package/src/functional/$is_date.ts +3 -3
  145. package/src/functional/$is_datetime.ts +2 -2
  146. package/src/functional/$is_email.ts +4 -4
  147. package/src/functional/$is_ipv4.ts +4 -4
  148. package/src/functional/$is_ipv6.ts +4 -4
  149. package/src/functional/$is_url.ts +4 -4
  150. package/src/functional/$is_uuid.ts +4 -4
  151. package/src/functional/$join.ts +46 -46
  152. package/src/functional/$number.ts +12 -12
  153. package/src/functional/$proto_bytes.ts +25 -0
  154. package/src/functional/$proto_field.ts +30 -0
  155. package/src/functional/$proto_float.ts +37 -0
  156. package/src/functional/$proto_i32.ts +29 -0
  157. package/src/functional/$proto_i64.ts +37 -0
  158. package/src/functional/$proto_size.ts +82 -0
  159. package/src/functional/$proto_string.ts +24 -0
  160. package/src/functional/$rest.ts +3 -3
  161. package/src/functional/$string.ts +37 -37
  162. package/src/functional/$tail.ts +5 -5
  163. package/src/functional/$varint.ts +130 -0
  164. package/src/functional/$zigzag.ts +39 -0
  165. package/src/messages/IProtocolMap.ts +5 -0
  166. package/src/messages/IProtocolMessage.ts +6 -0
  167. package/src/messages/IProtocolProperty.ts +13 -0
  168. package/src/metadata/IMetadata.ts +26 -26
  169. package/src/metadata/IMetadataTag.ts +11 -3
  170. package/src/metadata/Metadata.ts +543 -539
  171. package/src/metadata/MetadataConstant.ts +3 -3
  172. package/src/metadata/MetadataObject.ts +127 -127
  173. package/src/module.ts +2054 -2043
  174. package/src/programmers/ApplicationProgrammer.ts +62 -62
  175. package/src/programmers/AssertCloneProgrammer.ts +79 -79
  176. package/src/programmers/AssertParseProgrammer.ts +74 -74
  177. package/src/programmers/AssertProgrammer.ts +285 -285
  178. package/src/programmers/AssertPruneProgrammer.ts +76 -76
  179. package/src/programmers/AssertStringifyProgrammer.ts +74 -74
  180. package/src/programmers/CheckerProgrammer.ts +901 -901
  181. package/src/programmers/CloneProgrammer.ts +389 -389
  182. package/src/programmers/FeatureProgrammer.ts +500 -500
  183. package/src/programmers/IsCloneProgrammer.ts +86 -86
  184. package/src/programmers/IsParseProgrammer.ts +80 -80
  185. package/src/programmers/IsProgrammer.ts +212 -212
  186. package/src/programmers/IsPruneProgrammer.ts +81 -81
  187. package/src/programmers/IsStringifyProgrammer.ts +84 -84
  188. package/src/programmers/LiteralsProgrammer.ts +65 -65
  189. package/src/programmers/MessageProgrammer.ts +126 -0
  190. package/src/programmers/PruneProgrammer.ts +347 -347
  191. package/src/programmers/RandomProgrammer.ts +423 -423
  192. package/src/programmers/StringifyProgrammer.ts +798 -798
  193. package/src/programmers/TypiaProgrammer.ts +129 -129
  194. package/src/programmers/ValidateCloneProgrammer.ts +93 -93
  195. package/src/programmers/ValidateParseProgrammer.ts +78 -78
  196. package/src/programmers/ValidateProgrammer.ts +316 -316
  197. package/src/programmers/ValidatePruneProgrammer.ts +86 -86
  198. package/src/programmers/ValidateStringifyProgrammer.ts +92 -92
  199. package/src/programmers/helpers/CloneJoiner.ts +131 -131
  200. package/src/programmers/helpers/FunctionImporeter.ts +54 -54
  201. package/src/programmers/helpers/OptionPredicator.ts +15 -15
  202. package/src/programmers/helpers/PruneJoiner.ts +144 -144
  203. package/src/programmers/helpers/StringifyJoinder.ts +113 -113
  204. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  205. package/src/programmers/helpers/UnionExplorer.ts +275 -275
  206. package/src/programmers/helpers/UnionPredicator.ts +81 -81
  207. package/src/programmers/internal/application_array.ts +36 -36
  208. package/src/programmers/internal/application_boolean.ts +17 -17
  209. package/src/programmers/internal/application_constant.ts +30 -30
  210. package/src/programmers/internal/application_default_string.ts +33 -33
  211. package/src/programmers/internal/application_native.ts +32 -32
  212. package/src/programmers/internal/application_number.ts +73 -73
  213. package/src/programmers/internal/application_object.ts +155 -155
  214. package/src/programmers/internal/application_schema.ts +213 -213
  215. package/src/programmers/internal/application_string.ts +45 -45
  216. package/src/programmers/internal/application_templates.ts +26 -26
  217. package/src/programmers/internal/application_tuple.ts +31 -31
  218. package/src/programmers/internal/check_array.ts +30 -30
  219. package/src/programmers/internal/check_custom.ts +31 -31
  220. package/src/programmers/internal/check_dynamic_properties.ts +194 -194
  221. package/src/programmers/internal/check_everything.ts +28 -28
  222. package/src/programmers/internal/check_native.ts +21 -21
  223. package/src/programmers/internal/check_string_tags.ts +67 -67
  224. package/src/programmers/internal/check_union_array_like.ts +271 -271
  225. package/src/programmers/internal/check_union_tuple.ts +33 -33
  226. package/src/programmers/internal/random_custom.ts +29 -29
  227. package/src/programmers/internal/stringify_dynamic_properties.ts +167 -167
  228. package/src/programmers/internal/stringify_native.ts +7 -7
  229. package/src/programmers/internal/stringify_regular_properties.ts +83 -83
  230. package/src/schemas/IJsonSchema.ts +130 -130
  231. package/src/transform.ts +17 -17
  232. package/src/transformers/CallExpressionTransformer.ts +184 -177
  233. package/src/transformers/FileTransformer.ts +47 -47
  234. package/src/transformers/NodeTransformer.ts +13 -13
  235. package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +112 -114
  236. package/src/transformers/features/miscellaneous/AssertCloneTransformer.ts +9 -9
  237. package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +9 -9
  238. package/src/transformers/features/miscellaneous/CloneTransformer.ts +9 -9
  239. package/src/transformers/features/miscellaneous/CreateAssertCloneTransformer.ts +9 -9
  240. package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +9 -9
  241. package/src/transformers/features/miscellaneous/CreateCloneTransformer.ts +9 -9
  242. package/src/transformers/features/miscellaneous/CreateIsCloneTransformer.ts +9 -9
  243. package/src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts +9 -9
  244. package/src/transformers/features/miscellaneous/CreatePruneTransformer.ts +9 -9
  245. package/src/transformers/features/miscellaneous/CreateRandomTransformer.ts +39 -39
  246. package/src/transformers/features/miscellaneous/CreateValidateCloneTransformer.ts +9 -9
  247. package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +9 -9
  248. package/src/transformers/features/miscellaneous/IsCloneTransformer.ts +9 -9
  249. package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +9 -9
  250. package/src/transformers/features/miscellaneous/LiteralsTransformer.ts +28 -28
  251. package/src/transformers/features/miscellaneous/MetadataTransformer.ts +52 -52
  252. package/src/transformers/features/miscellaneous/PruneTransformer.ts +9 -9
  253. package/src/transformers/features/miscellaneous/RandomTransformer.ts +42 -42
  254. package/src/transformers/features/miscellaneous/ValidateCloneTransformer.ts +9 -9
  255. package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +9 -9
  256. package/src/transformers/features/parsers/AssertParseTransformer.ts +9 -9
  257. package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +9 -9
  258. package/src/transformers/features/parsers/CreateIsParseTransformer.ts +9 -9
  259. package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +9 -9
  260. package/src/transformers/features/parsers/IsParseTransformer.ts +9 -9
  261. package/src/transformers/features/parsers/ValidateParseTransformer.ts +9 -9
  262. package/src/transformers/features/protocols/MessageTransformer.ts +31 -0
  263. package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +10 -10
  264. package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +12 -12
  265. package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +9 -9
  266. package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +9 -9
  267. package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +12 -12
  268. package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +9 -9
  269. package/src/transformers/features/stringifiers/StringifyTransformer.ts +9 -9
  270. package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +10 -10
  271. package/src/transformers/features/validators/AssertTransformer.ts +11 -11
  272. package/src/transformers/features/validators/CreateAssertTransformer.ts +13 -13
  273. package/src/transformers/features/validators/CreateIsTransformer.ts +11 -11
  274. package/src/transformers/features/validators/CreateValidateTransformer.ts +13 -13
  275. package/src/transformers/features/validators/IsTransformer.ts +11 -11
  276. package/src/transformers/features/validators/ValidateTransformer.ts +11 -11
  277. package/src/transformers/internal/GenericTransformer.ts +97 -97
  278. package/src/utils/ArrayUtil.ts +44 -44
  279. package/src/utils/Escaper.ts +45 -45
  280. package/src/utils/MapUtil.ts +12 -12
  281. package/src/utils/NameEncoder.ts +32 -0
  282. package/src/utils/PatternUtil.ts +30 -30
  283. package/src/utils/RandomGenerator.ts +81 -81
package/src/module.ts CHANGED
@@ -1,2043 +1,2054 @@
1
- import { $dictionary } from "./functional/$dictionary";
2
- import { Namespace } from "./functional/Namespace";
3
-
4
- import { IMetadataApplication } from "./metadata/IMetadataApplication";
5
- import { IJsonApplication } from "./schemas/IJsonApplication";
6
-
7
- import { Atomic } from "./typings/Atomic";
8
-
9
- import { MapUtil } from "./utils/MapUtil";
10
-
11
- import { CustomValidatorMap } from "./CustomValidatorMap";
12
- import { IRandomGenerator } from "./IRandomGenerator";
13
- import { IValidation } from "./IValidation";
14
- import { Primitive } from "./Primitive";
15
- import { TypeGuardError } from "./TypeGuardError";
16
-
17
- export * from "./schemas/IJsonApplication";
18
- export * from "./schemas/IJsonComponents";
19
- export * from "./schemas/IJsonSchema";
20
- export * from "./IRandomGenerator";
21
- export * from "./IValidation";
22
- export * from "./Primitive";
23
- export * from "./TypeGuardError";
24
-
25
- /* ===========================================================
26
- SINGLE FUNCTIONS
27
- - BASIC VALIDATORS
28
- - STRICT VALIDATORS
29
- - JSON FUNCTIONS
30
- - MISCELLANEOUS
31
- ==============================================================
32
- BASIC VALIDATORS
33
- ----------------------------------------------------------- */
34
- /**
35
- * Asserts a value type.
36
- *
37
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
38
- * reason, if the parametric value is not following the type `T`. Otherwise, the
39
- * value is following the type `T`, just input parameter would be returned.
40
- *
41
- * If what you want is not asserting but just knowing whether the parametric value is
42
- * following the type `T` or not, you can choose the {@link is} function instead.
43
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
44
- *
45
- * On the other and, if you don't want to allow any superfluous property that is not
46
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
47
- *
48
- * @template T Type of the input value
49
- * @param input A value to be asserted
50
- * @returns Parametric input value
51
- * @throws A {@link TypeGuardError} instance with detailed reason
52
- *
53
- * @author Jeongho Nam - https://github.com/samchon
54
- */
55
- export function assert<T>(input: T): T;
56
-
57
- /**
58
- * Asserts a value type.
59
- *
60
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
61
- * reason, if the parametric value is not following the type `T`. Otherwise, the
62
- * value is following the type `T`, just input parameter would be returned.
63
- *
64
- * If what you want is not asserting but just knowing whether the parametric value is
65
- * following the type `T` or not, you can choose the {@link is} function instead.
66
- * Otherwise, you want to know all the errors, {@link validate} is the way to go.
67
- *
68
- * On the other and, if you don't want to allow any superfluous property that is not
69
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
70
- *
71
- * @template T Type of the input value
72
- * @param input A value to be asserted
73
- * @returns Parametric input value casted as `T`
74
- * @throws A {@link TypeGuardError} instance with detailed reason
75
- *
76
- * @author Jeongho Nam - https://github.com/samchon
77
- */
78
- export function assert<T>(input: unknown): T;
79
-
80
- /**
81
- * @internal
82
- */
83
- export function assert(): never {
84
- halt("assert");
85
- }
86
- Object.assign(assert, Namespace.assert("assert"));
87
-
88
- /**
89
- * Asserts a value type.
90
- *
91
- * Duplicated function of {@link assert} for `typescript-is` users.
92
- *
93
- * @template T Type of the input value
94
- * @param input A value to be asserted
95
- * @returns Parametric input value
96
- * @throws A {@link TypeGuardError} instance with detailed reason
97
- *
98
- * @author Jeongho Nam - https://github.com/samchon
99
- * @deprecated
100
- */
101
- export function assertType<T>(input: T): T;
102
-
103
- /**
104
- * Asserts a value type.
105
- *
106
- * Duplicated function of {@link assert} for `typescript-is` users.
107
- *
108
- * @template T Type of the input value
109
- * @param input A value to be asserted
110
- * @returns Parametric input value
111
- * @throws A {@link TypeGuardError} instance with detailed reason
112
- *
113
- * @author Jeongho Nam - https://github.com/samchon
114
- * @deprecated
115
- */
116
- export function assertType<T>(input: unknown): T;
117
-
118
- /**
119
- * @internal
120
- */
121
- export function assertType(): never {
122
- halt("assertType");
123
- }
124
- Object.assign(assertType, Namespace.assert("assertType"));
125
-
126
- /**
127
- * Tests a value type.
128
- *
129
- * Tests a parametric value type and returns whether it's following the type `T` or not.
130
- * If the parametric value is matched with the type `T`, `true` value would be returned.
131
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
132
- * returned.
133
- *
134
- * If what you want is not just knowing whether the parametric value is following the
135
- * type `T` or not, but throwing an exception with detailed reason, you can choose
136
- * {@link assert} function instead. Also, if you want to know all the errors with
137
- * detailed reasons, {@link validate} function would be useful.
138
- *
139
- * On the other and, if you don't want to allow any superfluous property that is not
140
- * enrolled to the type `T`, you can use {@link equals} function instead.
141
- *
142
- * @template T Type of the input value
143
- * @param input A value to be tested
144
- * @returns Whether the parametric value is following the type `T` or not
145
- *
146
- * @author Jeongho Nam - https://github.com/samchon
147
- */
148
- export function is<T>(input: T): input is T;
149
-
150
- /**
151
- * Tests a value type.
152
- *
153
- * Tests a parametric value type and returns whether it's following the type `T` or not.
154
- * If the parametric value is matched with the type `T`, `true` value would be returned.
155
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
156
- * returned.
157
- *
158
- * If what you want is not just knowing whether the parametric value is following the
159
- * type `T` or not, but throwing an exception with detailed reason, you can choose
160
- * {@link assert} function instead. Also, if you want to know all the errors with
161
- * detailed reasons, {@link validate} function would be useful.
162
- *
163
- * On the other and, if you don't want to allow any superfluous property that is not
164
- * enrolled to the type `T`, you can use {@link equals} function instead.
165
- *
166
- * @template T Type of the input value
167
- * @param input A value to be tested
168
- * @returns Whether the parametric value is following the type `T` or not
169
- *
170
- * @author Jeongho Nam - https://github.com/samchon
171
- */
172
- export function is<T>(input: unknown): input is T;
173
-
174
- /**
175
- * @internal
176
- */
177
- export function is(): never {
178
- halt("is");
179
- }
180
- Object.assign(is, Namespace.assert("is"));
181
-
182
- /**
183
- * Validates a value type.
184
- *
185
- * Validates a parametric value type and archives all the type errors into an
186
- * {@link IValidation.errors} array, if the parametric value is not following the
187
- * type `T`. Of course, if the parametric value is following the type `T`, the
188
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
189
- * would have the `true` value.
190
- *
191
- * If what you want is not finding all the error, but asserting the parametric value
192
- * type with exception throwing, you can choose {@link assert} function instead.
193
- * Otherwise, you just want to know whether the parametric value is matched with the
194
- * type `T`, {@link is} function is the way to go.
195
- *
196
- * On the other and, if you don't want to allow any superfluous property that is not
197
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
198
- *
199
- * @template Type of the input value
200
- * @param input A value to be validated
201
- * @returns Validation result
202
- *
203
- * @author Jeongho Nam - https://github.com/samchon
204
- */
205
- export function validate<T>(input: T): IValidation<T>;
206
-
207
- /**
208
- * Validates a value type.
209
- *
210
- * Validates a parametric value type and archives all the type errors into an
211
- * {@link IValidation.errors} array, if the parametric value is not following the
212
- * type `T`. Of course, if the parametric value is following the type `T`, the
213
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
214
- * would have the `true` value.
215
- *
216
- * If what you want is not finding all the error, but asserting the parametric value
217
- * type with exception throwing, you can choose {@link assert} function instead.
218
- * Otherwise, you just want to know whether the parametric value is matched with the
219
- * type `T`, {@link is} function is the way to go.
220
- *
221
- * On the other and, if you don't want to allow any superfluous property that is not
222
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
223
- *
224
- * @template Type of the input value
225
- * @param input A value to be validated
226
- * @returns Validation result
227
- *
228
- * @author Jeongho Nam - https://github.com/samchon
229
- */
230
- export function validate<T>(input: unknown): IValidation<T>;
231
-
232
- /**
233
- * @internal
234
- */
235
- export function validate(): never {
236
- halt("validate");
237
- }
238
- Object.assign(validate, Namespace.validate());
239
-
240
- /* -----------------------------------------------------------
241
- STRICT VALIDATORS
242
- ----------------------------------------------------------- */
243
- /**
244
- * Asserts equality between a value and its type.
245
- *
246
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
247
- * reason, if the parametric value is not following the type `T` or some superfluous
248
- * property that is not listed on the type `T` has been found. Otherwise, the value is
249
- * following the type `T` without any superfluous property, just input parameter would
250
- * be returned.
251
- *
252
- * If what you want is not asserting but just knowing whether the parametric value is
253
- * following the type `T` or not, you can choose the {@link equals} function instead.
254
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
255
- *
256
- * On the other hand, if you want to allow superfluous property that is not enrolled
257
- * to the type `T`, you can use {@link assert} function instead.
258
- *
259
- * @template T Type of the input value
260
- * @param input A value to be asserted
261
- * @returns Parametric input value
262
- * @throws A {@link TypeGuardError} instance with detailed reason
263
- *
264
- * @author Jeongho Nam - https://github.com/samchon
265
- */
266
- export function assertEquals<T>(input: T): T;
267
-
268
- /**
269
- * Asserts equality between a value and its type.
270
- *
271
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
272
- * reason, if the parametric value is not following the type `T` or some superfluous
273
- * property that is not listed on the type `T` has been found. Otherwise, the value is
274
- * following the type `T` without any superfluous property, just input parameter would
275
- * be returned.
276
- *
277
- * If what you want is not asserting but just knowing whether the parametric value is
278
- * following the type `T` or not, you can choose the {@link equals} function instead.
279
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
280
- *
281
- * On the other hand, if you want to allow superfluous property that is not enrolled
282
- * to the type `T`, you can use {@link assert} function instead.
283
- *
284
- * @template T Type of the input value
285
- * @param input A value to be asserted
286
- * @returns Parametric input value casted as `T`
287
- * @throws A {@link TypeGuardError} instance with detailed reason
288
- *
289
- * @author Jeongho Nam - https://github.com/samchon
290
- */
291
- export function assertEquals<T>(input: unknown): T;
292
-
293
- /**
294
- * @internal
295
- */
296
- export function assertEquals(): never {
297
- halt("assertEquals");
298
- }
299
- Object.assign(assertEquals, Namespace.assert("assertEquals"));
300
-
301
- /**
302
- * Tests equality between a value and its type.
303
- *
304
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
305
- * or not. If the parametric value is matched with the type `T` and there's not any
306
- * superfluous property that is not listed on the type `T`, `true` value would be
307
- * returned. Otherwise, the parametric value is not following the type `T` or some
308
- * superfluous property exists, `false` value would be returned.
309
- *
310
- * If what you want is not just knowing whether the parametric value is following the
311
- * type `T` or not, but throwing an exception with detailed reason, you can choose
312
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
313
- * detailed reasons, {@link validateEquals} function would be useful.
314
- *
315
- * On the other hand, if you want to allow superfluous property that is not enrolled
316
- * to the type `T`, you can use {@link is} function instead.
317
- *
318
- * @template T Type of the input value
319
- * @param input A value to be tested
320
- * @returns Whether the parametric value is equivalent to the type `T` or not
321
- *
322
- * @author Jeongho Nam - https://github.com/samchon
323
- */
324
- export function equals<T>(input: T): input is T;
325
-
326
- /**
327
- * Tests equality between a value and its type.
328
- *
329
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
330
- * or not. If the parametric value is matched with the type `T` and there's not any
331
- * superfluous property that is not listed on the type `T`, `true` value would be
332
- * returned. Otherwise, the parametric value is not following the type `T` or some
333
- * superfluous property exists, `false` value would be returned.
334
- *
335
- * If what you want is not just knowing whether the parametric value is following the
336
- * type `T` or not, but throwing an exception with detailed reason, you can choose
337
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
338
- * detailed reasons, {@link validateEquals} function would be useful.
339
- *
340
- * On the other hand, if you want to allow superfluous property that is not enrolled
341
- * to the type `T`, you can use {@link is} function instead.
342
- *
343
- * @template T Type of the input value
344
- * @param input A value to be tested
345
- * @returns Whether the parametric value is equivalent to the type `T` or not
346
- *
347
- * @author Jeongho Nam - https://github.com/samchon
348
- */
349
- export function equals<T>(input: unknown): input is T;
350
-
351
- /**
352
- * @internal
353
- */
354
- export function equals(): never {
355
- halt("equals");
356
- }
357
- Object.assign(equals, Namespace.is());
358
-
359
- /**
360
- * Validates equality between a value and its type.
361
- *
362
- * Validates a parametric value type and archives all the type errors into an
363
- * {@link IValidation.errors} array, if the parametric value is not following the
364
- * type `T` or some superfluous property that is not listed on the type `T` has been
365
- * found. Of course, if the parametric value is following the type `T` and no
366
- * superfluous property exists, the {@link IValidation.errors} array would be empty
367
- * and {@link IValidation.success} would have the `true` value.
368
- *
369
- * If what you want is not finding all the error, but asserting the parametric value
370
- * type with exception throwing, you can choose {@link assert} function instead.
371
- * Otherwise, you just want to know whether the parametric value is matched with the
372
- * type `T`, {@link is} function is the way to go.
373
- *
374
- * On the other and, if you don't want to allow any superfluous property that is not
375
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
376
- *
377
- * @template Type of the input value
378
- * @param input A value to be validated
379
- * @returns Validation result
380
- *
381
- * @author Jeongho Nam - https://github.com/samchon
382
- */
383
- export function validateEquals<T>(input: T): IValidation<T>;
384
-
385
- /**
386
- * Validates equality between a value and its type.
387
- *
388
- * Validates a parametric value type and archives all the type errors into an
389
- * {@link IValidation.errors} array, if the parametric value is not following the
390
- * type `T` or some superfluous property that is not listed on the type `T` has been
391
- * found. Of course, if the parametric value is following the type `T` and no
392
- * superfluous property exists, the {@link IValidation.errors} array would be empty
393
- * and {@link IValidation.success} would have the `true` value.
394
- *
395
- * If what you want is not finding all the error, but asserting the parametric value
396
- * type with exception throwing, you can choose {@link assert} function instead.
397
- * Otherwise, you just want to know whether the parametric value is matched with the
398
- * type `T`, {@link is} function is the way to go.
399
- *
400
- * On the other and, if you don't want to allow any superfluous property that is not
401
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
402
- *
403
- * @template Type of the input value
404
- * @param input A value to be validated
405
- * @returns Validation result
406
- *
407
- * @author Jeongho Nam - https://github.com/samchon
408
- */
409
- export function validateEquals<T>(input: unknown): IValidation<T>;
410
-
411
- /**
412
- * @internal
413
- */
414
- export function validateEquals(): never {
415
- halt("validateEquals");
416
- }
417
- Object.assign(validateEquals, Namespace.validate());
418
-
419
- /**
420
- * Custom validators.
421
- *
422
- * If you want to add a custom validation logic utilizing comment tags,
423
- * add a closure function with its tag and type name. Below example code
424
- * would helpful to understand how to use this instance.
425
- *
426
- * ```ts
427
- * typia.customValidators.insert("powerOf")("number")(
428
- * (text: string) => {
429
- * const denominator: number = Math.log(Number(text));
430
- * return (value: number) => {
431
- * value = Math.log(value) / denominator;
432
- * return value === Math.floor(value);
433
- * };
434
- * }
435
- * );
436
- * typia.customValidators.insert("dollar")("string")(
437
- * () => (value: string) => value.startsWith("$"),
438
- * );
439
- *
440
- * interface TagCustom {
441
- * /**
442
- * * @powerOf 10
443
- * *\/
444
- * powerOf: number;
445
- *
446
- * /**
447
- * * @dollar
448
- * *\/
449
- * dollar: string;
450
- * }
451
- * ```
452
- *
453
- * @author Jeongho Nam - https://github.com/samchon
454
- */
455
- export const customValidators: CustomValidatorMap = {
456
- size: (name?: string) =>
457
- name ? $dictionary.get(name)?.size ?? 0 : $dictionary.size,
458
- has: (name) => (type) => $dictionary.get(name)?.has(type) ?? false,
459
- get: (name) => (type) => $dictionary.get(name)?.get(type),
460
- insert: (name) => (type) => (closure) => {
461
- const internal = MapUtil.take($dictionary)(name, () => new Map());
462
- if (internal.has(type)) return false;
463
- internal.set(type, closure);
464
- return true;
465
- },
466
- erase: (name) => (type) => $dictionary.get(name)?.delete(type) ?? false,
467
- };
468
-
469
- /* -----------------------------------------------------------
470
- JSON FUNCTIONS
471
- ----------------------------------------------------------- */
472
- /**
473
- * > You must configure the generic argument `T`.
474
- *
475
- * JSON Schema Application.
476
- *
477
- * Creates a JSON schema application which contains both main JSON schemas and components.
478
- * Note that, all of the object types are stored in the {@link IJsonApplication.components}
479
- * property for the `$ref` referencing.
480
- *
481
- * Also, `typia.application()` has additional generic arguments, *Purpose*.
482
- * As JSON schema definitions used by `swagger` and `ajv` are different a little bit,
483
- * you should configure the *Purpose* appropriately.
484
- *
485
- * For an example, `ajv` has an extra property "$recursiveRef" that are not exists
486
- * in the standard JSON schema definition spec. Otherwise, `swagger` can't identify
487
- * the tuple definition.
488
- *
489
- * @template Types Tuple of target types
490
- * @template Purpose Purpose of the JSON schema`
491
- * @template Prefix Prefix of the JSON components referenced by `$ref` tag
492
- * @return JSON schema application
493
- *
494
- * @author Jeongho Nam - https://github.com/samchon
495
- */
496
- export function application(): never;
497
-
498
- /**
499
- * JSON Schema Application.
500
- *
501
- * Creates a JSON schema application which contains both main JSON schemas and components.
502
- * Note that, all of the object types are stored in the {@link IJsonApplication.components}
503
- * property for the `$ref` referencing.
504
- *
505
- * Also, `typia.application()` has additional generic arguments, *Purpose*.
506
- * As JSON schema definitions used by `swagger` and `ajv` are different a little bit,
507
- * you should configure the *Purpose* appropriately.
508
- *
509
- * For an example, `ajv` has an extra property "$recursiveRef" that are not exists
510
- * in the standard JSON schema definition spec. Otherwise, `swagger` can't identify
511
- * the tuple definition.
512
- *
513
- * @template Types Tuple of target types
514
- * @template Purpose Purpose of the JSON schema
515
- * @template Prefix Prefix of the JSON components referenced by `$ref` tag
516
- * @return JSON schema application
517
- *
518
- * @author Jeongho Nam - https://github.com/samchon
519
- */
520
- export function application<
521
- Types extends unknown[],
522
- Purpose extends "swagger" | "ajv" = "swagger",
523
- Prefix extends string = Purpose extends "swagger"
524
- ? "#/components/schemas"
525
- : "components#/schemas",
526
- >(): IJsonApplication;
527
-
528
- /**
529
- * @internal
530
- */
531
- export function application(): never {
532
- halt("application");
533
- }
534
-
535
- /**
536
- * > You must configure the generic argument `T`.
537
- *
538
- * Safe `JSON.parse()` function with type assertion.
539
- *
540
- * `typia.assertParse()` is a combination function of `JSON.parse()` and {@link assert}.
541
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
542
- * instance with type assertion.
543
- *
544
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
545
- * throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed value,
546
- * the parsed value would be returned.
547
- *
548
- * @template T Expected type of parsed value
549
- * @param input JSON string
550
- * @returns Parsed value
551
- *
552
- * @author Jeongho Nam - https://github.com/samchon
553
- */
554
- export function assertParse(input: string): never;
555
-
556
- /**
557
- * Safe `JSON.parse()` function with type assertion.
558
- *
559
- * `typia.assertParse()` is a combination function of `JSON.parse()` and {@link assert}.
560
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
561
- * instance with type assertion.
562
- *
563
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
564
- * throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed value,
565
- * the parsed value would be returned.
566
- *
567
- * @template T Expected type of parsed value
568
- * @param input JSON string
569
- * @returns Parsed value
570
- *
571
- * @author Jeongho Nam - https://github.com/samchon
572
- */
573
- export function assertParse<T>(input: string): Primitive<T>;
574
-
575
- /**
576
- * @internal
577
- */
578
- export function assertParse<T>(): Primitive<T> {
579
- halt("assertParse");
580
- }
581
- Object.assign(assertParse, Namespace.assert("assertParse"));
582
-
583
- /**
584
- * > You must configure the generic argument `T`.
585
- *
586
- * Safe `JSON.parse()` function with type checking.
587
- *
588
- * `typia.isParse()` is a combination function of `JSON.parse()` and {@link is}.
589
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
590
- * instance with type checking.
591
- *
592
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
593
- * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
594
- * value would be returned.
595
- *
596
- * @template T Expected type of parsed value
597
- * @param input JSON string
598
- * @returns Parsed value when exact type, otherwise `null`
599
- *
600
- * @author Jeongho Nam - https://github.com/samchon
601
- */
602
- export function isParse(input: string): never;
603
-
604
- /**
605
- * Safe `JSON.parse()` function with type checking.
606
- *
607
- * `typia.isParse()` is a combination function of `JSON.parse()` and {@link is}.
608
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
609
- * instance with type checking.
610
- *
611
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
612
- * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
613
- * value would be returned.
614
- *
615
- * @template T Expected type of parsed value
616
- * @param input JSON string
617
- * @returns Parsed value when exact type, otherwise `null`
618
- *
619
- * @author Jeongho Nam - https://github.com/samchon
620
- */
621
- export function isParse<T>(input: string): Primitive<T> | null;
622
-
623
- /**
624
- * @internal
625
- */
626
- export function isParse<T>(): Primitive<T> | null {
627
- halt("isParse");
628
- }
629
- Object.assign(isParse, is);
630
-
631
- /**
632
- * > You must configure the generic argument `T`.
633
- *
634
- * Safe `JSON.parse()` function with detailed type validation.
635
- *
636
- * `typia.validateParse()` is a combination function of `JSON.parse()` and
637
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
638
- * to a `T` typed instance with detailed type validation.
639
- *
640
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
641
- * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
642
- * there's no problem on the parsed value, the parsed value would be stored in `data`
643
- * property of the output {@link IValidation.ISuccess} instance.
644
- *
645
- * @template T Expected type of parsed value
646
- * @param input JSON string
647
- * @returns Validation result with JSON parsed value
648
- *
649
- * @author Jeongho Nam - https://github.com/samchon
650
- */
651
- export function validateParse(input: string): never;
652
-
653
- /**
654
- * Safe `JSON.parse()` function with detailed type validation.
655
- *
656
- * `typia.validateParse()` is a combination function of `JSON.parse()` and
657
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
658
- * to a `T` typed instance with detailed type validation.
659
- *
660
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
661
- * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
662
- * there's no problem on the parsed value, the parsed value would be stored in `data`
663
- * property of the output {@link IValidation.ISuccess} instance.
664
- *
665
- * @template T Expected type of parsed value
666
- * @param input JSON string
667
- * @returns Validation result with JSON parsed value
668
- *
669
- * @author Jeongho Nam - https://github.com/samchon
670
- */
671
- export function validateParse<T>(input: string): IValidation<Primitive<T>>;
672
-
673
- /**
674
- * @internal
675
- */
676
- export function validateParse<T>(): IValidation<Primitive<T>> {
677
- halt("validateParse");
678
- }
679
- Object.assign(validateParse, validate);
680
-
681
- /**
682
- * 8x faster `JSON.stringify()` function.
683
- *
684
- * Converts an input value to a JSON (JavaScript Object Notation) string, about 8x faster
685
- * than the native `JSON.stringify()` function. The 5x faster principle is because
686
- * it writes an optimized JSON conversion plan, only for the type `T`.
687
- *
688
- * For reference, this `typia.stringify()` does not validate the input value type.
689
- * It just believes that the input value is following the type `T`. Therefore, if you
690
- * can't ensure the input value type, it would be better to call one of below functions
691
- * instead.
692
- *
693
- * - {@link assertStringify}
694
- * - {@link isStringify}
695
- * - {@link validateStringify}
696
- *
697
- * @template T Type of the input value
698
- * @param input A value to be converted
699
- * @return JSON string value
700
- *
701
- * @author Jeongho Nam - https://github.com/samchon
702
- */
703
- export function stringify<T>(input: T): string;
704
-
705
- /**
706
- * @internal
707
- */
708
- export function stringify(): never {
709
- halt("stringify");
710
- }
711
- Object.assign(stringify, Namespace.stringify("stringify"));
712
-
713
- /**
714
- * 5x faster `JSON.stringify()` function with type assertion.
715
- *
716
- * `typia.assertStringify()` is a combination function of {@link assert} and
717
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
718
- * Notation) string, with type assertion.
719
- *
720
- * In such reason, when `input` value is not matched with the type `T`, it throws an
721
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
722
- * string would be returned.
723
- *
724
- * For reference, with type assertion, it is even 5x times faster than the native
725
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
726
- * with confidence.
727
- *
728
- * @template T Type of the input value
729
- * @param input A value to be asserted and converted
730
- * @return JSON string value
731
- *
732
- * @author Jeongho Nam - https://github.com/samchon
733
- */
734
- export function assertStringify<T>(input: T): string;
735
-
736
- /**
737
- * 5x faster `JSON.stringify()` function with type assertion.
738
- *
739
- * `typia.assertStringify()` is a combination function of {@link assert} and
740
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
741
- * Notation) string, with type assertion.
742
- *
743
- * In such reason, when `input` value is not matched with the type `T`, it throws an
744
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
745
- * string would be returned.
746
- *
747
- * For reference, with type assertion, it is even 5x times faster than the native
748
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
749
- * with confidence.
750
- *
751
- * @template T Type of the input value
752
- * @param input A value to be asserted and converted
753
- * @return JSON string value
754
- *
755
- * @author Jeongho Nam - https://github.com/samchon
756
- */
757
- export function assertStringify<T>(input: T): unknown;
758
-
759
- /**
760
- * @internal
761
- */
762
- export function assertStringify(): string {
763
- halt("assertStringify");
764
- }
765
- Object.assign(assertStringify, Namespace.assert("assertStringify"));
766
- Object.assign(assertStringify, Namespace.stringify("assertStringify"));
767
-
768
- /**
769
- * 7x faster `JSON.stringify()` function with type checking.
770
- *
771
- * `typia.stringify()` is a combination function of {@link is} and
772
- * {@link stringify}. Therefore, it converts an input value to JSON
773
- * (JavaScript Object Notation) string, with type checking.
774
- *
775
- * In such reason, when `input` value is not matched with the type `T`, it returns
776
- * `null` value. Otherwise, there's no problem on the `input` value, JSON string would
777
- * be returned.
778
- *
779
- * For reference, with type checking, it is even 7x times faster than the native
780
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
781
- * with confidence.
782
- *
783
- * @template T Type of the input value
784
- * @param input A value to be checked and converted
785
- * @return JSON string value when exact type, otherwise null
786
- *
787
- * @author Jeongho Nam - https://github.com/samchon
788
- */
789
- export function isStringify<T>(input: T): string | null;
790
-
791
- /**
792
- * 7x faster `JSON.stringify()` function with type checking.
793
- *
794
- * `typia.isStringify()` is a combination function of {@link is} and
795
- * {@link stringify}. Therefore, it converts an input value to JSON
796
- * (JavaScript Object Notation) string, with type checking.
797
- *f
798
- * In such reason, when `input` value is not matched with the type `T`, it returns
799
- * `null` value. Otherwise, there's no problem on the `input` value, JSON string would
800
- * be returned.
801
- *
802
- * For reference, with type checking, it is even 7x times faster than the native
803
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
804
- * with confidence.
805
- *
806
- * @template T Type of the input value
807
- * @param input A value to be checked and converted
808
- * @return JSON string value when exact type, otherwise null
809
- *
810
- * @author Jeongho Nam - https://github.com/samchon
811
- */
812
- export function isStringify<T>(input: unknown): string | null;
813
-
814
- /**
815
- * @internal
816
- */
817
- export function isStringify(): string | null {
818
- halt("isStringify");
819
- }
820
-
821
- Object.assign(isStringify, Namespace.is());
822
- Object.assign(isStringify, Namespace.stringify("isStringify"));
823
-
824
- /**
825
- * 5x faster `JSON.stringify()` function with detailed type validation.
826
- *
827
- * `typia.validateStringify()` is a combination function of {@link validate} and
828
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
829
- * Notation) string, with detailed type validation.
830
- *
831
- * In such reason, when `input` value is not matched with the type `T`, it returns
832
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's no
833
- * problem on the `input` value, JSON string would be stored in `data` property of
834
- * the output {@link IValidation.ISuccess} instance.
835
- *
836
- * For reference, with detailed type validation, it is even 5x times faster than the
837
- * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
838
- * with confidence.
839
- *
840
- * @template T Type of the input value
841
- * @param input A value to be checked and converted
842
- * @returns Validation result with JSON string value
843
- *
844
- * @author Jeongho Nam - https://github.com/samchon
845
- */
846
- export function validateStringify<T>(input: T): IValidation<string>;
847
-
848
- /**
849
- * 5x faster `JSON.stringify()` function with detailed type validation.
850
- *
851
- * `typia.validateStringify()` is a combination function of {@link validate} and
852
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
853
- * Notation) string, with detailed type validation.
854
- *
855
- * In such reason, when `input` value is not matched with the type `T`, it returns
856
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's no
857
- * problem on the `input` value, JSON string would be stored in `data` property of
858
- * the output {@link IValidation.ISuccess} instance.
859
- *
860
- * For reference, with detailed type validation, it is even 5x times faster than the
861
- * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
862
- * with confidence.
863
- *
864
- * @template T Type of the input value
865
- * @param input A value to be checked and converted
866
- * @returns Validation result with JSON string value
867
- *
868
- * @author Jeongho Nam - https://github.com/samchon
869
- */
870
- export function validateStringify<T>(input: unknown): IValidation<string>;
871
-
872
- /**
873
- * @internal
874
- */
875
- export function validateStringify(): IValidation<string> {
876
- halt("validateStringify");
877
- }
878
- Object.assign(validateStringify, Namespace.validate());
879
- Object.assign(validateStringify, Namespace.stringify("validateStringify"));
880
-
881
- /* -----------------------------------------------------------
882
- MISCELLANEOUS
883
- ----------------------------------------------------------- */
884
- /**
885
- * @internal
886
- */
887
- export function metadata(): never;
888
-
889
- /**
890
- * @internal
891
- */
892
- export function metadata<Types extends unknown[]>(): IMetadataApplication;
893
-
894
- /**
895
- * @internal
896
- */
897
- export function metadata(): never {
898
- halt("metadata");
899
- }
900
-
901
- /**
902
- * > You must configure the generic argument `T`.
903
- *
904
- * Generate random data.
905
- *
906
- * Generates a random data following type the `T`.
907
- *
908
- * For reference, this `typia.random()` function generates only primitive type.
909
- * If there're some methods in the type `T` or its nested instances, those would
910
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
911
- * would be generated instead.
912
- *
913
- * @template T Type of data to generate
914
- * @param generator Random data generator
915
- * @return Randomly generated data
916
- *
917
- * @author Jeongho Nam - https://github.com/samchon
918
- */
919
- export function random(generator?: Partial<IRandomGenerator>): never;
920
-
921
- /**
922
- * Generate random data.
923
- *
924
- * Generates a random data following type the `T`.
925
- *
926
- * For reference, this `typia.random()` function generates only primitive type.
927
- * If there're some methods in the type `T` or its nested instances, those would
928
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
929
- * would be generated instead.
930
- *
931
- * @template T Type of data to generate
932
- * @param generator Random data generator
933
- * @return Randomly generated data
934
- *
935
- * @author Jeongho Nam - https://github.com/samchon
936
- */
937
- export function random<T>(generator?: Partial<IRandomGenerator>): Primitive<T>;
938
-
939
- /**
940
- * @internal
941
- */
942
- export function random(): never {
943
- halt("random");
944
- }
945
- Object.assign(random, Namespace.random());
946
-
947
- /**
948
- * > You must configure the generic argument `T`.
949
- *
950
- * Union literal type to array.
951
- *
952
- * Converts a union literal type to an array of its members.
953
- *
954
- * ```typescript
955
- * literals<"A" | "B" | 1>; // [1, 2, 3] as const
956
- * ```
957
- *
958
- * @template T Union literal type
959
- * @return Array of union literal type's members
960
- *
961
- * @author Jeongho Nam - https://github.com/samchon
962
- */
963
- export function literals(): never;
964
-
965
- /**
966
- * Union literal type to array.
967
- *
968
- * Converts a union literal type to an array of its members.
969
- *
970
- * ```typescript
971
- * literals<"A" | "B" | 1>; // [1, 2, 3] as const
972
- * ```
973
- *
974
- * @template T Union literal type
975
- * @return Array of union literal type's members
976
- *
977
- * @author Jeongho Nam - https://github.com/samchon
978
- */
979
- export function literals<T extends Atomic.Type>(): T[];
980
-
981
- /**
982
- * @internal
983
- */
984
- export function literals(): never {
985
- halt("literals");
986
- }
987
-
988
- /**
989
- * Clone a data.
990
- *
991
- * Clones an instance following type `T`. If the target *input* value or its member
992
- * variable contains a class instance that is having a `toJSON()` method, its return
993
- * value would be cloned.
994
- *
995
- * For reference, this `typia.clone()` function does not validate the input value type.
996
- * It just believes that the input value is following the type `T`. Therefore, if you
997
- * can't ensure the input value type, it would be better to call {@link assertClone}
998
- * function instead.
999
- *
1000
- * @template T Type of the input value
1001
- * @param input A value to be cloned
1002
- * @return Cloned data
1003
- *
1004
- * @author Jeongho Nam - https://github.com/samchon
1005
- */
1006
- export function clone<T>(input: T): Primitive<T>;
1007
-
1008
- /**
1009
- * @internal
1010
- */
1011
- export function clone(): never {
1012
- halt("clone");
1013
- }
1014
- Object.assign(clone, Namespace.clone("clone"));
1015
-
1016
- /**
1017
- * Clone a data with type assertion.
1018
- *
1019
- * Clones an instance following type `T`, with type assertion. If the target `input`
1020
- * value or its member variable contains a class instance that is having a `toJSON()`
1021
- * method, its return value would be cloned.
1022
- *
1023
- * In such reason, when `input` value is not matched with the type `T`, it throws an
1024
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, cloned
1025
- * data would be returned.
1026
- *
1027
- * @template T Type of the input value
1028
- * @param input A value to be cloned
1029
- * @return Cloned data
1030
- *
1031
- * @author Jeongho Nam - https://github.com/samchon
1032
- */
1033
- export function assertClone<T>(input: T): Primitive<T>;
1034
-
1035
- /**
1036
- * Clone a data with type assertion.
1037
- *
1038
- * Clones an instance following type `T`, with type assertion. If the target `input`
1039
- * value or its member variable contains a class instance that is having a `toJSON()`
1040
- * method, its return value would be cloned.
1041
- *
1042
- * In such reason, when `input` value is not matched with the type `T`, it throws an
1043
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, cloned
1044
- * data would be returned.
1045
- *
1046
- * @template T Type of the input value
1047
- * @param input A value to be cloned
1048
- * @return Cloned data
1049
- *
1050
- * @author Jeongho Nam - https://github.com/samchon
1051
- */
1052
- export function assertClone<T>(input: unknown): Primitive<T>;
1053
-
1054
- /**
1055
- * @internal
1056
- */
1057
- export function assertClone(): never {
1058
- halt("assertClone");
1059
- }
1060
- Object.assign(assertClone, Namespace.assert("assertClone"));
1061
- Object.assign(assertClone, Namespace.clone("assertClone"));
1062
-
1063
- /**
1064
- * Clone a data with type checking.
1065
- *
1066
- * Clones an instance following type `T`, with type checking. If the target `input`
1067
- * value or its member variable contains a class instance that is having a `toJSON()`
1068
- * method, its return value would be cloned.
1069
- *
1070
- * In such reason, when `input` value is not matched with the type `T`, it returns
1071
- * `null` value instead. Otherwise, there's no problem on the `input` value, cloned
1072
- * data would be returned.
1073
- *
1074
- * @template T Type of the input value
1075
- * @param input A value to be cloned
1076
- * @return Cloned data when exact type, otherwise null
1077
- *
1078
- * @author Jeongho Nam - https://github.com/samchon
1079
- */
1080
- export function isClone<T>(input: T): Primitive<T> | null;
1081
-
1082
- /**
1083
- * Clone a data with type checking.
1084
- *
1085
- * Clones an instance following type `T`, with type checking. If the target `input`
1086
- * value or its member variable contains a class instance that is having a `toJSON()`
1087
- * method, its return value would be cloned.
1088
- *
1089
- * In such reason, when `input` value is not matched with the type `T`, it returns
1090
- * `null` value instead. Otherwise, there's no problem on the `input` value, cloned
1091
- * data would be returned.
1092
- *
1093
- * @template T Type of the input value
1094
- * @param input A value to be cloned
1095
- * @return Cloned data when exact type, otherwise null
1096
- *
1097
- * @author Jeongho Nam - https://github.com/samchon
1098
- */
1099
- export function isClone<T>(input: unknown): Primitive<T> | null;
1100
-
1101
- /**
1102
- * @internal
1103
- */
1104
- export function isClone(): never {
1105
- halt("isClone");
1106
- }
1107
- Object.assign(isClone, Namespace.is());
1108
- Object.assign(isClone, Namespace.clone("isClone"));
1109
-
1110
- /**
1111
- * Clone a data with detailed type validation.
1112
- *
1113
- * Clones an instance following type `T`, with detailed type validation. If the target
1114
- * `input` value or its member variable contains a class instance that is having a
1115
- * `toJSON()` method, its return value would be cloned.
1116
- *
1117
- * In such reason, when `input` value is not matched with the type `T`, it returns
1118
- * {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
1119
- * value, cloned data would be stored in `data` property of the output
1120
- * {@link IValidation.Success} instance.
1121
- *
1122
- * @template T Type of the input value
1123
- * @param input A value to be cloned
1124
- * @returns Validation result with cloned value
1125
- */
1126
- export function validateClone<T>(input: T): IValidation<Primitive<T>>;
1127
-
1128
- /**
1129
- * Clone a data with detailed type validation.
1130
- *
1131
- * Clones an instance following type `T`, with detailed type validation. If the target
1132
- * `input` value or its member variable contains a class instance that is having a
1133
- * `toJSON()` method, its return value would be cloned.
1134
- *
1135
- * In such reason, when `input` value is not matched with the type `T`, it returns
1136
- * {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
1137
- * value, cloned data would be stored in `data` property of the output
1138
- * {@link IValidation.Success} instance.
1139
- *
1140
- * @template T Type of the input value
1141
- * @param input A value to be cloned
1142
- * @returns Validation result with cloned value
1143
- */
1144
- export function validateClone<T>(input: unknown): IValidation<Primitive<T>>;
1145
-
1146
- /**
1147
- * @internal
1148
- */
1149
- export function validateClone(): never {
1150
- halt("validateClone");
1151
- }
1152
- Object.assign(validateClone, Namespace.validate());
1153
- Object.assign(validateClone, Namespace.clone("validateClone"));
1154
-
1155
- /**
1156
- * Prune, erase superfluous properties.
1157
- *
1158
- * Remove every superfluous properties from the `input` object, even including nested
1159
- * objects. Note that, as every superfluous properties would be deleted, you never can
1160
- * read those superfluous properties after calling this `prune()` function.
1161
- *
1162
- * For reference, this `typia.prune()` function does not validate the input value type.
1163
- * It just believes that the input value is following the type `T`. Therefore, if you
1164
- * can't ensure the input value type, it would better to call one of below functions
1165
- * instead.
1166
- *
1167
- * - {@link assertPrune}
1168
- * - {@link isPrune}
1169
- * - {@link validatePrune}
1170
- *
1171
- * @template T Type of the input value
1172
- * @param input Target instance to prune
1173
- *
1174
- * @author Jeongho Nam - https://github.com/samchon
1175
- */
1176
- export function prune<T extends object>(input: T): void;
1177
-
1178
- /**
1179
- * @internal
1180
- */
1181
- export function prune(): never {
1182
- halt("prune");
1183
- }
1184
- Object.assign(prune, Namespace.prune("prune"));
1185
-
1186
- /**
1187
- * Prune, erase superfluous properties, with type assertion.
1188
- *
1189
- * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1190
- * Therefore, it removes every superfluous properties from the `input` object including
1191
- * nested objects, with type assertion.
1192
- *
1193
- * In such reason, when `input` value is not matched with the type `T`, it throws an
1194
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1195
- * every superfluous properties would be removed, including nested objects.
1196
- *
1197
- * @template T Type of the input value
1198
- * @param input Target instance to assert and prune
1199
- *
1200
- * @author Jeongho Nam - https://github.com/samchon
1201
- */
1202
- export function assertPrune<T>(input: T): T;
1203
-
1204
- /**
1205
- * Prune, erase superfluous properties, with type assertion.
1206
- *
1207
- * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1208
- * Therefore, it removes every superfluous properties from the `input` object including
1209
- * nested objects, with type assertion.
1210
- *
1211
- * In such reason, when `input` value is not matched with the type `T`, it throws an
1212
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1213
- * every superfluous properties would be removed, including nested objects.
1214
- *
1215
- * @template T Type of the input value
1216
- * @param input Target instance to assert and prune
1217
- *
1218
- * @author Jeongho Nam - https://github.com/samchon
1219
- */
1220
- export function assertPrune<T>(input: unknown): T;
1221
-
1222
- /**
1223
- * @internal
1224
- */
1225
- export function assertPrune(): unknown {
1226
- halt("assertPrune");
1227
- }
1228
- Object.assign(assertPrune, Namespace.assert("assertPrune"));
1229
- Object.assign(assertPrune, Namespace.prune("assertPrune"));
1230
-
1231
- /**
1232
- * Prune, erase superfluous properties, with type checking.
1233
- *
1234
- * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1235
- * Therefore, it removes every superfluous properties from the `input` object including
1236
- * nested objects, with type checking.
1237
- *
1238
- * In such reason, when `input` value is not matched with the type `T`, it returns
1239
- * `false` value. Otherwise, there's no problem on the `input` value, it returns
1240
- * `true` after removing every superfluous properties, including nested objects.
1241
- *
1242
- * @template T Type of the input value
1243
- * @param input Target instance to check and prune
1244
- * @returns Whether the parametric value is following the type `T` or not
1245
- *
1246
- * @author Jeongho Nam - https://github.com/samchon
1247
- */
1248
- export function isPrune<T>(input: T): input is T;
1249
-
1250
- /**
1251
- * Prune, erase superfluous properties, with type checking.
1252
- *
1253
- * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1254
- * Therefore, it removes every superfluous properties from the `input` object including
1255
- * nested objects, with type checking.
1256
- *
1257
- * In such reason, when `input` value is not matched with the type `T`, it returns
1258
- * `false` value. Otherwise, there's no problem on the `input` value, it returns
1259
- * `true` after removing every superfluous properties, including nested objects.
1260
- *
1261
- * @template T Type of the input value
1262
- * @param input Target instance to check and prune
1263
- * @returns Whether the parametric value is following the type `T` or not
1264
- *
1265
- * @author Jeongho Nam - https://github.com/samchon
1266
- */
1267
- export function isPrune<T>(input: unknown): input is T;
1268
-
1269
- /**
1270
- * @internal
1271
- */
1272
- export function isPrune(): never {
1273
- halt("isPrune");
1274
- }
1275
- Object.assign(isPrune, Namespace.is());
1276
- Object.assign(isPrune, Namespace.prune("isPrune"));
1277
-
1278
- /**
1279
- * Prune, erase superfluous properties, with type validation.
1280
- *
1281
- * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1282
- * Therefore, it removes every superfluous properties from the `input` object including
1283
- * nested objects, with type validation.
1284
- *
1285
- * In such reason, when `input` value is not matched with the type `T`, it returns
1286
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1287
- * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1288
- * removing every superfluous properties, including nested objects.
1289
- *
1290
- * @template T Type of the input value
1291
- * @param input Target instance to validate and prune
1292
- * @returns Validation result
1293
- *
1294
- * @author Jeongho Nam - https://github.com/samchon
1295
- */
1296
- export function validatePrune<T>(input: T): IValidation<T>;
1297
-
1298
- /**
1299
- * Prune, erase superfluous properties, with type validation.
1300
- *
1301
- * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1302
- * Therefore, it removes every superfluous properties from the `input` object including
1303
- * nested objects, with type validation.
1304
- *
1305
- * In such reason, when `input` value is not matched with the type `T`, it returns
1306
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1307
- * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1308
- * removing every superfluous properties, including nested objects.
1309
- *
1310
- * @template T Type of the input value
1311
- * @param input Target instance to validate and prune
1312
- * @returns Validation result
1313
- *
1314
- * @author Jeongho Nam - https://github.com/samchon
1315
- */
1316
- export function validatePrune<T>(input: unknown): IValidation<T>;
1317
-
1318
- /**
1319
- * @internal
1320
- */
1321
- export function validatePrune<T>(): IValidation<T> {
1322
- halt("validatePrune");
1323
- }
1324
- Object.assign(validatePrune, Namespace.prune("validatePrune"));
1325
- Object.assign(validatePrune, Namespace.validate());
1326
-
1327
- /* ===========================================================
1328
- FACTORY FUNCTIONS
1329
- - BASIC VALIDATORS
1330
- - STRICT VALIDATORS
1331
- - JSON FUNCTIONS
1332
- - MISCELLANEOUS
1333
- ==============================================================
1334
- BASIC VALIDATORS
1335
- ----------------------------------------------------------- */
1336
- /**
1337
- * Creates a reusable {@link assert} function.
1338
- *
1339
- * @danger You have to specify the generic argument `T`
1340
- * @return Nothing until specifying the generic argument `T`
1341
- * @throws compile error
1342
- *
1343
- * @author Jeongho Nam - https://github.com/samchon
1344
- */
1345
- export function createAssert(): never;
1346
-
1347
- /**
1348
- * Creates a reusable {@link assert} function.
1349
- *
1350
- * @template T Type of the input value
1351
- * @returns A reusable `assert` function
1352
- *
1353
- * @author Jeongho Nam - https://github.com/samchon
1354
- */
1355
- export function createAssert<T>(): (input: unknown) => T;
1356
-
1357
- /**
1358
- * @internal
1359
- */
1360
- export function createAssert<T>(): (input: unknown) => T {
1361
- halt("createAssert");
1362
- }
1363
- Object.assign(createAssert, assert);
1364
-
1365
- /**
1366
- * Creates a reusable {@link assertType} function.
1367
- *
1368
- * Duplicated function of {@link createAssert} for `typescript-is` users.
1369
- *
1370
- * @danger You have to specify the generic argument `T`
1371
- * @return Nothing until specifying the generic argument `T`
1372
- * @throws compile error
1373
- *
1374
- * @author Jeongho Nam - https://github.com/samchon
1375
- * @deprecated
1376
- */
1377
- export function createAssertType(): never;
1378
-
1379
- /**
1380
- * Creates a reusable {@link assertType} function.
1381
- *
1382
- * Duplicated function of {@link createAssert} for `typescript-is` users.
1383
- *
1384
- * @template T Type of the input value
1385
- * @returns A reusable `assert` function
1386
- *
1387
- * @author Jeongho Nam - https://github.com/samchon
1388
- * @deprecated
1389
- */
1390
- export function createAssertType<T>(): (input: unknown) => T;
1391
-
1392
- /**
1393
- * @internal
1394
- */
1395
- export function createAssertType<T>(): (input: unknown) => T {
1396
- halt("createAssertType");
1397
- }
1398
- Object.assign(createAssertType, assertType);
1399
-
1400
- /**
1401
- * Creates a reusable {@link is} function.
1402
- *
1403
- * @danger You have to specify the generic argument `T`
1404
- * @return Nothing until specifying the generic argument `T`
1405
- * @throws compile error
1406
- *
1407
- * @author Jeongho Nam - https://github.com/samchon
1408
- */
1409
- export function createIs(): never;
1410
-
1411
- /**
1412
- * Creates a reusable {@link is} function.
1413
- *
1414
- * @template T Type of the input value
1415
- * @returns A reusable `is` function
1416
- *
1417
- * @author Jeongho Nam - https://github.com/samchon
1418
- */
1419
- export function createIs<T>(): (input: unknown) => input is T;
1420
-
1421
- /**
1422
- * @internal
1423
- */
1424
- export function createIs<T>(): (input: unknown) => input is T {
1425
- halt("createIs");
1426
- }
1427
- Object.assign(createIs, is);
1428
-
1429
- /**
1430
- * Creates a reusable {@link validate} function.
1431
- *
1432
- * @danger You have to specify the generic argument `T`
1433
- * @return Nothing until specifying the generic argument `T`
1434
- * @throws compile error
1435
- *
1436
- * @author Jeongho Nam - https://github.com/samchon
1437
- */
1438
- export function createValidate(): never;
1439
-
1440
- /**
1441
- * Creates a reusable {@link validate} function.
1442
- *
1443
- * @template T Type of the input value
1444
- * @returns A reusable `validate` function
1445
- *
1446
- * @author Jeongho Nam - https://github.com/samchon
1447
- */
1448
- export function createValidate<T>(): (input: unknown) => IValidation<T>;
1449
-
1450
- /**
1451
- * @internal
1452
- */
1453
- export function createValidate(): (input: unknown) => IValidation {
1454
- halt("createValidate");
1455
- }
1456
- Object.assign(createValidate, validate);
1457
-
1458
- /* -----------------------------------------------------------
1459
- STRICT VALIDATORS
1460
- ----------------------------------------------------------- */
1461
- /**
1462
- * Creates a reusable {@link assertEquals} function.
1463
- *
1464
- * @danger You have to specify the generic argument `T`
1465
- * @return Nothing until specifying the generic argument `T`
1466
- * @throws compile error
1467
- *
1468
- * @author Jeongho Nam - https://github.com/samchon
1469
- */
1470
- export function createAssertEquals(): never;
1471
-
1472
- /**
1473
- * Creates a reusable {@link assertEquals} function.
1474
- *
1475
- * @template T Type of the input value
1476
- * @returns A reusable `assertEquals` function
1477
- *
1478
- * @author Jeongho Nam - https://github.com/samchon
1479
- */
1480
- export function createAssertEquals<T>(): (input: unknown) => T;
1481
-
1482
- /**
1483
- * @internal
1484
- */
1485
- export function createAssertEquals<T>(): (input: unknown) => T {
1486
- halt("createAssertEquals");
1487
- }
1488
- Object.assign(createAssertEquals, assertEquals);
1489
-
1490
- /**
1491
- * Creates a reusable {@link equals} function.
1492
- *
1493
- * @danger You have to specify the generic argument `T`
1494
- * @return Nothing until specifying the generic argument `T`
1495
- * @throws compile error
1496
- *
1497
- * @author Jeongho Nam - https://github.com/samchon
1498
- */
1499
- export function createEquals(): never;
1500
-
1501
- /**
1502
- * Creates a reusable {@link equals} function.
1503
- *
1504
- * @template T Type of the input value
1505
- * @returns A reusable `equals` function
1506
- *
1507
- * @author Jeongho Nam - https://github.com/samchon
1508
- */
1509
- export function createEquals<T>(): (input: unknown) => input is T;
1510
-
1511
- /**
1512
- * @internal
1513
- */
1514
- export function createEquals<T>(): (input: unknown) => input is T {
1515
- halt("createEquals");
1516
- }
1517
- Object.assign(createEquals, equals);
1518
-
1519
- /**
1520
- * Creates a reusable {@link validateEquals} function.
1521
- *
1522
- * @danger You have to specify the generic argument `T`
1523
- * @return Nothing until specifying the generic argument `T`
1524
- * @throws compile error
1525
- *
1526
- * @author Jeongho Nam - https://github.com/samchon
1527
- */
1528
- export function createValidateEquals(): never;
1529
-
1530
- /**
1531
- * Creates a reusable {@link validateEquals} function.
1532
- *
1533
- * @template T Type of the input value
1534
- * @returns A reusable `validateEquals` function
1535
- *
1536
- * @author Jeongho Nam - https://github.com/samchon
1537
- */
1538
- export function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
1539
-
1540
- /**
1541
- * @internal
1542
- */
1543
- export function createValidateEquals(): (input: unknown) => IValidation {
1544
- halt("createValidateEquals");
1545
- }
1546
- Object.assign(createValidateEquals, validateEquals);
1547
-
1548
- /* -----------------------------------------------------------
1549
- JSON FUNCTIONS
1550
- ----------------------------------------------------------- */
1551
- /**
1552
- * Creates a reusable {@link isParse} function.
1553
- *
1554
- * @danger You have to specify the generic argument `T`
1555
- * @return Nothing until specifying the generic argument `T`
1556
- * @throws compile error
1557
- *
1558
- * @author Jeongho Nam - https://github.com/samchon
1559
- */
1560
- export function createIsParse(): never;
1561
-
1562
- /**
1563
- * Creates a reusable {@link isParse} function.
1564
- *
1565
- * @template T Expected type of parsed value
1566
- * @returns A reusable `isParse` function
1567
- *
1568
- * @author Jeongho Nam - https://github.com/samchon
1569
- */
1570
- export function createIsParse<T>(): (input: string) => Primitive<T> | null;
1571
-
1572
- /**
1573
- * @internal
1574
- */
1575
- export function createIsParse<T>(): (input: string) => Primitive<T> | null {
1576
- halt("createIsParse");
1577
- }
1578
- Object.assign(createIsParse, isParse);
1579
-
1580
- /**
1581
- * Creates a reusable {@link assertParse} function.
1582
- *
1583
- * @danger You have to specify the generic argument `T`
1584
- * @return Nothing until specifying the generic argument `T`
1585
- * @throws compile error
1586
- *
1587
- * @author Jeongho Nam - https://github.com/samchon
1588
- */
1589
- export function createAssertParse(): never;
1590
-
1591
- /**
1592
- * Creates a reusable {@link assertParse} function.
1593
- *
1594
- * @template T Expected type of parsed value
1595
- * @returns A reusable `assertParse` function
1596
- *
1597
- * @author Jeongho Nam - https://github.com/samchon
1598
- */
1599
- export function createAssertParse<T>(): (input: string) => Primitive<T>;
1600
-
1601
- /**
1602
- * @internal
1603
- */
1604
- export function createAssertParse<T>(): (input: string) => Primitive<T> {
1605
- halt("createAssertParse");
1606
- }
1607
- Object.assign(createAssertParse, assertParse);
1608
-
1609
- /**
1610
- * Creates a reusable {@link validateParse} function.
1611
- *
1612
- * @danger You have to specify the generic argument `T`
1613
- * @return Nothing until specifying the generic argument `T`
1614
- * @throws compile error
1615
- *
1616
- * @author Jeongho Nam - https://github.com/samchon
1617
- */
1618
- export function createValidateParse(): never;
1619
-
1620
- /**
1621
- * Creates a reusable {@link validateParse} function.
1622
- *
1623
- * @template T Expected type of parsed value
1624
- * @returns A reusable `validateParse` function
1625
- *
1626
- * @author Jeongho Nam - https://github.com/samchon
1627
- */
1628
- export function createValidateParse<T>(): (
1629
- input: string,
1630
- ) => IValidation<Primitive<T>>;
1631
-
1632
- /**
1633
- * @internal
1634
- */
1635
- export function createValidateParse<T>(): (
1636
- input: string,
1637
- ) => IValidation<Primitive<T>> {
1638
- halt("createValidateParse");
1639
- }
1640
- Object.assign(createValidateParse, validateParse);
1641
-
1642
- /**
1643
- * Creates a reusable {@link stringify} function.
1644
- *
1645
- * @danger You have to specify the generic argument `T`
1646
- * @return Nothing until specifying the generic argument `T`
1647
- * @throws compile error
1648
- *
1649
- * @author Jeongho Nam - https://github.com/samchon
1650
- */
1651
- export function createStringify(): never;
1652
-
1653
- /**
1654
- * Creates a reusable {@link stringify} function.
1655
- *
1656
- * @template T Type of the input value
1657
- * @returns A reusable `stringify` function
1658
- *
1659
- * @author Jeongho Nam - https://github.com/samchon
1660
- */
1661
- export function createStringify<T>(): (input: T) => string;
1662
-
1663
- /**
1664
- * @internal
1665
- */
1666
- export function createStringify<T>(): (input: T) => string {
1667
- halt("createStringify");
1668
- }
1669
- Object.assign(createStringify, stringify);
1670
-
1671
- /**
1672
- * Creates a reusable {@link assertStringify} function.
1673
- *
1674
- * @danger You have to specify the generic argument `T`
1675
- * @return Nothing until specifying the generic argument `T`
1676
- * @throws compile error
1677
- *
1678
- * @author Jeongho Nam - https://github.com/samchon
1679
- */
1680
- export function createAssertStringify(): never;
1681
-
1682
- /**
1683
- * Creates a reusable {@link assertStringify} function.
1684
- *
1685
- * @template T Type of the input value
1686
- * @returns A reusable `assertStringify` function
1687
- *
1688
- * @author Jeongho Nam - https://github.com/samchon
1689
- */
1690
- export function createAssertStringify<T>(): (input: unknown) => string;
1691
-
1692
- /**
1693
- * @internal
1694
- */
1695
- export function createAssertStringify(): (input: unknown) => string {
1696
- halt("createAssertStringify");
1697
- }
1698
- Object.assign(createAssertStringify, assertStringify);
1699
-
1700
- /**
1701
- * Creates a reusable {@link isStringify} function.
1702
- *
1703
- * @danger You have to specify the generic argument `T`
1704
- * @return Nothing until specifying the generic argument `T`
1705
- * @throws compile error
1706
- *
1707
- * @author Jeongho Nam - https://github.com/samchon
1708
- */
1709
- export function createIsStringify(): never;
1710
-
1711
- /**
1712
- * Creates a reusable {@link isStringify} function.
1713
- *
1714
- * @template T Type of the input value
1715
- * @returns A reusable `isStringify` function
1716
- *
1717
- * @author Jeongho Nam - https://github.com/samchon
1718
- */
1719
- export function createIsStringify<T>(): (input: unknown) => string | null;
1720
-
1721
- /**
1722
- * @internal
1723
- */
1724
- export function createIsStringify(): (input: unknown) => string | null {
1725
- halt("createIsStringify");
1726
- }
1727
- Object.assign(createIsStringify, isStringify);
1728
-
1729
- /**
1730
- * Creates a reusable {@link validateStringify} function.
1731
- *
1732
- * @danger You have to specify the generic argument `T`
1733
- * @return Nothing until specifying the generic argument `T`
1734
- * @throws compile error
1735
- *
1736
- * @author Jeongho Nam - https://github.com/samchon
1737
- */
1738
- export function createValidateStringify(): never;
1739
-
1740
- /**
1741
- * Creates a reusable {@link validateStringify} function.
1742
- *
1743
- * @template T Type of the input value
1744
- * @returns A reusable `validateStringify` function
1745
-
1746
- * @author Jeongho Nam - https://github.com/samchon
1747
- */
1748
- export function createValidateStringify<T>(): (
1749
- input: unknown,
1750
- ) => IValidation<string>;
1751
-
1752
- /**
1753
- * @internal
1754
- */
1755
- export function createValidateStringify(): (
1756
- input: unknown,
1757
- ) => IValidation<string> {
1758
- halt("createValidateStringify");
1759
- }
1760
- Object.assign(createValidateStringify, validateStringify);
1761
-
1762
- /* -----------------------------------------------------------
1763
- MISCELLANEOUS
1764
- ----------------------------------------------------------- */
1765
- /**
1766
- * Creates a reusable {@link random} function.
1767
- *
1768
- * @danger You have to specify the generic argument `T`
1769
- * @param generator Random data generator
1770
- * @return Nothing until specifying the generic argument `T`
1771
- * @throws compile error
1772
- *
1773
- * @author Jeongho Nam - https://github.com/samchon
1774
- */
1775
- export function createRandom(generator?: Partial<IRandomGenerator>): never;
1776
-
1777
- /**
1778
- * Creates a resuable {@link random} function.
1779
- *
1780
- * @template T Type of the input value
1781
- * @param generator Random data generator
1782
- * @returns A reusable `random` function
1783
- *
1784
- * @author Jeongho Nam - https://github.com/samchon
1785
- */
1786
- export function createRandom<T>(
1787
- generator?: Partial<IRandomGenerator>,
1788
- ): () => Primitive<T>;
1789
-
1790
- /**
1791
- * @internal
1792
- */
1793
- export function createRandom(): never {
1794
- halt("createRandom");
1795
- }
1796
- Object.assign(createRandom, random);
1797
-
1798
- /**
1799
- * Creates a reusable {@link clone} function.
1800
- *
1801
- * @danger You have to specify the generic argument `T`
1802
- * @return Nothing until specifying the generic argument `T`
1803
- * @throws compile error
1804
- *
1805
- * @author Jeongho Nam - https://github.com/samchon
1806
- */
1807
- export function createClone(): never;
1808
-
1809
- /**
1810
- * Creates a resuable {@link clone} function.
1811
- *
1812
- * @template T Type of the input value
1813
- * @returns A reusable `clone` function
1814
- *
1815
- * @author Jeongho Nam - https://github.com/samchon
1816
- */
1817
- export function createClone<T>(): (input: T) => Primitive<T>;
1818
-
1819
- /**
1820
- * @internal
1821
- */
1822
- export function createClone(): never {
1823
- halt("createClone");
1824
- }
1825
- Object.assign(createClone, clone);
1826
-
1827
- /**
1828
- * Creates a reusable {@link assertClone} function.
1829
- *
1830
- * @danger You have to specify the generic argument `T`
1831
- * @return Nothing until specifying the generic argument `T`
1832
- * @throws compile error
1833
- *
1834
- * @author Jeongho Nam - https://github.com/samchon
1835
- */
1836
- export function createAssertClone(): never;
1837
-
1838
- /**
1839
- * Creates a resuable {@link assertClone} function.
1840
- *
1841
- * @template T Type of the input value
1842
- * @returns A reusable `clone` function
1843
- *
1844
- * @author Jeongho Nam - https://github.com/samchon
1845
- */
1846
- export function createAssertClone<T>(): (input: unknown) => Primitive<T>;
1847
-
1848
- /**
1849
- * @internal
1850
- */
1851
- export function createAssertClone(): never {
1852
- halt("createAssertClone");
1853
- }
1854
- Object.assign(createAssertClone, assertClone);
1855
-
1856
- /**
1857
- * Creates a reusable {@link isClone} function.
1858
- *
1859
- * @danger You have to specify the generic argument `T`
1860
- * @return Nothing until specifying the generic argument `T`
1861
- * @throws compile error
1862
- *
1863
- * @author Jeongho Nam - https://github.com/samchon
1864
- */
1865
- export function createIsClone(): never;
1866
-
1867
- /**
1868
- * Creates a resuable {@link isClone} function.
1869
- *
1870
- * @template T Type of the input value
1871
- * @returns A reusable `clone` function
1872
- *
1873
- * @author Jeongho Nam - https://github.com/samchon
1874
- */
1875
- export function createIsClone<T>(): (input: unknown) => Primitive<T> | null;
1876
-
1877
- /**
1878
- * @internal
1879
- */
1880
- export function createIsClone(): never {
1881
- halt("createIsClone");
1882
- }
1883
- Object.assign(createIsClone, isClone);
1884
-
1885
- /**
1886
- * Creates a reusable {@link validateClone} function.
1887
- *
1888
- * @danger You have to specify the generic argument `T`
1889
- * @return Nothing until specifying the generic argument `T`
1890
- * @throws compile error
1891
- *
1892
- * @author Jeongho Nam - https://github.com/samchon
1893
- */
1894
- export function createValidateClone(): never;
1895
-
1896
- /**
1897
- * Creates a resuable {@link validateClone} function.
1898
- *
1899
- * @template T Type of the input value
1900
- * @returns A reusable `clone` function
1901
- *
1902
- * @author Jeongho Nam - https://github.com/samchon
1903
- */
1904
- export function createValidateClone<T>(): (
1905
- input: unknown,
1906
- ) => IValidation<Primitive<T>>;
1907
-
1908
- /**
1909
- * @internal
1910
- */
1911
- export function createValidateClone(): never {
1912
- halt("createValidateClone");
1913
- }
1914
- Object.assign(createValidateClone, validateClone);
1915
-
1916
- /**
1917
- * Creates a reusable {@link prune} function.
1918
- *
1919
- * @danger You have to specify the generic argument `T`
1920
- * @return Nothing until specifying the generic argument `T`
1921
- * @throws compile error
1922
- *
1923
- * @author Jeongho Nam - https://github.com/samchon
1924
- */
1925
- export function createPrune(): never;
1926
-
1927
- /**
1928
- * Creates a resuable {@link prune} function.
1929
- *
1930
- * @template T Type of the input value
1931
- * @returns A reusable `prune` function
1932
- *
1933
- * @author Jeongho Nam - https://github.com/samchon
1934
- */
1935
- export function createPrune<T extends object>(): (input: T) => void;
1936
-
1937
- /**
1938
- * @internal
1939
- */
1940
- export function createPrune<T extends object>(): (input: T) => void {
1941
- halt("createPrune");
1942
- }
1943
- Object.assign(createPrune, prune);
1944
-
1945
- /**
1946
- * Creates a reusable {@link assertPrune} function.
1947
- *
1948
- * @danger You have to specify the generic argument `T`
1949
- * @return Nothing until specifying the generic argument `T`
1950
- * @throws compile error
1951
- *
1952
- * @author Jeongho Nam - https://github.com/samchon
1953
- */
1954
- export function createAssertPrune(): never;
1955
-
1956
- /**
1957
- * Creates a resuable {@link assertPrune} function.
1958
- *
1959
- * @template T Type of the input value
1960
- * @returns A reusable `isPrune` function
1961
- *
1962
- * @author Jeongho Nam - https://github.com/samchon
1963
- */
1964
- export function createAssertPrune<T extends object>(): (input: T) => T;
1965
-
1966
- /**
1967
- * @internal
1968
- */
1969
- export function createAssertPrune<T extends object>(): (input: T) => T {
1970
- halt("createAssertPrune");
1971
- }
1972
- Object.assign(createAssertPrune, assertPrune);
1973
-
1974
- /**
1975
- * Creates a reusable {@link isPrune} function.
1976
- *
1977
- * @danger You have to specify the generic argument `T`
1978
- * @return Nothing until specifying the generic argument `T`
1979
- * @throws compile error
1980
- *
1981
- * @author Jeongho Nam - https://github.com/samchon
1982
- */
1983
- export function createIsPrune(): never;
1984
-
1985
- /**
1986
- * Creates a resuable {@link isPrune} function.
1987
- *
1988
- * @template T Type of the input value
1989
- * @returns A reusable `isPrune` function
1990
- *
1991
- * @author Jeongho Nam - https://github.com/samchon
1992
- */
1993
- export function createIsPrune<T extends object>(): (input: T) => input is T;
1994
-
1995
- /**
1996
- * @internal
1997
- */
1998
- export function createIsPrune<T extends object>(): (input: T) => input is T {
1999
- halt("createIsPrune");
2000
- }
2001
- Object.assign(createIsPrune, isPrune);
2002
-
2003
- /**
2004
- * Creates a reusable {@link validatePrune} function.
2005
- *
2006
- * @danger You have to specify the generic argument `T`
2007
- * @return Nothing until specifying the generic argument `T`
2008
- * @throws compile error
2009
- *
2010
- * @author Jeongho Nam - https://github.com/samchon
2011
- */
2012
- export function createValidatePrune(): never;
2013
-
2014
- /**
2015
- * Creates a resuable {@link validatePrune} function.
2016
- *
2017
- * @template T Type of the input value
2018
- * @returns A reusable `validatePrune` function
2019
- *
2020
- * @author Jeongho Nam - https://github.com/samchon
2021
- */
2022
- export function createValidatePrune<T extends object>(): (
2023
- input: T,
2024
- ) => IValidation<T>;
2025
-
2026
- /**
2027
- * @internal
2028
- */
2029
- export function createValidatePrune<T extends object>(): (
2030
- input: T,
2031
- ) => IValidation<T> {
2032
- halt("createValidatePrune");
2033
- }
2034
- Object.assign(createValidatePrune, validatePrune);
2035
-
2036
- /**
2037
- * @internal
2038
- */
2039
- function halt(name: string): never {
2040
- throw new Error(
2041
- `Error on typia.${name}(): no transform has been configured. Run "npx typia setup" command.`,
2042
- );
2043
- }
1
+ import { $dictionary } from "./functional/$dictionary";
2
+ import { Namespace } from "./functional/Namespace";
3
+
4
+ import { IMetadataApplication } from "./metadata/IMetadataApplication";
5
+ import { IJsonApplication } from "./schemas/IJsonApplication";
6
+
7
+ import { Atomic } from "./typings/Atomic";
8
+
9
+ import { MapUtil } from "./utils/MapUtil";
10
+
11
+ import { CustomValidatorMap } from "./CustomValidatorMap";
12
+ import { IRandomGenerator } from "./IRandomGenerator";
13
+ import { IValidation } from "./IValidation";
14
+ import { Primitive } from "./Primitive";
15
+ import { TypeGuardError } from "./TypeGuardError";
16
+
17
+ export * from "./schemas/IJsonApplication";
18
+ export * from "./schemas/IJsonComponents";
19
+ export * from "./schemas/IJsonSchema";
20
+ export * from "./IRandomGenerator";
21
+ export * from "./IValidation";
22
+ export * from "./Primitive";
23
+ export * from "./TypeGuardError";
24
+
25
+ /* ===========================================================
26
+ SINGLE FUNCTIONS
27
+ - BASIC VALIDATORS
28
+ - STRICT VALIDATORS
29
+ - PROTOCOL BUFFER FUNCTIONS
30
+ - JSON FUNCTIONS
31
+ - MISCELLANEOUS
32
+ ==============================================================
33
+ BASIC VALIDATORS
34
+ ----------------------------------------------------------- */
35
+ /**
36
+ * Asserts a value type.
37
+ *
38
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
39
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
40
+ * value is following the type `T`, just input parameter would be returned.
41
+ *
42
+ * If what you want is not asserting but just knowing whether the parametric value is
43
+ * following the type `T` or not, you can choose the {@link is} function instead.
44
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
45
+ *
46
+ * On the other and, if you don't want to allow any superfluous property that is not
47
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
48
+ *
49
+ * @template T Type of the input value
50
+ * @param input A value to be asserted
51
+ * @returns Parametric input value
52
+ * @throws A {@link TypeGuardError} instance with detailed reason
53
+ *
54
+ * @author Jeongho Nam - https://github.com/samchon
55
+ */
56
+ export function assert<T>(input: T): T;
57
+
58
+ /**
59
+ * Asserts a value type.
60
+ *
61
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
62
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
63
+ * value is following the type `T`, just input parameter would be returned.
64
+ *
65
+ * If what you want is not asserting but just knowing whether the parametric value is
66
+ * following the type `T` or not, you can choose the {@link is} function instead.
67
+ * Otherwise, you want to know all the errors, {@link validate} is the way to go.
68
+ *
69
+ * On the other and, if you don't want to allow any superfluous property that is not
70
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
71
+ *
72
+ * @template T Type of the input value
73
+ * @param input A value to be asserted
74
+ * @returns Parametric input value casted as `T`
75
+ * @throws A {@link TypeGuardError} instance with detailed reason
76
+ *
77
+ * @author Jeongho Nam - https://github.com/samchon
78
+ */
79
+ export function assert<T>(input: unknown): T;
80
+
81
+ /**
82
+ * @internal
83
+ */
84
+ export function assert(): never {
85
+ halt("assert");
86
+ }
87
+ Object.assign(assert, Namespace.assert("assert"));
88
+
89
+ /**
90
+ * Asserts a value type.
91
+ *
92
+ * Duplicated function of {@link assert} for `typescript-is` users.
93
+ *
94
+ * @template T Type of the input value
95
+ * @param input A value to be asserted
96
+ * @returns Parametric input value
97
+ * @throws A {@link TypeGuardError} instance with detailed reason
98
+ *
99
+ * @author Jeongho Nam - https://github.com/samchon
100
+ * @deprecated
101
+ */
102
+ export function assertType<T>(input: T): T;
103
+
104
+ /**
105
+ * Asserts a value type.
106
+ *
107
+ * Duplicated function of {@link assert} for `typescript-is` users.
108
+ *
109
+ * @template T Type of the input value
110
+ * @param input A value to be asserted
111
+ * @returns Parametric input value
112
+ * @throws A {@link TypeGuardError} instance with detailed reason
113
+ *
114
+ * @author Jeongho Nam - https://github.com/samchon
115
+ * @deprecated
116
+ */
117
+ export function assertType<T>(input: unknown): T;
118
+
119
+ /**
120
+ * @internal
121
+ */
122
+ export function assertType(): never {
123
+ halt("assertType");
124
+ }
125
+ Object.assign(assertType, Namespace.assert("assertType"));
126
+
127
+ /**
128
+ * Tests a value type.
129
+ *
130
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
131
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
132
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
133
+ * returned.
134
+ *
135
+ * If what you want is not just knowing whether the parametric value is following the
136
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
137
+ * {@link assert} function instead. Also, if you want to know all the errors with
138
+ * detailed reasons, {@link validate} function would be useful.
139
+ *
140
+ * On the other and, if you don't want to allow any superfluous property that is not
141
+ * enrolled to the type `T`, you can use {@link equals} function instead.
142
+ *
143
+ * @template T Type of the input value
144
+ * @param input A value to be tested
145
+ * @returns Whether the parametric value is following the type `T` or not
146
+ *
147
+ * @author Jeongho Nam - https://github.com/samchon
148
+ */
149
+ export function is<T>(input: T): input is T;
150
+
151
+ /**
152
+ * Tests a value type.
153
+ *
154
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
155
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
156
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
157
+ * returned.
158
+ *
159
+ * If what you want is not just knowing whether the parametric value is following the
160
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
161
+ * {@link assert} function instead. Also, if you want to know all the errors with
162
+ * detailed reasons, {@link validate} function would be useful.
163
+ *
164
+ * On the other and, if you don't want to allow any superfluous property that is not
165
+ * enrolled to the type `T`, you can use {@link equals} function instead.
166
+ *
167
+ * @template T Type of the input value
168
+ * @param input A value to be tested
169
+ * @returns Whether the parametric value is following the type `T` or not
170
+ *
171
+ * @author Jeongho Nam - https://github.com/samchon
172
+ */
173
+ export function is<T>(input: unknown): input is T;
174
+
175
+ /**
176
+ * @internal
177
+ */
178
+ export function is(): never {
179
+ halt("is");
180
+ }
181
+ Object.assign(is, Namespace.assert("is"));
182
+
183
+ /**
184
+ * Validates a value type.
185
+ *
186
+ * Validates a parametric value type and archives all the type errors into an
187
+ * {@link IValidation.errors} array, if the parametric value is not following the
188
+ * type `T`. Of course, if the parametric value is following the type `T`, the
189
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
190
+ * would have the `true` value.
191
+ *
192
+ * If what you want is not finding all the error, but asserting the parametric value
193
+ * type with exception throwing, you can choose {@link assert} function instead.
194
+ * Otherwise, you just want to know whether the parametric value is matched with the
195
+ * type `T`, {@link is} function is the way to go.
196
+ *
197
+ * On the other and, if you don't want to allow any superfluous property that is not
198
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
199
+ *
200
+ * @template Type of the input value
201
+ * @param input A value to be validated
202
+ * @returns Validation result
203
+ *
204
+ * @author Jeongho Nam - https://github.com/samchon
205
+ */
206
+ export function validate<T>(input: T): IValidation<T>;
207
+
208
+ /**
209
+ * Validates a value type.
210
+ *
211
+ * Validates a parametric value type and archives all the type errors into an
212
+ * {@link IValidation.errors} array, if the parametric value is not following the
213
+ * type `T`. Of course, if the parametric value is following the type `T`, the
214
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
215
+ * would have the `true` value.
216
+ *
217
+ * If what you want is not finding all the error, but asserting the parametric value
218
+ * type with exception throwing, you can choose {@link assert} function instead.
219
+ * Otherwise, you just want to know whether the parametric value is matched with the
220
+ * type `T`, {@link is} function is the way to go.
221
+ *
222
+ * On the other and, if you don't want to allow any superfluous property that is not
223
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
224
+ *
225
+ * @template Type of the input value
226
+ * @param input A value to be validated
227
+ * @returns Validation result
228
+ *
229
+ * @author Jeongho Nam - https://github.com/samchon
230
+ */
231
+ export function validate<T>(input: unknown): IValidation<T>;
232
+
233
+ /**
234
+ * @internal
235
+ */
236
+ export function validate(): never {
237
+ halt("validate");
238
+ }
239
+ Object.assign(validate, Namespace.validate());
240
+
241
+ /* -----------------------------------------------------------
242
+ STRICT VALIDATORS
243
+ ----------------------------------------------------------- */
244
+ /**
245
+ * Asserts equality between a value and its type.
246
+ *
247
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
248
+ * reason, if the parametric value is not following the type `T` or some superfluous
249
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
250
+ * following the type `T` without any superfluous property, just input parameter would
251
+ * be returned.
252
+ *
253
+ * If what you want is not asserting but just knowing whether the parametric value is
254
+ * following the type `T` or not, you can choose the {@link equals} function instead.
255
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
256
+ *
257
+ * On the other hand, if you want to allow superfluous property that is not enrolled
258
+ * to the type `T`, you can use {@link assert} function instead.
259
+ *
260
+ * @template T Type of the input value
261
+ * @param input A value to be asserted
262
+ * @returns Parametric input value
263
+ * @throws A {@link TypeGuardError} instance with detailed reason
264
+ *
265
+ * @author Jeongho Nam - https://github.com/samchon
266
+ */
267
+ export function assertEquals<T>(input: T): T;
268
+
269
+ /**
270
+ * Asserts equality between a value and its type.
271
+ *
272
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
273
+ * reason, if the parametric value is not following the type `T` or some superfluous
274
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
275
+ * following the type `T` without any superfluous property, just input parameter would
276
+ * be returned.
277
+ *
278
+ * If what you want is not asserting but just knowing whether the parametric value is
279
+ * following the type `T` or not, you can choose the {@link equals} function instead.
280
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
281
+ *
282
+ * On the other hand, if you want to allow superfluous property that is not enrolled
283
+ * to the type `T`, you can use {@link assert} function instead.
284
+ *
285
+ * @template T Type of the input value
286
+ * @param input A value to be asserted
287
+ * @returns Parametric input value casted as `T`
288
+ * @throws A {@link TypeGuardError} instance with detailed reason
289
+ *
290
+ * @author Jeongho Nam - https://github.com/samchon
291
+ */
292
+ export function assertEquals<T>(input: unknown): T;
293
+
294
+ /**
295
+ * @internal
296
+ */
297
+ export function assertEquals(): never {
298
+ halt("assertEquals");
299
+ }
300
+ Object.assign(assertEquals, Namespace.assert("assertEquals"));
301
+
302
+ /**
303
+ * Tests equality between a value and its type.
304
+ *
305
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
306
+ * or not. If the parametric value is matched with the type `T` and there's not any
307
+ * superfluous property that is not listed on the type `T`, `true` value would be
308
+ * returned. Otherwise, the parametric value is not following the type `T` or some
309
+ * superfluous property exists, `false` value would be returned.
310
+ *
311
+ * If what you want is not just knowing whether the parametric value is following the
312
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
313
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
314
+ * detailed reasons, {@link validateEquals} function would be useful.
315
+ *
316
+ * On the other hand, if you want to allow superfluous property that is not enrolled
317
+ * to the type `T`, you can use {@link is} function instead.
318
+ *
319
+ * @template T Type of the input value
320
+ * @param input A value to be tested
321
+ * @returns Whether the parametric value is equivalent to the type `T` or not
322
+ *
323
+ * @author Jeongho Nam - https://github.com/samchon
324
+ */
325
+ export function equals<T>(input: T): input is T;
326
+
327
+ /**
328
+ * Tests equality between a value and its type.
329
+ *
330
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
331
+ * or not. If the parametric value is matched with the type `T` and there's not any
332
+ * superfluous property that is not listed on the type `T`, `true` value would be
333
+ * returned. Otherwise, the parametric value is not following the type `T` or some
334
+ * superfluous property exists, `false` value would be returned.
335
+ *
336
+ * If what you want is not just knowing whether the parametric value is following the
337
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
338
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
339
+ * detailed reasons, {@link validateEquals} function would be useful.
340
+ *
341
+ * On the other hand, if you want to allow superfluous property that is not enrolled
342
+ * to the type `T`, you can use {@link is} function instead.
343
+ *
344
+ * @template T Type of the input value
345
+ * @param input A value to be tested
346
+ * @returns Whether the parametric value is equivalent to the type `T` or not
347
+ *
348
+ * @author Jeongho Nam - https://github.com/samchon
349
+ */
350
+ export function equals<T>(input: unknown): input is T;
351
+
352
+ /**
353
+ * @internal
354
+ */
355
+ export function equals(): never {
356
+ halt("equals");
357
+ }
358
+ Object.assign(equals, Namespace.is());
359
+
360
+ /**
361
+ * Validates equality between a value and its type.
362
+ *
363
+ * Validates a parametric value type and archives all the type errors into an
364
+ * {@link IValidation.errors} array, if the parametric value is not following the
365
+ * type `T` or some superfluous property that is not listed on the type `T` has been
366
+ * found. Of course, if the parametric value is following the type `T` and no
367
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
368
+ * and {@link IValidation.success} would have the `true` value.
369
+ *
370
+ * If what you want is not finding all the error, but asserting the parametric value
371
+ * type with exception throwing, you can choose {@link assert} function instead.
372
+ * Otherwise, you just want to know whether the parametric value is matched with the
373
+ * type `T`, {@link is} function is the way to go.
374
+ *
375
+ * On the other and, if you don't want to allow any superfluous property that is not
376
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
377
+ *
378
+ * @template Type of the input value
379
+ * @param input A value to be validated
380
+ * @returns Validation result
381
+ *
382
+ * @author Jeongho Nam - https://github.com/samchon
383
+ */
384
+ export function validateEquals<T>(input: T): IValidation<T>;
385
+
386
+ /**
387
+ * Validates equality between a value and its type.
388
+ *
389
+ * Validates a parametric value type and archives all the type errors into an
390
+ * {@link IValidation.errors} array, if the parametric value is not following the
391
+ * type `T` or some superfluous property that is not listed on the type `T` has been
392
+ * found. Of course, if the parametric value is following the type `T` and no
393
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
394
+ * and {@link IValidation.success} would have the `true` value.
395
+ *
396
+ * If what you want is not finding all the error, but asserting the parametric value
397
+ * type with exception throwing, you can choose {@link assert} function instead.
398
+ * Otherwise, you just want to know whether the parametric value is matched with the
399
+ * type `T`, {@link is} function is the way to go.
400
+ *
401
+ * On the other and, if you don't want to allow any superfluous property that is not
402
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
403
+ *
404
+ * @template Type of the input value
405
+ * @param input A value to be validated
406
+ * @returns Validation result
407
+ *
408
+ * @author Jeongho Nam - https://github.com/samchon
409
+ */
410
+ export function validateEquals<T>(input: unknown): IValidation<T>;
411
+
412
+ /**
413
+ * @internal
414
+ */
415
+ export function validateEquals(): never {
416
+ halt("validateEquals");
417
+ }
418
+ Object.assign(validateEquals, Namespace.validate());
419
+
420
+ /**
421
+ * Custom validators.
422
+ *
423
+ * If you want to add a custom validation logic utilizing comment tags,
424
+ * add a closure function with its tag and type name. Below example code
425
+ * would helpful to understand how to use this instance.
426
+ *
427
+ * ```ts
428
+ * typia.customValidators.insert("powerOf")("number")(
429
+ * (text: string) => {
430
+ * const denominator: number = Math.log(Number(text));
431
+ * return (value: number) => {
432
+ * value = Math.log(value) / denominator;
433
+ * return value === Math.floor(value);
434
+ * };
435
+ * }
436
+ * );
437
+ * typia.customValidators.insert("dollar")("string")(
438
+ * () => (value: string) => value.startsWith("$"),
439
+ * );
440
+ *
441
+ * interface TagCustom {
442
+ * /**
443
+ * * @powerOf 10
444
+ * *\/
445
+ * powerOf: number;
446
+ *
447
+ * /**
448
+ * * @dollar
449
+ * *\/
450
+ * dollar: string;
451
+ * }
452
+ * ```
453
+ *
454
+ * @author Jeongho Nam - https://github.com/samchon
455
+ */
456
+ export const customValidators: CustomValidatorMap = {
457
+ size: (name?: string) =>
458
+ name ? $dictionary.get(name)?.size ?? 0 : $dictionary.size,
459
+ has: (name) => (type) => $dictionary.get(name)?.has(type) ?? false,
460
+ get: (name) => (type) => $dictionary.get(name)?.get(type),
461
+ insert: (name) => (type) => (closure) => {
462
+ const internal = MapUtil.take($dictionary)(name, () => new Map());
463
+ if (internal.has(type)) return false;
464
+ internal.set(type, closure);
465
+ return true;
466
+ },
467
+ erase: (name) => (type) => $dictionary.get(name)?.delete(type) ?? false,
468
+ };
469
+
470
+ /* -----------------------------------------------------------
471
+ PROTOCOL BUFFER FUNCTIONS
472
+ ----------------------------------------------------------- */
473
+ export function message(): never;
474
+ export function message<T>(): string;
475
+
476
+ export function message(): string {
477
+ halt("message");
478
+ }
479
+
480
+ /* -----------------------------------------------------------
481
+ JSON FUNCTIONS
482
+ ----------------------------------------------------------- */
483
+ /**
484
+ * > You must configure the generic argument `T`.
485
+ *
486
+ * JSON Schema Application.
487
+ *
488
+ * Creates a JSON schema application which contains both main JSON schemas and components.
489
+ * Note that, all of the object types are stored in the {@link IJsonApplication.components}
490
+ * property for the `$ref` referencing.
491
+ *
492
+ * Also, `typia.application()` has additional generic arguments, *Purpose*.
493
+ * As JSON schema definitions used by `swagger` and `ajv` are different a little bit,
494
+ * you should configure the *Purpose* appropriately.
495
+ *
496
+ * For an example, `ajv` has an extra property "$recursiveRef" that are not exists
497
+ * in the standard JSON schema definition spec. Otherwise, `swagger` can't identify
498
+ * the tuple definition.
499
+ *
500
+ * @template Types Tuple of target types
501
+ * @template Purpose Purpose of the JSON schema`
502
+ * @template Prefix Prefix of the JSON components referenced by `$ref` tag
503
+ * @return JSON schema application
504
+ *
505
+ * @author Jeongho Nam - https://github.com/samchon
506
+ */
507
+ export function application(): never;
508
+
509
+ /**
510
+ * JSON Schema Application.
511
+ *
512
+ * Creates a JSON schema application which contains both main JSON schemas and components.
513
+ * Note that, all of the object types are stored in the {@link IJsonApplication.components}
514
+ * property for the `$ref` referencing.
515
+ *
516
+ * Also, `typia.application()` has additional generic arguments, *Purpose*.
517
+ * As JSON schema definitions used by `swagger` and `ajv` are different a little bit,
518
+ * you should configure the *Purpose* appropriately.
519
+ *
520
+ * For an example, `ajv` has an extra property "$recursiveRef" that are not exists
521
+ * in the standard JSON schema definition spec. Otherwise, `swagger` can't identify
522
+ * the tuple definition.
523
+ *
524
+ * @template Types Tuple of target types
525
+ * @template Purpose Purpose of the JSON schema
526
+ * @template Prefix Prefix of the JSON components referenced by `$ref` tag
527
+ * @return JSON schema application
528
+ *
529
+ * @author Jeongho Nam - https://github.com/samchon
530
+ */
531
+ export function application<
532
+ Types extends unknown[],
533
+ Purpose extends "swagger" | "ajv" = "swagger",
534
+ Prefix extends string = Purpose extends "swagger"
535
+ ? "#/components/schemas"
536
+ : "components#/schemas",
537
+ >(): IJsonApplication;
538
+
539
+ /**
540
+ * @internal
541
+ */
542
+ export function application(): never {
543
+ halt("application");
544
+ }
545
+
546
+ /**
547
+ * > You must configure the generic argument `T`.
548
+ *
549
+ * Safe `JSON.parse()` function with type assertion.
550
+ *
551
+ * `typia.assertParse()` is a combination function of `JSON.parse()` and {@link assert}.
552
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
553
+ * instance with type assertion.
554
+ *
555
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
556
+ * throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed value,
557
+ * the parsed value would be returned.
558
+ *
559
+ * @template T Expected type of parsed value
560
+ * @param input JSON string
561
+ * @returns Parsed value
562
+ *
563
+ * @author Jeongho Nam - https://github.com/samchon
564
+ */
565
+ export function assertParse(input: string): never;
566
+
567
+ /**
568
+ * Safe `JSON.parse()` function with type assertion.
569
+ *
570
+ * `typia.assertParse()` is a combination function of `JSON.parse()` and {@link assert}.
571
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
572
+ * instance with type assertion.
573
+ *
574
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
575
+ * throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed value,
576
+ * the parsed value would be returned.
577
+ *
578
+ * @template T Expected type of parsed value
579
+ * @param input JSON string
580
+ * @returns Parsed value
581
+ *
582
+ * @author Jeongho Nam - https://github.com/samchon
583
+ */
584
+ export function assertParse<T>(input: string): Primitive<T>;
585
+
586
+ /**
587
+ * @internal
588
+ */
589
+ export function assertParse<T>(): Primitive<T> {
590
+ halt("assertParse");
591
+ }
592
+ Object.assign(assertParse, Namespace.assert("assertParse"));
593
+
594
+ /**
595
+ * > You must configure the generic argument `T`.
596
+ *
597
+ * Safe `JSON.parse()` function with type checking.
598
+ *
599
+ * `typia.isParse()` is a combination function of `JSON.parse()` and {@link is}.
600
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
601
+ * instance with type checking.
602
+ *
603
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
604
+ * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
605
+ * value would be returned.
606
+ *
607
+ * @template T Expected type of parsed value
608
+ * @param input JSON string
609
+ * @returns Parsed value when exact type, otherwise `null`
610
+ *
611
+ * @author Jeongho Nam - https://github.com/samchon
612
+ */
613
+ export function isParse(input: string): never;
614
+
615
+ /**
616
+ * Safe `JSON.parse()` function with type checking.
617
+ *
618
+ * `typia.isParse()` is a combination function of `JSON.parse()` and {@link is}.
619
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
620
+ * instance with type checking.
621
+ *
622
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
623
+ * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
624
+ * value would be returned.
625
+ *
626
+ * @template T Expected type of parsed value
627
+ * @param input JSON string
628
+ * @returns Parsed value when exact type, otherwise `null`
629
+ *
630
+ * @author Jeongho Nam - https://github.com/samchon
631
+ */
632
+ export function isParse<T>(input: string): Primitive<T> | null;
633
+
634
+ /**
635
+ * @internal
636
+ */
637
+ export function isParse<T>(): Primitive<T> | null {
638
+ halt("isParse");
639
+ }
640
+ Object.assign(isParse, is);
641
+
642
+ /**
643
+ * > You must configure the generic argument `T`.
644
+ *
645
+ * Safe `JSON.parse()` function with detailed type validation.
646
+ *
647
+ * `typia.validateParse()` is a combination function of `JSON.parse()` and
648
+ * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
649
+ * to a `T` typed instance with detailed type validation.
650
+ *
651
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
652
+ * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
653
+ * there's no problem on the parsed value, the parsed value would be stored in `data`
654
+ * property of the output {@link IValidation.ISuccess} instance.
655
+ *
656
+ * @template T Expected type of parsed value
657
+ * @param input JSON string
658
+ * @returns Validation result with JSON parsed value
659
+ *
660
+ * @author Jeongho Nam - https://github.com/samchon
661
+ */
662
+ export function validateParse(input: string): never;
663
+
664
+ /**
665
+ * Safe `JSON.parse()` function with detailed type validation.
666
+ *
667
+ * `typia.validateParse()` is a combination function of `JSON.parse()` and
668
+ * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
669
+ * to a `T` typed instance with detailed type validation.
670
+ *
671
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
672
+ * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
673
+ * there's no problem on the parsed value, the parsed value would be stored in `data`
674
+ * property of the output {@link IValidation.ISuccess} instance.
675
+ *
676
+ * @template T Expected type of parsed value
677
+ * @param input JSON string
678
+ * @returns Validation result with JSON parsed value
679
+ *
680
+ * @author Jeongho Nam - https://github.com/samchon
681
+ */
682
+ export function validateParse<T>(input: string): IValidation<Primitive<T>>;
683
+
684
+ /**
685
+ * @internal
686
+ */
687
+ export function validateParse<T>(): IValidation<Primitive<T>> {
688
+ halt("validateParse");
689
+ }
690
+ Object.assign(validateParse, validate);
691
+
692
+ /**
693
+ * 8x faster `JSON.stringify()` function.
694
+ *
695
+ * Converts an input value to a JSON (JavaScript Object Notation) string, about 8x faster
696
+ * than the native `JSON.stringify()` function. The 5x faster principle is because
697
+ * it writes an optimized JSON conversion plan, only for the type `T`.
698
+ *
699
+ * For reference, this `typia.stringify()` does not validate the input value type.
700
+ * It just believes that the input value is following the type `T`. Therefore, if you
701
+ * can't ensure the input value type, it would be better to call one of below functions
702
+ * instead.
703
+ *
704
+ * - {@link assertStringify}
705
+ * - {@link isStringify}
706
+ * - {@link validateStringify}
707
+ *
708
+ * @template T Type of the input value
709
+ * @param input A value to be converted
710
+ * @return JSON string value
711
+ *
712
+ * @author Jeongho Nam - https://github.com/samchon
713
+ */
714
+ export function stringify<T>(input: T): string;
715
+
716
+ /**
717
+ * @internal
718
+ */
719
+ export function stringify(): never {
720
+ halt("stringify");
721
+ }
722
+ Object.assign(stringify, Namespace.stringify("stringify"));
723
+
724
+ /**
725
+ * 5x faster `JSON.stringify()` function with type assertion.
726
+ *
727
+ * `typia.assertStringify()` is a combination function of {@link assert} and
728
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
729
+ * Notation) string, with type assertion.
730
+ *
731
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
732
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
733
+ * string would be returned.
734
+ *
735
+ * For reference, with type assertion, it is even 5x times faster than the native
736
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
737
+ * with confidence.
738
+ *
739
+ * @template T Type of the input value
740
+ * @param input A value to be asserted and converted
741
+ * @return JSON string value
742
+ *
743
+ * @author Jeongho Nam - https://github.com/samchon
744
+ */
745
+ export function assertStringify<T>(input: T): string;
746
+
747
+ /**
748
+ * 5x faster `JSON.stringify()` function with type assertion.
749
+ *
750
+ * `typia.assertStringify()` is a combination function of {@link assert} and
751
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
752
+ * Notation) string, with type assertion.
753
+ *
754
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
755
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
756
+ * string would be returned.
757
+ *
758
+ * For reference, with type assertion, it is even 5x times faster than the native
759
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
760
+ * with confidence.
761
+ *
762
+ * @template T Type of the input value
763
+ * @param input A value to be asserted and converted
764
+ * @return JSON string value
765
+ *
766
+ * @author Jeongho Nam - https://github.com/samchon
767
+ */
768
+ export function assertStringify<T>(input: T): unknown;
769
+
770
+ /**
771
+ * @internal
772
+ */
773
+ export function assertStringify(): string {
774
+ halt("assertStringify");
775
+ }
776
+ Object.assign(assertStringify, Namespace.assert("assertStringify"));
777
+ Object.assign(assertStringify, Namespace.stringify("assertStringify"));
778
+
779
+ /**
780
+ * 7x faster `JSON.stringify()` function with type checking.
781
+ *
782
+ * `typia.stringify()` is a combination function of {@link is} and
783
+ * {@link stringify}. Therefore, it converts an input value to JSON
784
+ * (JavaScript Object Notation) string, with type checking.
785
+ *
786
+ * In such reason, when `input` value is not matched with the type `T`, it returns
787
+ * `null` value. Otherwise, there's no problem on the `input` value, JSON string would
788
+ * be returned.
789
+ *
790
+ * For reference, with type checking, it is even 7x times faster than the native
791
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
792
+ * with confidence.
793
+ *
794
+ * @template T Type of the input value
795
+ * @param input A value to be checked and converted
796
+ * @return JSON string value when exact type, otherwise null
797
+ *
798
+ * @author Jeongho Nam - https://github.com/samchon
799
+ */
800
+ export function isStringify<T>(input: T): string | null;
801
+
802
+ /**
803
+ * 7x faster `JSON.stringify()` function with type checking.
804
+ *
805
+ * `typia.isStringify()` is a combination function of {@link is} and
806
+ * {@link stringify}. Therefore, it converts an input value to JSON
807
+ * (JavaScript Object Notation) string, with type checking.
808
+ *f
809
+ * In such reason, when `input` value is not matched with the type `T`, it returns
810
+ * `null` value. Otherwise, there's no problem on the `input` value, JSON string would
811
+ * be returned.
812
+ *
813
+ * For reference, with type checking, it is even 7x times faster than the native
814
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
815
+ * with confidence.
816
+ *
817
+ * @template T Type of the input value
818
+ * @param input A value to be checked and converted
819
+ * @return JSON string value when exact type, otherwise null
820
+ *
821
+ * @author Jeongho Nam - https://github.com/samchon
822
+ */
823
+ export function isStringify<T>(input: unknown): string | null;
824
+
825
+ /**
826
+ * @internal
827
+ */
828
+ export function isStringify(): string | null {
829
+ halt("isStringify");
830
+ }
831
+
832
+ Object.assign(isStringify, Namespace.is());
833
+ Object.assign(isStringify, Namespace.stringify("isStringify"));
834
+
835
+ /**
836
+ * 5x faster `JSON.stringify()` function with detailed type validation.
837
+ *
838
+ * `typia.validateStringify()` is a combination function of {@link validate} and
839
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
840
+ * Notation) string, with detailed type validation.
841
+ *
842
+ * In such reason, when `input` value is not matched with the type `T`, it returns
843
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's no
844
+ * problem on the `input` value, JSON string would be stored in `data` property of
845
+ * the output {@link IValidation.ISuccess} instance.
846
+ *
847
+ * For reference, with detailed type validation, it is even 5x times faster than the
848
+ * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
849
+ * with confidence.
850
+ *
851
+ * @template T Type of the input value
852
+ * @param input A value to be checked and converted
853
+ * @returns Validation result with JSON string value
854
+ *
855
+ * @author Jeongho Nam - https://github.com/samchon
856
+ */
857
+ export function validateStringify<T>(input: T): IValidation<string>;
858
+
859
+ /**
860
+ * 5x faster `JSON.stringify()` function with detailed type validation.
861
+ *
862
+ * `typia.validateStringify()` is a combination function of {@link validate} and
863
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
864
+ * Notation) string, with detailed type validation.
865
+ *
866
+ * In such reason, when `input` value is not matched with the type `T`, it returns
867
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's no
868
+ * problem on the `input` value, JSON string would be stored in `data` property of
869
+ * the output {@link IValidation.ISuccess} instance.
870
+ *
871
+ * For reference, with detailed type validation, it is even 5x times faster than the
872
+ * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
873
+ * with confidence.
874
+ *
875
+ * @template T Type of the input value
876
+ * @param input A value to be checked and converted
877
+ * @returns Validation result with JSON string value
878
+ *
879
+ * @author Jeongho Nam - https://github.com/samchon
880
+ */
881
+ export function validateStringify<T>(input: unknown): IValidation<string>;
882
+
883
+ /**
884
+ * @internal
885
+ */
886
+ export function validateStringify(): IValidation<string> {
887
+ halt("validateStringify");
888
+ }
889
+ Object.assign(validateStringify, Namespace.validate());
890
+ Object.assign(validateStringify, Namespace.stringify("validateStringify"));
891
+
892
+ /* -----------------------------------------------------------
893
+ MISCELLANEOUS
894
+ ----------------------------------------------------------- */
895
+ /**
896
+ * @internal
897
+ */
898
+ export function metadata(): never;
899
+
900
+ /**
901
+ * @internal
902
+ */
903
+ export function metadata<Types extends unknown[]>(): IMetadataApplication;
904
+
905
+ /**
906
+ * @internal
907
+ */
908
+ export function metadata(): never {
909
+ halt("metadata");
910
+ }
911
+
912
+ /**
913
+ * > You must configure the generic argument `T`.
914
+ *
915
+ * Generate random data.
916
+ *
917
+ * Generates a random data following type the `T`.
918
+ *
919
+ * For reference, this `typia.random()` function generates only primitive type.
920
+ * If there're some methods in the type `T` or its nested instances, those would
921
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
922
+ * would be generated instead.
923
+ *
924
+ * @template T Type of data to generate
925
+ * @param generator Random data generator
926
+ * @return Randomly generated data
927
+ *
928
+ * @author Jeongho Nam - https://github.com/samchon
929
+ */
930
+ export function random(generator?: Partial<IRandomGenerator>): never;
931
+
932
+ /**
933
+ * Generate random data.
934
+ *
935
+ * Generates a random data following type the `T`.
936
+ *
937
+ * For reference, this `typia.random()` function generates only primitive type.
938
+ * If there're some methods in the type `T` or its nested instances, those would
939
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
940
+ * would be generated instead.
941
+ *
942
+ * @template T Type of data to generate
943
+ * @param generator Random data generator
944
+ * @return Randomly generated data
945
+ *
946
+ * @author Jeongho Nam - https://github.com/samchon
947
+ */
948
+ export function random<T>(generator?: Partial<IRandomGenerator>): Primitive<T>;
949
+
950
+ /**
951
+ * @internal
952
+ */
953
+ export function random(): never {
954
+ halt("random");
955
+ }
956
+ Object.assign(random, Namespace.random());
957
+
958
+ /**
959
+ * > You must configure the generic argument `T`.
960
+ *
961
+ * Union literal type to array.
962
+ *
963
+ * Converts a union literal type to an array of its members.
964
+ *
965
+ * ```typescript
966
+ * literals<"A" | "B" | 1>; // [1, 2, 3] as const
967
+ * ```
968
+ *
969
+ * @template T Union literal type
970
+ * @return Array of union literal type's members
971
+ *
972
+ * @author Jeongho Nam - https://github.com/samchon
973
+ */
974
+ export function literals(): never;
975
+
976
+ /**
977
+ * Union literal type to array.
978
+ *
979
+ * Converts a union literal type to an array of its members.
980
+ *
981
+ * ```typescript
982
+ * literals<"A" | "B" | 1>; // [1, 2, 3] as const
983
+ * ```
984
+ *
985
+ * @template T Union literal type
986
+ * @return Array of union literal type's members
987
+ *
988
+ * @author Jeongho Nam - https://github.com/samchon
989
+ */
990
+ export function literals<T extends Atomic.Type>(): T[];
991
+
992
+ /**
993
+ * @internal
994
+ */
995
+ export function literals(): never {
996
+ halt("literals");
997
+ }
998
+
999
+ /**
1000
+ * Clone a data.
1001
+ *
1002
+ * Clones an instance following type `T`. If the target *input* value or its member
1003
+ * variable contains a class instance that is having a `toJSON()` method, its return
1004
+ * value would be cloned.
1005
+ *
1006
+ * For reference, this `typia.clone()` function does not validate the input value type.
1007
+ * It just believes that the input value is following the type `T`. Therefore, if you
1008
+ * can't ensure the input value type, it would be better to call {@link assertClone}
1009
+ * function instead.
1010
+ *
1011
+ * @template T Type of the input value
1012
+ * @param input A value to be cloned
1013
+ * @return Cloned data
1014
+ *
1015
+ * @author Jeongho Nam - https://github.com/samchon
1016
+ */
1017
+ export function clone<T>(input: T): Primitive<T>;
1018
+
1019
+ /**
1020
+ * @internal
1021
+ */
1022
+ export function clone(): never {
1023
+ halt("clone");
1024
+ }
1025
+ Object.assign(clone, Namespace.clone("clone"));
1026
+
1027
+ /**
1028
+ * Clone a data with type assertion.
1029
+ *
1030
+ * Clones an instance following type `T`, with type assertion. If the target `input`
1031
+ * value or its member variable contains a class instance that is having a `toJSON()`
1032
+ * method, its return value would be cloned.
1033
+ *
1034
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1035
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, cloned
1036
+ * data would be returned.
1037
+ *
1038
+ * @template T Type of the input value
1039
+ * @param input A value to be cloned
1040
+ * @return Cloned data
1041
+ *
1042
+ * @author Jeongho Nam - https://github.com/samchon
1043
+ */
1044
+ export function assertClone<T>(input: T): Primitive<T>;
1045
+
1046
+ /**
1047
+ * Clone a data with type assertion.
1048
+ *
1049
+ * Clones an instance following type `T`, with type assertion. If the target `input`
1050
+ * value or its member variable contains a class instance that is having a `toJSON()`
1051
+ * method, its return value would be cloned.
1052
+ *
1053
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1054
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, cloned
1055
+ * data would be returned.
1056
+ *
1057
+ * @template T Type of the input value
1058
+ * @param input A value to be cloned
1059
+ * @return Cloned data
1060
+ *
1061
+ * @author Jeongho Nam - https://github.com/samchon
1062
+ */
1063
+ export function assertClone<T>(input: unknown): Primitive<T>;
1064
+
1065
+ /**
1066
+ * @internal
1067
+ */
1068
+ export function assertClone(): never {
1069
+ halt("assertClone");
1070
+ }
1071
+ Object.assign(assertClone, Namespace.assert("assertClone"));
1072
+ Object.assign(assertClone, Namespace.clone("assertClone"));
1073
+
1074
+ /**
1075
+ * Clone a data with type checking.
1076
+ *
1077
+ * Clones an instance following type `T`, with type checking. If the target `input`
1078
+ * value or its member variable contains a class instance that is having a `toJSON()`
1079
+ * method, its return value would be cloned.
1080
+ *
1081
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1082
+ * `null` value instead. Otherwise, there's no problem on the `input` value, cloned
1083
+ * data would be returned.
1084
+ *
1085
+ * @template T Type of the input value
1086
+ * @param input A value to be cloned
1087
+ * @return Cloned data when exact type, otherwise null
1088
+ *
1089
+ * @author Jeongho Nam - https://github.com/samchon
1090
+ */
1091
+ export function isClone<T>(input: T): Primitive<T> | null;
1092
+
1093
+ /**
1094
+ * Clone a data with type checking.
1095
+ *
1096
+ * Clones an instance following type `T`, with type checking. If the target `input`
1097
+ * value or its member variable contains a class instance that is having a `toJSON()`
1098
+ * method, its return value would be cloned.
1099
+ *
1100
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1101
+ * `null` value instead. Otherwise, there's no problem on the `input` value, cloned
1102
+ * data would be returned.
1103
+ *
1104
+ * @template T Type of the input value
1105
+ * @param input A value to be cloned
1106
+ * @return Cloned data when exact type, otherwise null
1107
+ *
1108
+ * @author Jeongho Nam - https://github.com/samchon
1109
+ */
1110
+ export function isClone<T>(input: unknown): Primitive<T> | null;
1111
+
1112
+ /**
1113
+ * @internal
1114
+ */
1115
+ export function isClone(): never {
1116
+ halt("isClone");
1117
+ }
1118
+ Object.assign(isClone, Namespace.is());
1119
+ Object.assign(isClone, Namespace.clone("isClone"));
1120
+
1121
+ /**
1122
+ * Clone a data with detailed type validation.
1123
+ *
1124
+ * Clones an instance following type `T`, with detailed type validation. If the target
1125
+ * `input` value or its member variable contains a class instance that is having a
1126
+ * `toJSON()` method, its return value would be cloned.
1127
+ *
1128
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1129
+ * {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
1130
+ * value, cloned data would be stored in `data` property of the output
1131
+ * {@link IValidation.Success} instance.
1132
+ *
1133
+ * @template T Type of the input value
1134
+ * @param input A value to be cloned
1135
+ * @returns Validation result with cloned value
1136
+ */
1137
+ export function validateClone<T>(input: T): IValidation<Primitive<T>>;
1138
+
1139
+ /**
1140
+ * Clone a data with detailed type validation.
1141
+ *
1142
+ * Clones an instance following type `T`, with detailed type validation. If the target
1143
+ * `input` value or its member variable contains a class instance that is having a
1144
+ * `toJSON()` method, its return value would be cloned.
1145
+ *
1146
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1147
+ * {@link IValidation.Failure} value. Otherwise, there's no problem on the `input`
1148
+ * value, cloned data would be stored in `data` property of the output
1149
+ * {@link IValidation.Success} instance.
1150
+ *
1151
+ * @template T Type of the input value
1152
+ * @param input A value to be cloned
1153
+ * @returns Validation result with cloned value
1154
+ */
1155
+ export function validateClone<T>(input: unknown): IValidation<Primitive<T>>;
1156
+
1157
+ /**
1158
+ * @internal
1159
+ */
1160
+ export function validateClone(): never {
1161
+ halt("validateClone");
1162
+ }
1163
+ Object.assign(validateClone, Namespace.validate());
1164
+ Object.assign(validateClone, Namespace.clone("validateClone"));
1165
+
1166
+ /**
1167
+ * Prune, erase superfluous properties.
1168
+ *
1169
+ * Remove every superfluous properties from the `input` object, even including nested
1170
+ * objects. Note that, as every superfluous properties would be deleted, you never can
1171
+ * read those superfluous properties after calling this `prune()` function.
1172
+ *
1173
+ * For reference, this `typia.prune()` function does not validate the input value type.
1174
+ * It just believes that the input value is following the type `T`. Therefore, if you
1175
+ * can't ensure the input value type, it would better to call one of below functions
1176
+ * instead.
1177
+ *
1178
+ * - {@link assertPrune}
1179
+ * - {@link isPrune}
1180
+ * - {@link validatePrune}
1181
+ *
1182
+ * @template T Type of the input value
1183
+ * @param input Target instance to prune
1184
+ *
1185
+ * @author Jeongho Nam - https://github.com/samchon
1186
+ */
1187
+ export function prune<T extends object>(input: T): void;
1188
+
1189
+ /**
1190
+ * @internal
1191
+ */
1192
+ export function prune(): never {
1193
+ halt("prune");
1194
+ }
1195
+ Object.assign(prune, Namespace.prune("prune"));
1196
+
1197
+ /**
1198
+ * Prune, erase superfluous properties, with type assertion.
1199
+ *
1200
+ * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1201
+ * Therefore, it removes every superfluous properties from the `input` object including
1202
+ * nested objects, with type assertion.
1203
+ *
1204
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1205
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1206
+ * every superfluous properties would be removed, including nested objects.
1207
+ *
1208
+ * @template T Type of the input value
1209
+ * @param input Target instance to assert and prune
1210
+ *
1211
+ * @author Jeongho Nam - https://github.com/samchon
1212
+ */
1213
+ export function assertPrune<T>(input: T): T;
1214
+
1215
+ /**
1216
+ * Prune, erase superfluous properties, with type assertion.
1217
+ *
1218
+ * `typia.assertPrune()` is a combination function of {@link assert} and {@link prune}.
1219
+ * Therefore, it removes every superfluous properties from the `input` object including
1220
+ * nested objects, with type assertion.
1221
+ *
1222
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
1223
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, its
1224
+ * every superfluous properties would be removed, including nested objects.
1225
+ *
1226
+ * @template T Type of the input value
1227
+ * @param input Target instance to assert and prune
1228
+ *
1229
+ * @author Jeongho Nam - https://github.com/samchon
1230
+ */
1231
+ export function assertPrune<T>(input: unknown): T;
1232
+
1233
+ /**
1234
+ * @internal
1235
+ */
1236
+ export function assertPrune(): unknown {
1237
+ halt("assertPrune");
1238
+ }
1239
+ Object.assign(assertPrune, Namespace.assert("assertPrune"));
1240
+ Object.assign(assertPrune, Namespace.prune("assertPrune"));
1241
+
1242
+ /**
1243
+ * Prune, erase superfluous properties, with type checking.
1244
+ *
1245
+ * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1246
+ * Therefore, it removes every superfluous properties from the `input` object including
1247
+ * nested objects, with type checking.
1248
+ *
1249
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1250
+ * `false` value. Otherwise, there's no problem on the `input` value, it returns
1251
+ * `true` after removing every superfluous properties, including nested objects.
1252
+ *
1253
+ * @template T Type of the input value
1254
+ * @param input Target instance to check and prune
1255
+ * @returns Whether the parametric value is following the type `T` or not
1256
+ *
1257
+ * @author Jeongho Nam - https://github.com/samchon
1258
+ */
1259
+ export function isPrune<T>(input: T): input is T;
1260
+
1261
+ /**
1262
+ * Prune, erase superfluous properties, with type checking.
1263
+ *
1264
+ * `typia.assertPrune()` is a combination function of {@link is} and {@link prune}.
1265
+ * Therefore, it removes every superfluous properties from the `input` object including
1266
+ * nested objects, with type checking.
1267
+ *
1268
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1269
+ * `false` value. Otherwise, there's no problem on the `input` value, it returns
1270
+ * `true` after removing every superfluous properties, including nested objects.
1271
+ *
1272
+ * @template T Type of the input value
1273
+ * @param input Target instance to check and prune
1274
+ * @returns Whether the parametric value is following the type `T` or not
1275
+ *
1276
+ * @author Jeongho Nam - https://github.com/samchon
1277
+ */
1278
+ export function isPrune<T>(input: unknown): input is T;
1279
+
1280
+ /**
1281
+ * @internal
1282
+ */
1283
+ export function isPrune(): never {
1284
+ halt("isPrune");
1285
+ }
1286
+ Object.assign(isPrune, Namespace.is());
1287
+ Object.assign(isPrune, Namespace.prune("isPrune"));
1288
+
1289
+ /**
1290
+ * Prune, erase superfluous properties, with type validation.
1291
+ *
1292
+ * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1293
+ * Therefore, it removes every superfluous properties from the `input` object including
1294
+ * nested objects, with type validation.
1295
+ *
1296
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1297
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1298
+ * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1299
+ * removing every superfluous properties, including nested objects.
1300
+ *
1301
+ * @template T Type of the input value
1302
+ * @param input Target instance to validate and prune
1303
+ * @returns Validation result
1304
+ *
1305
+ * @author Jeongho Nam - https://github.com/samchon
1306
+ */
1307
+ export function validatePrune<T>(input: T): IValidation<T>;
1308
+
1309
+ /**
1310
+ * Prune, erase superfluous properties, with type validation.
1311
+ *
1312
+ * `typia.validatePrune()` is a combination function of {@link validate} and {@link prune}.
1313
+ * Therefore, it removes every superfluous properties from the `input` object including
1314
+ * nested objects, with type validation.
1315
+ *
1316
+ * In such reason, when `input` value is not matched with the type `T`, it returns
1317
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
1318
+ * no problem on the `input` value, it returns {@link IValidation.ISucess} value after
1319
+ * removing every superfluous properties, including nested objects.
1320
+ *
1321
+ * @template T Type of the input value
1322
+ * @param input Target instance to validate and prune
1323
+ * @returns Validation result
1324
+ *
1325
+ * @author Jeongho Nam - https://github.com/samchon
1326
+ */
1327
+ export function validatePrune<T>(input: unknown): IValidation<T>;
1328
+
1329
+ /**
1330
+ * @internal
1331
+ */
1332
+ export function validatePrune<T>(): IValidation<T> {
1333
+ halt("validatePrune");
1334
+ }
1335
+ Object.assign(validatePrune, Namespace.prune("validatePrune"));
1336
+ Object.assign(validatePrune, Namespace.validate());
1337
+
1338
+ /* ===========================================================
1339
+ FACTORY FUNCTIONS
1340
+ - BASIC VALIDATORS
1341
+ - STRICT VALIDATORS
1342
+ - JSON FUNCTIONS
1343
+ - MISCELLANEOUS
1344
+ ==============================================================
1345
+ BASIC VALIDATORS
1346
+ ----------------------------------------------------------- */
1347
+ /**
1348
+ * Creates a reusable {@link assert} function.
1349
+ *
1350
+ * @danger You have to specify the generic argument `T`
1351
+ * @return Nothing until specifying the generic argument `T`
1352
+ * @throws compile error
1353
+ *
1354
+ * @author Jeongho Nam - https://github.com/samchon
1355
+ */
1356
+ export function createAssert(): never;
1357
+
1358
+ /**
1359
+ * Creates a reusable {@link assert} function.
1360
+ *
1361
+ * @template T Type of the input value
1362
+ * @returns A reusable `assert` function
1363
+ *
1364
+ * @author Jeongho Nam - https://github.com/samchon
1365
+ */
1366
+ export function createAssert<T>(): (input: unknown) => T;
1367
+
1368
+ /**
1369
+ * @internal
1370
+ */
1371
+ export function createAssert<T>(): (input: unknown) => T {
1372
+ halt("createAssert");
1373
+ }
1374
+ Object.assign(createAssert, assert);
1375
+
1376
+ /**
1377
+ * Creates a reusable {@link assertType} function.
1378
+ *
1379
+ * Duplicated function of {@link createAssert} for `typescript-is` users.
1380
+ *
1381
+ * @danger You have to specify the generic argument `T`
1382
+ * @return Nothing until specifying the generic argument `T`
1383
+ * @throws compile error
1384
+ *
1385
+ * @author Jeongho Nam - https://github.com/samchon
1386
+ * @deprecated
1387
+ */
1388
+ export function createAssertType(): never;
1389
+
1390
+ /**
1391
+ * Creates a reusable {@link assertType} function.
1392
+ *
1393
+ * Duplicated function of {@link createAssert} for `typescript-is` users.
1394
+ *
1395
+ * @template T Type of the input value
1396
+ * @returns A reusable `assert` function
1397
+ *
1398
+ * @author Jeongho Nam - https://github.com/samchon
1399
+ * @deprecated
1400
+ */
1401
+ export function createAssertType<T>(): (input: unknown) => T;
1402
+
1403
+ /**
1404
+ * @internal
1405
+ */
1406
+ export function createAssertType<T>(): (input: unknown) => T {
1407
+ halt("createAssertType");
1408
+ }
1409
+ Object.assign(createAssertType, assertType);
1410
+
1411
+ /**
1412
+ * Creates a reusable {@link is} function.
1413
+ *
1414
+ * @danger You have to specify the generic argument `T`
1415
+ * @return Nothing until specifying the generic argument `T`
1416
+ * @throws compile error
1417
+ *
1418
+ * @author Jeongho Nam - https://github.com/samchon
1419
+ */
1420
+ export function createIs(): never;
1421
+
1422
+ /**
1423
+ * Creates a reusable {@link is} function.
1424
+ *
1425
+ * @template T Type of the input value
1426
+ * @returns A reusable `is` function
1427
+ *
1428
+ * @author Jeongho Nam - https://github.com/samchon
1429
+ */
1430
+ export function createIs<T>(): (input: unknown) => input is T;
1431
+
1432
+ /**
1433
+ * @internal
1434
+ */
1435
+ export function createIs<T>(): (input: unknown) => input is T {
1436
+ halt("createIs");
1437
+ }
1438
+ Object.assign(createIs, is);
1439
+
1440
+ /**
1441
+ * Creates a reusable {@link validate} function.
1442
+ *
1443
+ * @danger You have to specify the generic argument `T`
1444
+ * @return Nothing until specifying the generic argument `T`
1445
+ * @throws compile error
1446
+ *
1447
+ * @author Jeongho Nam - https://github.com/samchon
1448
+ */
1449
+ export function createValidate(): never;
1450
+
1451
+ /**
1452
+ * Creates a reusable {@link validate} function.
1453
+ *
1454
+ * @template T Type of the input value
1455
+ * @returns A reusable `validate` function
1456
+ *
1457
+ * @author Jeongho Nam - https://github.com/samchon
1458
+ */
1459
+ export function createValidate<T>(): (input: unknown) => IValidation<T>;
1460
+
1461
+ /**
1462
+ * @internal
1463
+ */
1464
+ export function createValidate(): (input: unknown) => IValidation {
1465
+ halt("createValidate");
1466
+ }
1467
+ Object.assign(createValidate, validate);
1468
+
1469
+ /* -----------------------------------------------------------
1470
+ STRICT VALIDATORS
1471
+ ----------------------------------------------------------- */
1472
+ /**
1473
+ * Creates a reusable {@link assertEquals} function.
1474
+ *
1475
+ * @danger You have to specify the generic argument `T`
1476
+ * @return Nothing until specifying the generic argument `T`
1477
+ * @throws compile error
1478
+ *
1479
+ * @author Jeongho Nam - https://github.com/samchon
1480
+ */
1481
+ export function createAssertEquals(): never;
1482
+
1483
+ /**
1484
+ * Creates a reusable {@link assertEquals} function.
1485
+ *
1486
+ * @template T Type of the input value
1487
+ * @returns A reusable `assertEquals` function
1488
+ *
1489
+ * @author Jeongho Nam - https://github.com/samchon
1490
+ */
1491
+ export function createAssertEquals<T>(): (input: unknown) => T;
1492
+
1493
+ /**
1494
+ * @internal
1495
+ */
1496
+ export function createAssertEquals<T>(): (input: unknown) => T {
1497
+ halt("createAssertEquals");
1498
+ }
1499
+ Object.assign(createAssertEquals, assertEquals);
1500
+
1501
+ /**
1502
+ * Creates a reusable {@link equals} function.
1503
+ *
1504
+ * @danger You have to specify the generic argument `T`
1505
+ * @return Nothing until specifying the generic argument `T`
1506
+ * @throws compile error
1507
+ *
1508
+ * @author Jeongho Nam - https://github.com/samchon
1509
+ */
1510
+ export function createEquals(): never;
1511
+
1512
+ /**
1513
+ * Creates a reusable {@link equals} function.
1514
+ *
1515
+ * @template T Type of the input value
1516
+ * @returns A reusable `equals` function
1517
+ *
1518
+ * @author Jeongho Nam - https://github.com/samchon
1519
+ */
1520
+ export function createEquals<T>(): (input: unknown) => input is T;
1521
+
1522
+ /**
1523
+ * @internal
1524
+ */
1525
+ export function createEquals<T>(): (input: unknown) => input is T {
1526
+ halt("createEquals");
1527
+ }
1528
+ Object.assign(createEquals, equals);
1529
+
1530
+ /**
1531
+ * Creates a reusable {@link validateEquals} function.
1532
+ *
1533
+ * @danger You have to specify the generic argument `T`
1534
+ * @return Nothing until specifying the generic argument `T`
1535
+ * @throws compile error
1536
+ *
1537
+ * @author Jeongho Nam - https://github.com/samchon
1538
+ */
1539
+ export function createValidateEquals(): never;
1540
+
1541
+ /**
1542
+ * Creates a reusable {@link validateEquals} function.
1543
+ *
1544
+ * @template T Type of the input value
1545
+ * @returns A reusable `validateEquals` function
1546
+ *
1547
+ * @author Jeongho Nam - https://github.com/samchon
1548
+ */
1549
+ export function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
1550
+
1551
+ /**
1552
+ * @internal
1553
+ */
1554
+ export function createValidateEquals(): (input: unknown) => IValidation {
1555
+ halt("createValidateEquals");
1556
+ }
1557
+ Object.assign(createValidateEquals, validateEquals);
1558
+
1559
+ /* -----------------------------------------------------------
1560
+ JSON FUNCTIONS
1561
+ ----------------------------------------------------------- */
1562
+ /**
1563
+ * Creates a reusable {@link isParse} function.
1564
+ *
1565
+ * @danger You have to specify the generic argument `T`
1566
+ * @return Nothing until specifying the generic argument `T`
1567
+ * @throws compile error
1568
+ *
1569
+ * @author Jeongho Nam - https://github.com/samchon
1570
+ */
1571
+ export function createIsParse(): never;
1572
+
1573
+ /**
1574
+ * Creates a reusable {@link isParse} function.
1575
+ *
1576
+ * @template T Expected type of parsed value
1577
+ * @returns A reusable `isParse` function
1578
+ *
1579
+ * @author Jeongho Nam - https://github.com/samchon
1580
+ */
1581
+ export function createIsParse<T>(): (input: string) => Primitive<T> | null;
1582
+
1583
+ /**
1584
+ * @internal
1585
+ */
1586
+ export function createIsParse<T>(): (input: string) => Primitive<T> | null {
1587
+ halt("createIsParse");
1588
+ }
1589
+ Object.assign(createIsParse, isParse);
1590
+
1591
+ /**
1592
+ * Creates a reusable {@link assertParse} function.
1593
+ *
1594
+ * @danger You have to specify the generic argument `T`
1595
+ * @return Nothing until specifying the generic argument `T`
1596
+ * @throws compile error
1597
+ *
1598
+ * @author Jeongho Nam - https://github.com/samchon
1599
+ */
1600
+ export function createAssertParse(): never;
1601
+
1602
+ /**
1603
+ * Creates a reusable {@link assertParse} function.
1604
+ *
1605
+ * @template T Expected type of parsed value
1606
+ * @returns A reusable `assertParse` function
1607
+ *
1608
+ * @author Jeongho Nam - https://github.com/samchon
1609
+ */
1610
+ export function createAssertParse<T>(): (input: string) => Primitive<T>;
1611
+
1612
+ /**
1613
+ * @internal
1614
+ */
1615
+ export function createAssertParse<T>(): (input: string) => Primitive<T> {
1616
+ halt("createAssertParse");
1617
+ }
1618
+ Object.assign(createAssertParse, assertParse);
1619
+
1620
+ /**
1621
+ * Creates a reusable {@link validateParse} function.
1622
+ *
1623
+ * @danger You have to specify the generic argument `T`
1624
+ * @return Nothing until specifying the generic argument `T`
1625
+ * @throws compile error
1626
+ *
1627
+ * @author Jeongho Nam - https://github.com/samchon
1628
+ */
1629
+ export function createValidateParse(): never;
1630
+
1631
+ /**
1632
+ * Creates a reusable {@link validateParse} function.
1633
+ *
1634
+ * @template T Expected type of parsed value
1635
+ * @returns A reusable `validateParse` function
1636
+ *
1637
+ * @author Jeongho Nam - https://github.com/samchon
1638
+ */
1639
+ export function createValidateParse<T>(): (
1640
+ input: string,
1641
+ ) => IValidation<Primitive<T>>;
1642
+
1643
+ /**
1644
+ * @internal
1645
+ */
1646
+ export function createValidateParse<T>(): (
1647
+ input: string,
1648
+ ) => IValidation<Primitive<T>> {
1649
+ halt("createValidateParse");
1650
+ }
1651
+ Object.assign(createValidateParse, validateParse);
1652
+
1653
+ /**
1654
+ * Creates a reusable {@link stringify} function.
1655
+ *
1656
+ * @danger You have to specify the generic argument `T`
1657
+ * @return Nothing until specifying the generic argument `T`
1658
+ * @throws compile error
1659
+ *
1660
+ * @author Jeongho Nam - https://github.com/samchon
1661
+ */
1662
+ export function createStringify(): never;
1663
+
1664
+ /**
1665
+ * Creates a reusable {@link stringify} function.
1666
+ *
1667
+ * @template T Type of the input value
1668
+ * @returns A reusable `stringify` function
1669
+ *
1670
+ * @author Jeongho Nam - https://github.com/samchon
1671
+ */
1672
+ export function createStringify<T>(): (input: T) => string;
1673
+
1674
+ /**
1675
+ * @internal
1676
+ */
1677
+ export function createStringify<T>(): (input: T) => string {
1678
+ halt("createStringify");
1679
+ }
1680
+ Object.assign(createStringify, stringify);
1681
+
1682
+ /**
1683
+ * Creates a reusable {@link assertStringify} function.
1684
+ *
1685
+ * @danger You have to specify the generic argument `T`
1686
+ * @return Nothing until specifying the generic argument `T`
1687
+ * @throws compile error
1688
+ *
1689
+ * @author Jeongho Nam - https://github.com/samchon
1690
+ */
1691
+ export function createAssertStringify(): never;
1692
+
1693
+ /**
1694
+ * Creates a reusable {@link assertStringify} function.
1695
+ *
1696
+ * @template T Type of the input value
1697
+ * @returns A reusable `assertStringify` function
1698
+ *
1699
+ * @author Jeongho Nam - https://github.com/samchon
1700
+ */
1701
+ export function createAssertStringify<T>(): (input: unknown) => string;
1702
+
1703
+ /**
1704
+ * @internal
1705
+ */
1706
+ export function createAssertStringify(): (input: unknown) => string {
1707
+ halt("createAssertStringify");
1708
+ }
1709
+ Object.assign(createAssertStringify, assertStringify);
1710
+
1711
+ /**
1712
+ * Creates a reusable {@link isStringify} function.
1713
+ *
1714
+ * @danger You have to specify the generic argument `T`
1715
+ * @return Nothing until specifying the generic argument `T`
1716
+ * @throws compile error
1717
+ *
1718
+ * @author Jeongho Nam - https://github.com/samchon
1719
+ */
1720
+ export function createIsStringify(): never;
1721
+
1722
+ /**
1723
+ * Creates a reusable {@link isStringify} function.
1724
+ *
1725
+ * @template T Type of the input value
1726
+ * @returns A reusable `isStringify` function
1727
+ *
1728
+ * @author Jeongho Nam - https://github.com/samchon
1729
+ */
1730
+ export function createIsStringify<T>(): (input: unknown) => string | null;
1731
+
1732
+ /**
1733
+ * @internal
1734
+ */
1735
+ export function createIsStringify(): (input: unknown) => string | null {
1736
+ halt("createIsStringify");
1737
+ }
1738
+ Object.assign(createIsStringify, isStringify);
1739
+
1740
+ /**
1741
+ * Creates a reusable {@link validateStringify} function.
1742
+ *
1743
+ * @danger You have to specify the generic argument `T`
1744
+ * @return Nothing until specifying the generic argument `T`
1745
+ * @throws compile error
1746
+ *
1747
+ * @author Jeongho Nam - https://github.com/samchon
1748
+ */
1749
+ export function createValidateStringify(): never;
1750
+
1751
+ /**
1752
+ * Creates a reusable {@link validateStringify} function.
1753
+ *
1754
+ * @template T Type of the input value
1755
+ * @returns A reusable `validateStringify` function
1756
+
1757
+ * @author Jeongho Nam - https://github.com/samchon
1758
+ */
1759
+ export function createValidateStringify<T>(): (
1760
+ input: unknown,
1761
+ ) => IValidation<string>;
1762
+
1763
+ /**
1764
+ * @internal
1765
+ */
1766
+ export function createValidateStringify(): (
1767
+ input: unknown,
1768
+ ) => IValidation<string> {
1769
+ halt("createValidateStringify");
1770
+ }
1771
+ Object.assign(createValidateStringify, validateStringify);
1772
+
1773
+ /* -----------------------------------------------------------
1774
+ MISCELLANEOUS
1775
+ ----------------------------------------------------------- */
1776
+ /**
1777
+ * Creates a reusable {@link random} function.
1778
+ *
1779
+ * @danger You have to specify the generic argument `T`
1780
+ * @param generator Random data generator
1781
+ * @return Nothing until specifying the generic argument `T`
1782
+ * @throws compile error
1783
+ *
1784
+ * @author Jeongho Nam - https://github.com/samchon
1785
+ */
1786
+ export function createRandom(generator?: Partial<IRandomGenerator>): never;
1787
+
1788
+ /**
1789
+ * Creates a resuable {@link random} function.
1790
+ *
1791
+ * @template T Type of the input value
1792
+ * @param generator Random data generator
1793
+ * @returns A reusable `random` function
1794
+ *
1795
+ * @author Jeongho Nam - https://github.com/samchon
1796
+ */
1797
+ export function createRandom<T>(
1798
+ generator?: Partial<IRandomGenerator>,
1799
+ ): () => Primitive<T>;
1800
+
1801
+ /**
1802
+ * @internal
1803
+ */
1804
+ export function createRandom(): never {
1805
+ halt("createRandom");
1806
+ }
1807
+ Object.assign(createRandom, random);
1808
+
1809
+ /**
1810
+ * Creates a reusable {@link clone} function.
1811
+ *
1812
+ * @danger You have to specify the generic argument `T`
1813
+ * @return Nothing until specifying the generic argument `T`
1814
+ * @throws compile error
1815
+ *
1816
+ * @author Jeongho Nam - https://github.com/samchon
1817
+ */
1818
+ export function createClone(): never;
1819
+
1820
+ /**
1821
+ * Creates a resuable {@link clone} function.
1822
+ *
1823
+ * @template T Type of the input value
1824
+ * @returns A reusable `clone` function
1825
+ *
1826
+ * @author Jeongho Nam - https://github.com/samchon
1827
+ */
1828
+ export function createClone<T>(): (input: T) => Primitive<T>;
1829
+
1830
+ /**
1831
+ * @internal
1832
+ */
1833
+ export function createClone(): never {
1834
+ halt("createClone");
1835
+ }
1836
+ Object.assign(createClone, clone);
1837
+
1838
+ /**
1839
+ * Creates a reusable {@link assertClone} function.
1840
+ *
1841
+ * @danger You have to specify the generic argument `T`
1842
+ * @return Nothing until specifying the generic argument `T`
1843
+ * @throws compile error
1844
+ *
1845
+ * @author Jeongho Nam - https://github.com/samchon
1846
+ */
1847
+ export function createAssertClone(): never;
1848
+
1849
+ /**
1850
+ * Creates a resuable {@link assertClone} function.
1851
+ *
1852
+ * @template T Type of the input value
1853
+ * @returns A reusable `clone` function
1854
+ *
1855
+ * @author Jeongho Nam - https://github.com/samchon
1856
+ */
1857
+ export function createAssertClone<T>(): (input: unknown) => Primitive<T>;
1858
+
1859
+ /**
1860
+ * @internal
1861
+ */
1862
+ export function createAssertClone(): never {
1863
+ halt("createAssertClone");
1864
+ }
1865
+ Object.assign(createAssertClone, assertClone);
1866
+
1867
+ /**
1868
+ * Creates a reusable {@link isClone} function.
1869
+ *
1870
+ * @danger You have to specify the generic argument `T`
1871
+ * @return Nothing until specifying the generic argument `T`
1872
+ * @throws compile error
1873
+ *
1874
+ * @author Jeongho Nam - https://github.com/samchon
1875
+ */
1876
+ export function createIsClone(): never;
1877
+
1878
+ /**
1879
+ * Creates a resuable {@link isClone} function.
1880
+ *
1881
+ * @template T Type of the input value
1882
+ * @returns A reusable `clone` function
1883
+ *
1884
+ * @author Jeongho Nam - https://github.com/samchon
1885
+ */
1886
+ export function createIsClone<T>(): (input: unknown) => Primitive<T> | null;
1887
+
1888
+ /**
1889
+ * @internal
1890
+ */
1891
+ export function createIsClone(): never {
1892
+ halt("createIsClone");
1893
+ }
1894
+ Object.assign(createIsClone, isClone);
1895
+
1896
+ /**
1897
+ * Creates a reusable {@link validateClone} function.
1898
+ *
1899
+ * @danger You have to specify the generic argument `T`
1900
+ * @return Nothing until specifying the generic argument `T`
1901
+ * @throws compile error
1902
+ *
1903
+ * @author Jeongho Nam - https://github.com/samchon
1904
+ */
1905
+ export function createValidateClone(): never;
1906
+
1907
+ /**
1908
+ * Creates a resuable {@link validateClone} function.
1909
+ *
1910
+ * @template T Type of the input value
1911
+ * @returns A reusable `clone` function
1912
+ *
1913
+ * @author Jeongho Nam - https://github.com/samchon
1914
+ */
1915
+ export function createValidateClone<T>(): (
1916
+ input: unknown,
1917
+ ) => IValidation<Primitive<T>>;
1918
+
1919
+ /**
1920
+ * @internal
1921
+ */
1922
+ export function createValidateClone(): never {
1923
+ halt("createValidateClone");
1924
+ }
1925
+ Object.assign(createValidateClone, validateClone);
1926
+
1927
+ /**
1928
+ * Creates a reusable {@link prune} function.
1929
+ *
1930
+ * @danger You have to specify the generic argument `T`
1931
+ * @return Nothing until specifying the generic argument `T`
1932
+ * @throws compile error
1933
+ *
1934
+ * @author Jeongho Nam - https://github.com/samchon
1935
+ */
1936
+ export function createPrune(): never;
1937
+
1938
+ /**
1939
+ * Creates a resuable {@link prune} function.
1940
+ *
1941
+ * @template T Type of the input value
1942
+ * @returns A reusable `prune` function
1943
+ *
1944
+ * @author Jeongho Nam - https://github.com/samchon
1945
+ */
1946
+ export function createPrune<T extends object>(): (input: T) => void;
1947
+
1948
+ /**
1949
+ * @internal
1950
+ */
1951
+ export function createPrune<T extends object>(): (input: T) => void {
1952
+ halt("createPrune");
1953
+ }
1954
+ Object.assign(createPrune, prune);
1955
+
1956
+ /**
1957
+ * Creates a reusable {@link assertPrune} function.
1958
+ *
1959
+ * @danger You have to specify the generic argument `T`
1960
+ * @return Nothing until specifying the generic argument `T`
1961
+ * @throws compile error
1962
+ *
1963
+ * @author Jeongho Nam - https://github.com/samchon
1964
+ */
1965
+ export function createAssertPrune(): never;
1966
+
1967
+ /**
1968
+ * Creates a resuable {@link assertPrune} function.
1969
+ *
1970
+ * @template T Type of the input value
1971
+ * @returns A reusable `isPrune` function
1972
+ *
1973
+ * @author Jeongho Nam - https://github.com/samchon
1974
+ */
1975
+ export function createAssertPrune<T extends object>(): (input: T) => T;
1976
+
1977
+ /**
1978
+ * @internal
1979
+ */
1980
+ export function createAssertPrune<T extends object>(): (input: T) => T {
1981
+ halt("createAssertPrune");
1982
+ }
1983
+ Object.assign(createAssertPrune, assertPrune);
1984
+
1985
+ /**
1986
+ * Creates a reusable {@link isPrune} function.
1987
+ *
1988
+ * @danger You have to specify the generic argument `T`
1989
+ * @return Nothing until specifying the generic argument `T`
1990
+ * @throws compile error
1991
+ *
1992
+ * @author Jeongho Nam - https://github.com/samchon
1993
+ */
1994
+ export function createIsPrune(): never;
1995
+
1996
+ /**
1997
+ * Creates a resuable {@link isPrune} function.
1998
+ *
1999
+ * @template T Type of the input value
2000
+ * @returns A reusable `isPrune` function
2001
+ *
2002
+ * @author Jeongho Nam - https://github.com/samchon
2003
+ */
2004
+ export function createIsPrune<T extends object>(): (input: T) => input is T;
2005
+
2006
+ /**
2007
+ * @internal
2008
+ */
2009
+ export function createIsPrune<T extends object>(): (input: T) => input is T {
2010
+ halt("createIsPrune");
2011
+ }
2012
+ Object.assign(createIsPrune, isPrune);
2013
+
2014
+ /**
2015
+ * Creates a reusable {@link validatePrune} function.
2016
+ *
2017
+ * @danger You have to specify the generic argument `T`
2018
+ * @return Nothing until specifying the generic argument `T`
2019
+ * @throws compile error
2020
+ *
2021
+ * @author Jeongho Nam - https://github.com/samchon
2022
+ */
2023
+ export function createValidatePrune(): never;
2024
+
2025
+ /**
2026
+ * Creates a resuable {@link validatePrune} function.
2027
+ *
2028
+ * @template T Type of the input value
2029
+ * @returns A reusable `validatePrune` function
2030
+ *
2031
+ * @author Jeongho Nam - https://github.com/samchon
2032
+ */
2033
+ export function createValidatePrune<T extends object>(): (
2034
+ input: T,
2035
+ ) => IValidation<T>;
2036
+
2037
+ /**
2038
+ * @internal
2039
+ */
2040
+ export function createValidatePrune<T extends object>(): (
2041
+ input: T,
2042
+ ) => IValidation<T> {
2043
+ halt("createValidatePrune");
2044
+ }
2045
+ Object.assign(createValidatePrune, validatePrune);
2046
+
2047
+ /**
2048
+ * @internal
2049
+ */
2050
+ function halt(name: string): never {
2051
+ throw new Error(
2052
+ `Error on typia.${name}(): no transform has been configured. Run "npx typia setup" command.`,
2053
+ );
2054
+ }