typia 5.5.8 → 5.5.9

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 (358) hide show
  1. package/lib/tags/ContentMediaType.d.ts +9 -0
  2. package/lib/tags/ContentMediaType.js +3 -0
  3. package/lib/tags/ContentMediaType.js.map +1 -0
  4. package/lib/tags/JsonSchemaPlugin.d.ts +7 -0
  5. package/lib/tags/JsonSchemaPlugin.js +3 -0
  6. package/lib/tags/JsonSchemaPlugin.js.map +1 -0
  7. package/lib/tags/index.d.ts +2 -0
  8. package/lib/tags/index.js +2 -0
  9. package/lib/tags/index.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/AssertionGuard.ts +1 -1
  12. package/src/IRandomGenerator.ts +62 -62
  13. package/src/IValidation.ts +21 -21
  14. package/src/TypeGuardError.ts +36 -36
  15. package/src/executable/TypiaGenerateWizard.ts +83 -83
  16. package/src/executable/TypiaPatchWizard.ts +42 -42
  17. package/src/executable/setup/ArgumentParser.ts +43 -43
  18. package/src/executable/setup/CommandExecutor.ts +8 -8
  19. package/src/executable/setup/FileRetriever.ts +22 -22
  20. package/src/executable/setup/PackageManager.ts +71 -71
  21. package/src/executable/setup/PluginConfigurator.ts +69 -69
  22. package/src/executable/typia.ts +55 -55
  23. package/src/factories/CommentFactory.ts +79 -79
  24. package/src/factories/ExpressionFactory.ts +150 -150
  25. package/src/factories/IdentifierFactory.ts +70 -70
  26. package/src/factories/JsonMetadataFactory.ts +53 -53
  27. package/src/factories/LiteralFactory.ts +47 -47
  28. package/src/factories/MetadataCollection.ts +260 -260
  29. package/src/factories/MetadataCommentTagFactory.ts +516 -516
  30. package/src/factories/MetadataFactory.ts +267 -267
  31. package/src/factories/MetadataTypeTagFactory.ts +332 -332
  32. package/src/factories/MetadataTypeTagSchemaFactory.ts +58 -58
  33. package/src/factories/NumericRangeFactory.ts +72 -72
  34. package/src/factories/ProtobufFactory.ts +267 -267
  35. package/src/factories/StatementFactory.ts +72 -72
  36. package/src/factories/TemplateFactory.ts +56 -56
  37. package/src/factories/ValueFactory.ts +12 -12
  38. package/src/factories/internal/metadata/MetadataHelper.ts +15 -15
  39. package/src/factories/internal/metadata/emend_metadata_atomics.ts +46 -46
  40. package/src/factories/internal/metadata/emplace_metadata_alias.ts +41 -41
  41. package/src/factories/internal/metadata/emplace_metadata_array_type.ts +38 -38
  42. package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -176
  43. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +57 -57
  44. package/src/factories/internal/metadata/explore_metadata.ts +28 -28
  45. package/src/factories/internal/metadata/iterate_metadata_alias.ts +34 -34
  46. package/src/factories/internal/metadata/iterate_metadata_array.ts +70 -70
  47. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
  48. package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
  49. package/src/factories/internal/metadata/iterate_metadata_collection.ts +131 -131
  50. package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +26 -26
  51. package/src/factories/internal/metadata/iterate_metadata_constant.ts +48 -48
  52. package/src/factories/internal/metadata/iterate_metadata_escape.ts +52 -52
  53. package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
  54. package/src/factories/internal/metadata/iterate_metadata_native.ts +209 -209
  55. package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -33
  56. package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
  57. package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
  58. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +37 -37
  59. package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
  60. package/src/functional/$FormDataReader/index.ts +1 -1
  61. package/src/functional/$HeadersReader/index.ts +1 -1
  62. package/src/functional/$ParameterReader/index.ts +1 -1
  63. package/src/functional/$ProtobufReader.ts +195 -195
  64. package/src/functional/$ProtobufWriter.ts +150 -150
  65. package/src/functional/$QueryReader/index.ts +1 -1
  66. package/src/functional/$any.ts +4 -4
  67. package/src/functional/$clone.ts +4 -4
  68. package/src/functional/$convention.ts +37 -37
  69. package/src/functional/$dictionary.ts +22 -22
  70. package/src/functional/$every.ts +11 -11
  71. package/src/functional/$guard.ts +21 -21
  72. package/src/functional/$is_between.ts +2 -2
  73. package/src/functional/$join.ts +46 -46
  74. package/src/functional/$number.ts +12 -12
  75. package/src/functional/$report.ts +13 -13
  76. package/src/functional/$rest.ts +3 -3
  77. package/src/functional/$stoll.ts +8 -8
  78. package/src/functional/$string.ts +43 -43
  79. package/src/functional/$strlen.ts +7 -7
  80. package/src/functional/$tail.ts +5 -5
  81. package/src/functional/$throws.ts +10 -10
  82. package/src/functional/$varint.ts +130 -130
  83. package/src/functional/$zigzag.ts +39 -39
  84. package/src/functional/IProtobufWriter.ts +18 -18
  85. package/src/functional/Namespace/functional.ts +5 -5
  86. package/src/functional/Namespace/http.ts +9 -9
  87. package/src/functional/Namespace/index.ts +76 -76
  88. package/src/functional/Namespace/json.ts +15 -15
  89. package/src/functional/Namespace/misc.ts +14 -14
  90. package/src/functional/Namespace/notations.ts +23 -23
  91. package/src/functional/Namespace/protobuf.ts +20 -20
  92. package/src/functional/is.ts +10 -10
  93. package/src/functional.ts +872 -872
  94. package/src/http.ts +1266 -1266
  95. package/src/index.ts +4 -4
  96. package/src/json.ts +754 -754
  97. package/src/misc.ts +757 -757
  98. package/src/module.ts +1024 -1024
  99. package/src/notations.ts +1020 -1020
  100. package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +130 -130
  101. package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +81 -81
  102. package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +77 -77
  103. package/src/programmers/functional/FunctionalIsFunctionProgrammer.ts +61 -61
  104. package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +113 -113
  105. package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +203 -203
  106. package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +107 -107
  107. package/src/programmers/functional/internal/FunctionalGeneralProgrammer.ts +32 -32
  108. package/src/programmers/helpers/AtomicPredicator.ts +24 -24
  109. package/src/programmers/helpers/CloneJoiner.ts +130 -130
  110. package/src/programmers/helpers/FunctionImporeter.ts +1 -1
  111. package/src/programmers/helpers/FunctionImporter.ts +87 -87
  112. package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
  113. package/src/programmers/helpers/ICheckEntry.ts +13 -13
  114. package/src/programmers/helpers/IExpressionEntry.ts +12 -12
  115. package/src/programmers/helpers/NotationJoiner.ts +132 -132
  116. package/src/programmers/helpers/OptionPredicator.ts +15 -15
  117. package/src/programmers/helpers/ProtobufUtil.ts +125 -125
  118. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  119. package/src/programmers/helpers/PruneJoiner.ts +141 -141
  120. package/src/programmers/helpers/RandomJoiner.ts +140 -140
  121. package/src/programmers/helpers/RandomRanger.ts +171 -171
  122. package/src/programmers/helpers/StringifyJoinder.ts +105 -105
  123. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  124. package/src/programmers/helpers/UnionExplorer.ts +269 -269
  125. package/src/programmers/helpers/UnionPredicator.ts +77 -77
  126. package/src/programmers/http/HttpAssertFormDataProgrammer.ts +87 -87
  127. package/src/programmers/http/HttpAssertHeadersProgrammer.ts +89 -89
  128. package/src/programmers/http/HttpAssertQueryProgrammer.ts +87 -87
  129. package/src/programmers/http/HttpIsFormDataProgrammer.ts +90 -90
  130. package/src/programmers/http/HttpIsHeadersProgrammer.ts +92 -92
  131. package/src/programmers/http/HttpIsQueryProgrammer.ts +90 -90
  132. package/src/programmers/http/HttpParameterProgrammer.ts +97 -97
  133. package/src/programmers/http/HttpValidateFormDataProgrammer.ts +75 -75
  134. package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
  135. package/src/programmers/http/HttpValidateQueryProgrammer.ts +75 -75
  136. package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
  137. package/src/programmers/internal/application_alias.ts +74 -74
  138. package/src/programmers/internal/application_array.ts +63 -63
  139. package/src/programmers/internal/application_boolean.ts +44 -44
  140. package/src/programmers/internal/application_default.ts +17 -17
  141. package/src/programmers/internal/application_default_string.ts +33 -33
  142. package/src/programmers/internal/application_native.ts +40 -40
  143. package/src/programmers/internal/application_number.ts +98 -98
  144. package/src/programmers/internal/application_schema.ts +165 -165
  145. package/src/programmers/internal/application_string.ts +65 -65
  146. package/src/programmers/internal/application_templates.ts +24 -24
  147. package/src/programmers/internal/application_tuple.ts +54 -54
  148. package/src/programmers/internal/check_array_length.ts +45 -45
  149. package/src/programmers/internal/check_bigint.ts +49 -49
  150. package/src/programmers/internal/check_dynamic_properties.ts +211 -211
  151. package/src/programmers/internal/check_everything.ts +23 -23
  152. package/src/programmers/internal/check_native.ts +21 -21
  153. package/src/programmers/internal/check_string.ts +48 -48
  154. package/src/programmers/internal/check_template.ts +61 -61
  155. package/src/programmers/internal/check_union_array_like.ts +307 -307
  156. package/src/programmers/internal/decode_union_object.ts +99 -99
  157. package/src/programmers/internal/metadata_to_pattern.ts +33 -33
  158. package/src/programmers/internal/prune_object_properties.ts +60 -60
  159. package/src/programmers/internal/random_custom.ts +37 -37
  160. package/src/programmers/internal/stringify_dynamic_properties.ts +157 -157
  161. package/src/programmers/internal/stringify_native.ts +7 -7
  162. package/src/programmers/internal/stringify_regular_properties.ts +81 -81
  163. package/src/programmers/internal/template_to_pattern.ts +15 -15
  164. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +20 -20
  165. package/src/programmers/json/JsonAssertParseProgrammer.ts +81 -81
  166. package/src/programmers/json/JsonAssertStringifyProgrammer.ts +67 -67
  167. package/src/programmers/json/JsonIsParseProgrammer.ts +81 -81
  168. package/src/programmers/json/JsonIsStringifyProgrammer.ts +75 -75
  169. package/src/programmers/json/JsonValidateParseProgrammer.ts +64 -64
  170. package/src/programmers/json/JsonValidateStringifyProgrammer.ts +83 -83
  171. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +77 -77
  172. package/src/programmers/misc/MiscAssertPruneProgrammer.ts +66 -66
  173. package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
  174. package/src/programmers/misc/MiscIsPruneProgrammer.ts +66 -66
  175. package/src/programmers/misc/MiscPruneProgrammer.ts +523 -523
  176. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +80 -80
  177. package/src/programmers/misc/MiscValidatePruneProgrammer.ts +73 -73
  178. package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +70 -70
  179. package/src/programmers/notations/NotationGeneralProgrammer.ts +647 -647
  180. package/src/programmers/notations/NotationIsGeneralProgrammer.ts +71 -71
  181. package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +81 -81
  182. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +87 -87
  183. package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +67 -67
  184. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +90 -90
  185. package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +75 -75
  186. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
  187. package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +83 -83
  188. package/src/protobuf.ts +999 -999
  189. package/src/reflect.ts +57 -57
  190. package/src/schemas/json/IJsonApplication.ts +9 -9
  191. package/src/schemas/json/IJsonComponents.ts +19 -19
  192. package/src/schemas/json/IJsonSchema.ts +147 -147
  193. package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
  194. package/src/schemas/metadata/IMetadata.ts +34 -34
  195. package/src/schemas/metadata/IMetadataAlias.ts +12 -12
  196. package/src/schemas/metadata/IMetadataApplication.ts +7 -7
  197. package/src/schemas/metadata/IMetadataArray.ts +7 -7
  198. package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
  199. package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
  200. package/src/schemas/metadata/IMetadataComponents.ts +11 -11
  201. package/src/schemas/metadata/IMetadataConstant.ts +23 -23
  202. package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
  203. package/src/schemas/metadata/IMetadataEntry.ts +6 -6
  204. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  205. package/src/schemas/metadata/IMetadataObject.ts +13 -13
  206. package/src/schemas/metadata/IMetadataProperty.ts +9 -9
  207. package/src/schemas/metadata/IMetadataTuple.ts +7 -7
  208. package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
  209. package/src/schemas/metadata/IMetadataTypeTag.ts +16 -16
  210. package/src/schemas/metadata/Metadata.ts +631 -631
  211. package/src/schemas/metadata/MetadataAlias.ts +61 -61
  212. package/src/schemas/metadata/MetadataApplication.ts +44 -44
  213. package/src/schemas/metadata/MetadataArray.ts +49 -49
  214. package/src/schemas/metadata/MetadataArrayType.ts +57 -57
  215. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  216. package/src/schemas/metadata/MetadataComponents.ts +98 -98
  217. package/src/schemas/metadata/MetadataConstant.ts +46 -46
  218. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  219. package/src/schemas/metadata/MetadataObject.ts +154 -154
  220. package/src/schemas/metadata/MetadataProperty.ts +56 -56
  221. package/src/schemas/metadata/MetadataTuple.ts +32 -32
  222. package/src/schemas/metadata/MetadataTupleType.ts +67 -67
  223. package/src/tags/ContentMediaType.ts +10 -0
  224. package/src/tags/Default.ts +18 -18
  225. package/src/tags/ExclusiveMaximum.ts +19 -19
  226. package/src/tags/ExclusiveMinimum.ts +19 -19
  227. package/src/tags/Format.ts +16 -16
  228. package/src/tags/JsonSchemaPlugin.ts +8 -0
  229. package/src/tags/MaxItems.ts +12 -12
  230. package/src/tags/MaxLength.ts +12 -12
  231. package/src/tags/Maximum.ts +18 -18
  232. package/src/tags/MinItems.ts +12 -12
  233. package/src/tags/MinLength.ts +12 -12
  234. package/src/tags/Minimum.ts +18 -18
  235. package/src/tags/MultipleOf.ts +20 -20
  236. package/src/tags/Pattern.ts +12 -12
  237. package/src/tags/TagBase.ts +76 -76
  238. package/src/tags/index.ts +16 -14
  239. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  240. package/src/transform.ts +35 -35
  241. package/src/transformers/CallExpressionTransformer.ts +496 -496
  242. package/src/transformers/FileTransformer.ts +91 -91
  243. package/src/transformers/IProject.ts +15 -15
  244. package/src/transformers/ITransformOptions.ts +62 -62
  245. package/src/transformers/ImportTransformer.ts +66 -66
  246. package/src/transformers/NodeTransformer.ts +13 -13
  247. package/src/transformers/TransformerError.ts +55 -55
  248. package/src/transformers/features/CreateIsTransformer.ts +10 -10
  249. package/src/transformers/features/CreateRandomTransformer.ts +40 -40
  250. package/src/transformers/features/CreateValidateTransformer.ts +13 -13
  251. package/src/transformers/features/IsTransformer.ts +10 -10
  252. package/src/transformers/features/RandomTransformer.ts +44 -44
  253. package/src/transformers/features/ValidateTransformer.ts +11 -11
  254. package/src/transformers/features/http/CreateHttpAssertFormDataTransformer.ts +12 -12
  255. package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +11 -11
  256. package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +9 -9
  257. package/src/transformers/features/http/CreateHttpFormDataTransformer.ts +9 -9
  258. package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
  259. package/src/transformers/features/http/CreateHttpIsFormDataTransformer.ts +9 -9
  260. package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
  261. package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
  262. package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
  263. package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
  264. package/src/transformers/features/http/CreateHttpValidateFormDataTransformer.ts +12 -12
  265. package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
  266. package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +11 -11
  267. package/src/transformers/features/http/HttpAssertFormDataTransformer.ts +10 -10
  268. package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +9 -9
  269. package/src/transformers/features/http/HttpAssertQueryTransformer.ts +9 -9
  270. package/src/transformers/features/http/HttpFormDataTransformer.ts +9 -9
  271. package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
  272. package/src/transformers/features/http/HttpIsFormDataTransformer.ts +9 -9
  273. package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
  274. package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
  275. package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
  276. package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
  277. package/src/transformers/features/http/HttpValidateFormDataTransformer.ts +10 -10
  278. package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
  279. package/src/transformers/features/http/HttpValidateQueryTransformer.ts +9 -9
  280. package/src/transformers/features/json/JsonApplicationTransformer.ts +133 -133
  281. package/src/transformers/features/json/JsonAssertParseTransformer.ts +9 -9
  282. package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
  283. package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +9 -9
  284. package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
  285. package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
  286. package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +9 -9
  287. package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
  288. package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +11 -11
  289. package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
  290. package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
  291. package/src/transformers/features/json/JsonIsStringifyTransformer.ts +9 -9
  292. package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
  293. package/src/transformers/features/json/JsonValidateParseTransformer.ts +9 -9
  294. package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
  295. package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +9 -9
  296. package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +9 -9
  297. package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
  298. package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +9 -9
  299. package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +9 -9
  300. package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
  301. package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
  302. package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
  303. package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
  304. package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +11 -11
  305. package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +11 -11
  306. package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
  307. package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
  308. package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
  309. package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
  310. package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +9 -9
  311. package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +9 -9
  312. package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
  313. package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
  314. package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
  315. package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
  316. package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +15 -15
  317. package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
  318. package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
  319. package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +15 -15
  320. package/src/transformers/features/protobuf/ProtobufAssertDecodeTransformer.ts +10 -10
  321. package/src/transformers/features/protobuf/ProtobufAssertEncodeTransformer.ts +10 -10
  322. package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
  323. package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
  324. package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
  325. package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
  326. package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +9 -9
  327. package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +9 -9
  328. package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
  329. package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
  330. package/src/transformers/features/protobuf/ProtobufDecodeTransformer.ts +9 -9
  331. package/src/transformers/features/protobuf/ProtobufEncodeTransformer.ts +9 -9
  332. package/src/transformers/features/protobuf/ProtobufIsDecodeTransformer.ts +9 -9
  333. package/src/transformers/features/protobuf/ProtobufIsEncodeTransformer.ts +9 -9
  334. package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
  335. package/src/transformers/features/protobuf/ProtobufValidateDecodeTransformer.ts +10 -10
  336. package/src/transformers/features/protobuf/ProtobufValidateEncodeTransformer.ts +10 -10
  337. package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +63 -63
  338. package/src/transformers/internal/GenericTransformer.ts +104 -104
  339. package/src/typings/Atomic.ts +13 -13
  340. package/src/typings/ClassProperties.ts +5 -5
  341. package/src/typings/Customizable.ts +5 -5
  342. package/src/typings/OmitNever.ts +3 -3
  343. package/src/typings/ProtobufAtomic.ts +19 -19
  344. package/src/typings/SpecialFields.ts +3 -3
  345. package/src/typings/ValidationPipe.ts +9 -9
  346. package/src/typings/Writable.ts +11 -11
  347. package/src/utils/ArrayUtil.ts +43 -43
  348. package/src/utils/Escaper.ts +46 -46
  349. package/src/utils/MapUtil.ts +12 -12
  350. package/src/utils/NameEncoder.ts +32 -32
  351. package/src/utils/NamingConvention/NamingConvention.ts +86 -86
  352. package/src/utils/NamingConvention/index.ts +1 -1
  353. package/src/utils/PatternUtil.ts +29 -29
  354. package/src/utils/RandomGenerator/RandomGenerator.ts +105 -105
  355. package/src/utils/RandomGenerator/index.ts +1 -1
  356. package/src/utils/Singleton.ts +16 -16
  357. package/src/utils/StringUtil/StringUtil.ts +7 -7
  358. package/src/utils/StringUtil/index.ts +1 -1
package/src/module.ts CHANGED
@@ -1,1024 +1,1024 @@
1
- import * as Namespace from "./functional/Namespace";
2
-
3
- import { AssertionGuard } from "./AssertionGuard";
4
- import { IRandomGenerator } from "./IRandomGenerator";
5
- import { IValidation } from "./IValidation";
6
- import { Resolved } from "./Resolved";
7
- import { TypeGuardError } from "./TypeGuardError";
8
-
9
- export * as functional from "./functional";
10
- export * as http from "./http";
11
- export * as json from "./json";
12
- export * as misc from "./misc";
13
- export * as notations from "./notations";
14
- export * as protobuf from "./protobuf";
15
- export * as reflect from "./reflect";
16
- export * as tags from "./tags";
17
-
18
- export * from "./schemas/metadata/IJsDocTagInfo";
19
- export * from "./schemas/json/IJsonApplication";
20
- export * from "./schemas/json/IJsonComponents";
21
- export * from "./schemas/json/IJsonSchema";
22
- export * from "./AssertionGuard";
23
- export * from "./IRandomGenerator";
24
- export * from "./IValidation";
25
- export * from "./TypeGuardError";
26
-
27
- export * from "./Primitive";
28
- export * from "./Resolved";
29
- export * from "./CamelCase";
30
- export * from "./PascalCase";
31
- export * from "./SnakeCase";
32
-
33
- /* -----------------------------------------------------------
34
- BASIC VALIDATORS
35
- ----------------------------------------------------------- */
36
- /**
37
- * Asserts a value type.
38
- *
39
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
40
- * reason, if the parametric value is not following the type `T`. Otherwise, the
41
- * value is following the type `T`, just input parameter would be returned.
42
- *
43
- * If what you want is not asserting but just knowing whether the parametric value is
44
- * following the type `T` or not, you can choose the {@link is} function instead.
45
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
46
- * Also, if you want to automatically cast the parametric value to the type `T`
47
- * when no problem (perform the assertion guard of type).
48
- *
49
- * On the other and, if you don't want to allow any superfluous property that is not
50
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
51
- *
52
- * @template T Type of the input value
53
- * @param input A value to be asserted
54
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
55
- * @returns Parametric input value
56
- * @throws A {@link TypeGuardError} instance with detailed reason
57
- *
58
- * @author Jeongho Nam - https://github.com/samchon
59
- */
60
- function assert<T>(
61
- input: T,
62
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
63
- ): T;
64
-
65
- /**
66
- * Asserts a value type.
67
- *
68
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
69
- * reason, if the parametric value is not following the type `T`. Otherwise, the
70
- * value is following the type `T`, just input parameter would be returned.
71
- *
72
- * If what you want is not asserting but just knowing whether the parametric value is
73
- * following the type `T` or not, you can choose the {@link is} function instead.
74
- * Otherwise, you want to know all the errors, {@link validate} is the way to go.
75
- *
76
- * On the other and, if you don't want to allow any superfluous property that is not
77
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
78
- *
79
- * @template T Type of the input value
80
- * @param input A value to be asserted
81
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
82
- * @returns Parametric input value casted as `T`
83
- * @throws A {@link TypeGuardError} instance with detailed reason
84
- *
85
- * @author Jeongho Nam - https://github.com/samchon
86
- */
87
- function assert<T>(
88
- input: unknown,
89
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
90
- ): T;
91
-
92
- /**
93
- * @internal
94
- */
95
- function assert(): never {
96
- halt("assert");
97
- }
98
- const assertPure = /** @__PURE__ */ Object.assign<typeof assert, {}>(
99
- assert,
100
- /** @__PURE__ */ Namespace.assert("assert"),
101
- );
102
- export { assertPure as assert };
103
-
104
- /**
105
- * Assertion guard of a value type.
106
- *
107
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
108
- * reason, if the parametric value is not following the type `T`. Otherwise, the
109
- * value is following the type `T`, nothing would be returned, but the input value
110
- * would be automatically casted to the type `T`. This is the concept of
111
- * "Assertion Guard" of a value type.
112
- *
113
- * If what you want is not asserting but just knowing whether the parametric value is
114
- * following the type `T` or not, you can choose the {@link is} function instead.
115
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
116
- * Also, if you want to returns the parametric value when no problem, you can use
117
- * {@link assert} function instead.
118
- *
119
- * On the other and, if you don't want to allow any superfluous property that is not
120
- * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
121
- *
122
- * @template T Type of the input value
123
- * @param input A value to be asserted
124
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
125
- * @throws A {@link TypeGuardError} instance with detailed reason
126
- *
127
- * @author Jeongho Nam - https://github.com/samchon
128
- */
129
- function assertGuard<T>(
130
- input: T,
131
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
132
- ): asserts input is T;
133
-
134
- /**
135
- * Assertion guard of a value type.
136
- *
137
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
138
- * reason, if the parametric value is not following the type `T`. Otherwise, the
139
- * value is following the type `T`, nothing would be returned, but the input value
140
- * would be automatically casted to the type `T`. This is the concept of
141
- * "Assertion Guard" of a value type.
142
- *
143
- * If what you want is not asserting but just knowing whether the parametric value is
144
- * following the type `T` or not, you can choose the {@link is} function instead.
145
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
146
- * Also, if you want to returns the parametric value when no problem, you can use
147
- * {@link assert} function instead.
148
- *
149
- * On the other and, if you don't want to allow any superfluous property that is not
150
- * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
151
- *
152
- * @template T Type of the input value
153
- * @param input A value to be asserted
154
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
155
- * @throws A {@link TypeGuardError} instance with detailed reason
156
- *
157
- * @author Jeongho Nam - https://github.com/samchon
158
- */
159
- function assertGuard<T>(
160
- input: unknown,
161
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
162
- ): asserts input is T;
163
-
164
- /**
165
- * @internal
166
- */
167
- function assertGuard(): never {
168
- halt("assertGuard");
169
- }
170
- const assertGuardPure = /** @__PURE__ */ Object.assign<typeof assertGuard, {}>(
171
- assertGuard,
172
- /** @__PURE__ */ Namespace.assert("assertGuard"),
173
- );
174
- export { assertGuardPure as assertGuard };
175
-
176
- /**
177
- * Tests a value type.
178
- *
179
- * Tests a parametric value type and returns whether it's following the type `T` or not.
180
- * If the parametric value is matched with the type `T`, `true` value would be returned.
181
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
182
- * returned.
183
- *
184
- * If what you want is not just knowing whether the parametric value is following the
185
- * type `T` or not, but throwing an exception with detailed reason, you can choose
186
- * {@link assert} function instead. Also, if you want to know all the errors with
187
- * detailed reasons, {@link validate} function would be useful.
188
- *
189
- * On the other and, if you don't want to allow any superfluous property that is not
190
- * enrolled to the type `T`, you can use {@link equals} function instead.
191
- *
192
- * @template T Type of the input value
193
- * @param input A value to be tested
194
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
195
- * @returns Whether the parametric value is following the type `T` or not
196
- *
197
- * @author Jeongho Nam - https://github.com/samchon
198
- */
199
- function is<T>(input: T): input is T;
200
-
201
- /**
202
- * Tests a value type.
203
- *
204
- * Tests a parametric value type and returns whether it's following the type `T` or not.
205
- * If the parametric value is matched with the type `T`, `true` value would be returned.
206
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
207
- * returned.
208
- *
209
- * If what you want is not just knowing whether the parametric value is following the
210
- * type `T` or not, but throwing an exception with detailed reason, you can choose
211
- * {@link assert} function instead. Also, if you want to know all the errors with
212
- * detailed reasons, {@link validate} function would be useful.
213
- *
214
- * On the other and, if you don't want to allow any superfluous property that is not
215
- * enrolled to the type `T`, you can use {@link equals} function instead.
216
- *
217
- * @template T Type of the input value
218
- * @param input A value to be tested
219
- * @returns Whether the parametric value is following the type `T` or not
220
- *
221
- * @author Jeongho Nam - https://github.com/samchon
222
- */
223
- function is<T>(input: unknown): input is T;
224
-
225
- /**
226
- * @internal
227
- */
228
- function is(): never {
229
- halt("is");
230
- }
231
- const isPure = /** @__PURE__ */ Object.assign<typeof is, {}>(
232
- is,
233
- /** @__PURE__ */ Namespace.assert("is"),
234
- );
235
- export { isPure as is };
236
-
237
- /**
238
- * Validates a value type.
239
- *
240
- * Validates a parametric value type and archives all the type errors into an
241
- * {@link IValidation.errors} array, if the parametric value is not following the
242
- * type `T`. Of course, if the parametric value is following the type `T`, the
243
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
244
- * would have the `true` value.
245
- *
246
- * If what you want is not finding all the error, but asserting the parametric value
247
- * type with exception throwing, you can choose {@link assert} function instead.
248
- * Otherwise, you just want to know whether the parametric value is matched with the
249
- * type `T`, {@link is} function is the way to go.
250
- *
251
- * On the other and, if you don't want to allow any superfluous property that is not
252
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
253
- *
254
- * @template Type of the input value
255
- * @param input A value to be validated
256
- * @returns Validation result
257
- *
258
- * @author Jeongho Nam - https://github.com/samchon
259
- */
260
- function validate<T>(input: T): IValidation<T>;
261
-
262
- /**
263
- * Validates a value type.
264
- *
265
- * Validates a parametric value type and archives all the type errors into an
266
- * {@link IValidation.errors} array, if the parametric value is not following the
267
- * type `T`. Of course, if the parametric value is following the type `T`, the
268
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
269
- * would have the `true` value.
270
- *
271
- * If what you want is not finding all the error, but asserting the parametric value
272
- * type with exception throwing, you can choose {@link assert} function instead.
273
- * Otherwise, you just want to know whether the parametric value is matched with the
274
- * type `T`, {@link is} function is the way to go.
275
- *
276
- * On the other and, if you don't want to allow any superfluous property that is not
277
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
278
- *
279
- * @template Type of the input value
280
- * @param input A value to be validated
281
- * @returns Validation result
282
- *
283
- * @author Jeongho Nam - https://github.com/samchon
284
- */
285
- function validate<T>(input: unknown): IValidation<T>;
286
-
287
- /**
288
- * @internal
289
- */
290
- function validate(): never {
291
- halt("validate");
292
- }
293
- const validatePure = /** @__PURE__ */ Object.assign<typeof validate, {}>(
294
- validate,
295
- /** @__PURE__ */ Namespace.validate(),
296
- );
297
- export { validatePure as validate };
298
-
299
- /* -----------------------------------------------------------
300
- STRICT VALIDATORS
301
- ----------------------------------------------------------- */
302
- /**
303
- * Asserts equality between a value and its type.
304
- *
305
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
306
- * reason, if the parametric value is not following the type `T` or some superfluous
307
- * property that is not listed on the type `T` has been found. Otherwise, the value is
308
- * following the type `T` without any superfluous property, just input parameter would
309
- * be returned.
310
- *
311
- * If what you want is not asserting but just knowing whether the parametric value is
312
- * following the type `T` or not, you can choose the {@link equals} function instead.
313
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
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 assert} function instead.
317
- *
318
- * @template T Type of the input value
319
- * @param input A value to be asserted
320
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
321
- * @returns Parametric input value
322
- * @throws A {@link TypeGuardError} instance with detailed reason
323
- *
324
- * @author Jeongho Nam - https://github.com/samchon
325
- */
326
- function assertEquals<T>(
327
- input: T,
328
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
329
- ): T;
330
-
331
- /**
332
- * Asserts equality between a value and its type.
333
- *
334
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
335
- * reason, if the parametric value is not following the type `T` or some superfluous
336
- * property that is not listed on the type `T` has been found. Otherwise, the value is
337
- * following the type `T` without any superfluous property, just input parameter would
338
- * be returned.
339
- *
340
- * If what you want is not asserting but just knowing whether the parametric value is
341
- * following the type `T` or not, you can choose the {@link equals} function instead.
342
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
343
- *
344
- * On the other hand, if you want to allow superfluous property that is not enrolled
345
- * to the type `T`, you can use {@link assert} function instead.
346
- *
347
- * @template T Type of the input value
348
- * @param input A value to be asserted
349
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
350
- * @returns Parametric input value casted as `T`
351
- * @throws A {@link TypeGuardError} instance with detailed reason
352
- *
353
- * @author Jeongho Nam - https://github.com/samchon
354
- */
355
- function assertEquals<T>(
356
- input: unknown,
357
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
358
- ): T;
359
-
360
- /**
361
- * @internal
362
- */
363
- function assertEquals(): never {
364
- halt("assertEquals");
365
- }
366
- const assertEqualsPure = /** @__PURE__ */ Object.assign<
367
- typeof assertEquals,
368
- {}
369
- >(assertEquals, /** @__PURE__ */ Namespace.assert("assertEquals"));
370
- export { assertEqualsPure as assertEquals };
371
-
372
- /**
373
- * Assertion guard of a type with equality.
374
- *
375
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
376
- * reason, if the parametric value is not following the type `T` or some superfluous
377
- * property that is not listed on the type `T` has been found.
378
- *
379
- * Otherwise, the value is following the type `T` without any superfluous property,
380
- * nothing would be returned, but the input value would be automatically casted to
381
- * the type `T`. This is the concept of "Assertion Guard" of a value type.
382
- *
383
- * If what you want is not asserting but just knowing whether the parametric value is
384
- * following the type `T` or not, you can choose the {@link equals} function instead.
385
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
386
- * Also, if you want to returns the parametric value when no problem, you can use
387
- * {@link assert} function instead.
388
- *
389
- * On the other hand, if you want to allow superfluous property that is not enrolled
390
- * to the type `T`, you can use {@link assertEquals} function instead.
391
- *
392
- * @template T Type of the input value
393
- * @param input A value to be asserted
394
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
395
- * @returns Parametric input value casted as `T`
396
- * @throws A {@link TypeGuardError} instance with detailed reason
397
- *
398
- * @author Jeongho Nam - https://github.com/samchon
399
- */
400
- function assertGuardEquals<T>(
401
- input: T,
402
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
403
- ): asserts input is T;
404
-
405
- /**
406
- * Assertion guard of a type with equality.
407
- *
408
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
409
- * reason, if the parametric value is not following the type `T` or some superfluous
410
- * property that is not listed on the type `T` has been found.
411
- *
412
- * Otherwise, the value is following the type `T` without any superfluous property,
413
- * nothing would be returned, but the input value would be automatically casted to
414
- * the type `T`. This is the concept of "Assertion Guard" of a value type.
415
- *
416
- * If what you want is not asserting but just knowing whether the parametric value is
417
- * following the type `T` or not, you can choose the {@link equals} function instead.
418
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
419
- * Also, if you want to returns the parametric value when no problem, you can use
420
- * {@link assertEquals} function instead.
421
- *
422
- * On the other hand, if you want to allow superfluous property that is not enrolled
423
- * to the type `T`, you can use {@link assertGuard} function instead.
424
- *
425
- * @template T Type of the input value
426
- * @param input A value to be asserted
427
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
428
- * @returns Parametric input value casted as `T`
429
- * @throws A {@link TypeGuardError} instance with detailed reason
430
- *
431
- * @author Jeongho Nam - https://github.com/samchon
432
- */
433
- function assertGuardEquals<T>(
434
- input: unknown,
435
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
436
- ): asserts input is T;
437
-
438
- /**
439
- * @internal
440
- */
441
- function assertGuardEquals(): never {
442
- halt("assertGuardEquals");
443
- }
444
- const assertGuardEqualsPure = /** @__PURE__ */ Object.assign<
445
- typeof assertGuardEquals,
446
- {}
447
- >(assertGuardEquals, /** @__PURE__ */ Namespace.assert("assertGuardEquals"));
448
- export { assertGuardEqualsPure as assertGuardEquals };
449
-
450
- /**
451
- * Tests equality between a value and its type.
452
- *
453
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
454
- * or not. If the parametric value is matched with the type `T` and there's not any
455
- * superfluous property that is not listed on the type `T`, `true` value would be
456
- * returned. Otherwise, the parametric value is not following the type `T` or some
457
- * superfluous property exists, `false` value would be returned.
458
- *
459
- * If what you want is not just knowing whether the parametric value is following the
460
- * type `T` or not, but throwing an exception with detailed reason, you can choose
461
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
462
- * detailed reasons, {@link validateEquals} function would be useful.
463
- *
464
- * On the other hand, if you want to allow superfluous property that is not enrolled
465
- * to the type `T`, you can use {@link is} function instead.
466
- *
467
- * @template T Type of the input value
468
- * @param input A value to be tested
469
- * @returns Whether the parametric value is equivalent to the type `T` or not
470
- *
471
- * @author Jeongho Nam - https://github.com/samchon
472
- */
473
- function equals<T>(input: T): input is T;
474
-
475
- /**
476
- * Tests equality between a value and its type.
477
- *
478
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
479
- * or not. If the parametric value is matched with the type `T` and there's not any
480
- * superfluous property that is not listed on the type `T`, `true` value would be
481
- * returned. Otherwise, the parametric value is not following the type `T` or some
482
- * superfluous property exists, `false` value would be returned.
483
- *
484
- * If what you want is not just knowing whether the parametric value is following the
485
- * type `T` or not, but throwing an exception with detailed reason, you can choose
486
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
487
- * detailed reasons, {@link validateEquals} function would be useful.
488
- *
489
- * On the other hand, if you want to allow superfluous property that is not enrolled
490
- * to the type `T`, you can use {@link is} function instead.
491
- *
492
- * @template T Type of the input value
493
- * @param input A value to be tested
494
- * @returns Whether the parametric value is equivalent to the type `T` or not
495
- *
496
- * @author Jeongho Nam - https://github.com/samchon
497
- */
498
- function equals<T>(input: unknown): input is T;
499
-
500
- /**
501
- * @internal
502
- */
503
- function equals(): never {
504
- halt("equals");
505
- }
506
- const equalsPure = /** @__PURE__ */ Object.assign<typeof equals, {}>(
507
- equals,
508
- /** @__PURE__ */ Namespace.is(),
509
- );
510
- export { equalsPure as equals };
511
-
512
- /**
513
- * Validates equality between a value and its type.
514
- *
515
- * Validates a parametric value type and archives all the type errors into an
516
- * {@link IValidation.errors} array, if the parametric value is not following the
517
- * type `T` or some superfluous property that is not listed on the type `T` has been
518
- * found. Of course, if the parametric value is following the type `T` and no
519
- * superfluous property exists, the {@link IValidation.errors} array would be empty
520
- * and {@link IValidation.success} would have the `true` value.
521
- *
522
- * If what you want is not finding all the error, but asserting the parametric value
523
- * type with exception throwing, you can choose {@link assert} function instead.
524
- * Otherwise, you just want to know whether the parametric value is matched with the
525
- * type `T`, {@link is} function is the way to go.
526
- *
527
- * On the other and, if you don't want to allow any superfluous property that is not
528
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
529
- *
530
- * @template Type of the input value
531
- * @param input A value to be validated
532
- * @returns Validation result
533
- *
534
- * @author Jeongho Nam - https://github.com/samchon
535
- */
536
- function validateEquals<T>(input: T): IValidation<T>;
537
-
538
- /**
539
- * Validates equality between a value and its type.
540
- *
541
- * Validates a parametric value type and archives all the type errors into an
542
- * {@link IValidation.errors} array, if the parametric value is not following the
543
- * type `T` or some superfluous property that is not listed on the type `T` has been
544
- * found. Of course, if the parametric value is following the type `T` and no
545
- * superfluous property exists, the {@link IValidation.errors} array would be empty
546
- * and {@link IValidation.success} would have the `true` value.
547
- *
548
- * If what you want is not finding all the error, but asserting the parametric value
549
- * type with exception throwing, you can choose {@link assert} function instead.
550
- * Otherwise, you just want to know whether the parametric value is matched with the
551
- * type `T`, {@link is} function is the way to go.
552
- *
553
- * On the other and, if you don't want to allow any superfluous property that is not
554
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
555
- *
556
- * @template Type of the input value
557
- * @param input A value to be validated
558
- * @returns Validation result
559
- *
560
- * @author Jeongho Nam - https://github.com/samchon
561
- */
562
- function validateEquals<T>(input: unknown): IValidation<T>;
563
-
564
- /**
565
- * @internal
566
- */
567
- function validateEquals(): never {
568
- halt("validateEquals");
569
- }
570
- const validateEqualsPure = /** @__PURE__ */ Object.assign<
571
- typeof validateEquals,
572
- {}
573
- >(validateEquals, /** @__PURE__ */ Namespace.validate());
574
- export { validateEqualsPure as validateEquals };
575
-
576
- /* -----------------------------------------------------------
577
- RANDOM
578
- ----------------------------------------------------------- */
579
- /**
580
- * > You must configure the generic argument `T`.
581
- *
582
- * Generate random data.
583
- *
584
- * Generates a random data following type the `T`.
585
- *
586
- * For reference, this `typia.random()` function generates only primitive type.
587
- * If there're some methods in the type `T` or its nested instances, those would
588
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
589
- * would be generated instead.
590
- *
591
- * @template T Type of data to generate
592
- * @param generator Random data generator
593
- * @return Randomly generated data
594
- *
595
- * @author Jeongho Nam - https://github.com/samchon
596
- */
597
- function random(generator?: Partial<IRandomGenerator>): never;
598
-
599
- /**
600
- * Generate random data.
601
- *
602
- * Generates a random data following type the `T`.
603
- *
604
- * For reference, this `typia.random()` function generates only primitive type.
605
- * If there're some methods in the type `T` or its nested instances, those would
606
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
607
- * would be generated instead.
608
- *
609
- * @template T Type of data to generate
610
- * @param generator Random data generator
611
- * @return Randomly generated data
612
- *
613
- * @author Jeongho Nam - https://github.com/samchon
614
- */
615
- function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
616
-
617
- /**
618
- * @internal
619
- */
620
- function random(): never {
621
- halt("random");
622
- }
623
- const randomPure = /** @__PURE__ */ Object.assign<typeof random, {}>(
624
- random,
625
- /** @__PURE__ */ Namespace.random(),
626
- );
627
- export { randomPure as random };
628
-
629
- /* -----------------------------------------------------------
630
- FACTORY FUNCTIONS
631
- ----------------------------------------------------------- */
632
- /**
633
- * Creates a reusable {@link assert} function.
634
- *
635
- * @danger You must configure the generic argument `T`
636
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
637
- * @returns Nothing until you configure the generic argument `T`
638
- * @throws compile error
639
- *
640
- * @author Jeongho Nam - https://github.com/samchon
641
- */
642
- function createAssert(
643
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
644
- ): never;
645
-
646
- /**
647
- * Creates a reusable {@link assert} function.
648
- *
649
- * @template T Type of the input value
650
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
651
- * @returns A reusable `assert` function
652
- *
653
- * @author Jeongho Nam - https://github.com/samchon
654
- */
655
- function createAssert<T>(
656
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
657
- ): (input: unknown) => T;
658
-
659
- /**
660
- * @internal
661
- */
662
- function createAssert<T>(): (input: unknown) => T {
663
- halt("createAssert");
664
- }
665
- const createAssertPure = /** @__PURE__ */ Object.assign<
666
- typeof createAssert,
667
- {}
668
- >(createAssert, assertPure);
669
- export { createAssertPure as createAssert };
670
-
671
- /**
672
- * Creates a reusable {@link assertGuard} function.
673
- *
674
- * Note that, you've to declare the variable type of the factory function caller
675
- * like below. If you don't declare the variable type, compilation error be thrown.
676
- * This is the special rule of the TypeScript compiler.
677
- *
678
- * ```typescript
679
- * // MUST DECLARE THE VARIABLE TYPE
680
- * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
681
- *
682
- * // IF NOT, COMPILATION ERROR BE OCCURED
683
- * const func = typia.createAssertGuard<number>();
684
- * ```
685
- *
686
- * > *Assertions require every name in the call target to be declared with an*
687
- * > *explicit type annotation.*
688
- *
689
- * @danger You must configure the generic argument `T`
690
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
691
- * @returns Nothing until you configure the generic argument `T`
692
- * @throws compile error
693
- *
694
- * @author Jeongho Nam - https://github.com/samchon
695
- */
696
- function createAssertGuard(
697
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
698
- ): never;
699
-
700
- /**
701
- * Creates a reusable {@link assertGuard} function.
702
- *
703
- * Note that, you've to declare the variable type of the factory function caller
704
- * like below. If you don't declare the variable type, compilation error be thrown.
705
- * This is the special rule of the TypeScript compiler.
706
- *
707
- * ```typescript
708
- * // MUST DECLARE THE VARIABLE TYPE
709
- * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
710
- *
711
- * // IF NOT, COMPILATION ERROR BE OCCURED
712
- * const func = typia.createAssertGuard<number>();
713
- * ```
714
- *
715
- * > *Assertions require every name in the call target to be declared with an*
716
- * > *explicit type annotation.*
717
- *
718
- * @returns Nothing until you configure the generic argument `T`
719
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
720
- * @throws compile error
721
- *
722
- * @author Jeongho Nam - https://github.com/samchon
723
- */
724
- function createAssertGuard<T>(
725
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
726
- ): (input: unknown) => AssertionGuard<T>;
727
-
728
- /**
729
- * @internal
730
- */
731
- function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
732
- halt("createAssertGuard");
733
- }
734
- const createAssertGuardPure = /** @__PURE__ */ Object.assign<
735
- typeof createAssertGuard,
736
- {}
737
- >(createAssertGuard, assertGuardPure);
738
- export { createAssertGuardPure as createAssertGuard };
739
-
740
- /**
741
- * Creates a reusable {@link is} function.
742
- *
743
- * @danger You must configure the generic argument `T`
744
- * @returns Nothing until you configure the generic argument `T`
745
- * @throws compile error
746
- *
747
- * @author Jeongho Nam - https://github.com/samchon
748
- */
749
- function createIs(): never;
750
-
751
- /**
752
- * Creates a reusable {@link is} function.
753
- *
754
- * @template T Type of the input value
755
- * @returns A reusable `is` function
756
- *
757
- * @author Jeongho Nam - https://github.com/samchon
758
- */
759
- function createIs<T>(): (input: unknown) => input is T;
760
-
761
- /**
762
- * @internal
763
- */
764
- function createIs<T>(): (input: unknown) => input is T {
765
- halt("createIs");
766
- }
767
- const createIsPure = /** @__PURE__ */ Object.assign<typeof createIs, {}>(
768
- createIs,
769
- isPure,
770
- );
771
- export { createIsPure as createIs };
772
-
773
- /**
774
- * Creates a reusable {@link validate} function.
775
- *
776
- * @danger You must configure the generic argument `T`
777
- * @returns Nothing until you configure the generic argument `T`
778
- * @throws compile error
779
- *
780
- * @author Jeongho Nam - https://github.com/samchon
781
- */
782
- function createValidate(): never;
783
-
784
- /**
785
- * Creates a reusable {@link validate} function.
786
- *
787
- * @template T Type of the input value
788
- * @returns A reusable `validate` function
789
- *
790
- * @author Jeongho Nam - https://github.com/samchon
791
- */
792
- function createValidate<T>(): (input: unknown) => IValidation<T>;
793
-
794
- /**
795
- * @internal
796
- */
797
- function createValidate(): (input: unknown) => IValidation {
798
- halt("createValidate");
799
- }
800
- const createValidatePure = /** @__PURE__ */ Object.assign<
801
- typeof createValidate,
802
- {}
803
- >(createValidate, validatePure);
804
- export { createValidatePure as createValidate };
805
-
806
- /**
807
- * Creates a reusable {@link assertEquals} function.
808
- *
809
- * @danger You must configure the generic argument `T`
810
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
811
- * @returns Nothing until you configure the generic argument `T`
812
- * @throws compile error
813
- *
814
- * @author Jeongho Nam - https://github.com/samchon
815
- */
816
- function createAssertEquals(
817
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
818
- ): never;
819
-
820
- /**
821
- * Creates a reusable {@link assertEquals} function.
822
- *
823
- * @template T Type of the input value
824
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
825
- * @returns A reusable `assertEquals` function
826
- *
827
- * @author Jeongho Nam - https://github.com/samchon
828
- */
829
- function createAssertEquals<T>(
830
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
831
- ): (input: unknown) => T;
832
-
833
- /**
834
- * @internal
835
- */
836
- function createAssertEquals<T>(): (input: unknown) => T {
837
- halt("createAssertEquals");
838
- }
839
- const createAssertEqualsPure = /** @__PURE__ */ Object.assign<
840
- typeof createAssertEquals,
841
- {}
842
- >(createAssertEquals, assertEqualsPure);
843
- export { createAssertEqualsPure as createAssertEquals };
844
-
845
- /**
846
- * Creates a reusable {@link assertGuardEquals} function.
847
- *
848
- * Note that, you've to declare the variable type of the factory function caller
849
- * like below. If you don't declare the variable type, compilation error be thrown.
850
- * This is the special rule of the TypeScript compiler.
851
- *
852
- * ```typescript
853
- * // MUST DECLARE THE VARIABLE TYPE
854
- * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
855
- *
856
- * // IF NOT, COMPILATION ERROR BE OCCURED
857
- * const func = typia.createAssertGuardEquals<number>();
858
- * ```
859
- *
860
- * > *Assertions require every name in the call target to be declared with an*
861
- * > *explicit type annotation.*
862
- *
863
- * @danger You must configure the generic argument `T`
864
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
865
- * @returns Nothing until you configure the generic argument `T`
866
- * @throws compile error
867
- *
868
- * @author Jeongho Nam - https://github.com/samchon
869
- */
870
- function createAssertGuardEquals(
871
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
872
- ): never;
873
-
874
- /**
875
- * Creates a reusable {@link assertGuardEquals} function.
876
- *
877
- * Note that, you've to declare the variable type of the factory function caller
878
- * like below. If you don't declare the variable type, compilation error be thrown.
879
- * This is the special rule of the TypeScript compiler.
880
- *
881
- * ```typescript
882
- * // MUST DECLARE THE VARIABLE TYPE
883
- * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
884
- *
885
- * // IF NOT, COMPILATION ERROR BE OCCURED
886
- * const func = typia.createAssertGuardEquals<number>();
887
- * ```
888
- *
889
- * > *Assertions require every name in the call target to be declared with an*
890
- * > *explicit type annotation.*
891
- *
892
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
893
- * @returns Nothing until you configure the generic argument `T`
894
- * @throws compile error
895
- *
896
- * @author Jeongho Nam - https://github.com/samchon
897
- */
898
- function createAssertGuardEquals<T>(
899
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
900
- ): (input: unknown) => AssertionGuard<T>;
901
-
902
- /**
903
- * @internal
904
- */
905
- function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T> {
906
- halt("createAssertGuardEquals");
907
- }
908
- const createAssertGuardEqualsPure = /** @__PURE__ */ Object.assign<
909
- typeof createAssertGuardEquals,
910
- {}
911
- >(createAssertGuardEquals, assertGuardEqualsPure);
912
- export { createAssertGuardEqualsPure as createAssertGuardEquals };
913
-
914
- /**
915
- * Creates a reusable {@link equals} function.
916
- *
917
- * @danger You must configure the generic argument `T`
918
- * @returns Nothing until you configure the generic argument `T`
919
- * @throws compile error
920
- *
921
- * @author Jeongho Nam - https://github.com/samchon
922
- */
923
- function createEquals(): never;
924
-
925
- /**
926
- * Creates a reusable {@link equals} function.
927
- *
928
- * @template T Type of the input value
929
- * @returns A reusable `equals` function
930
- *
931
- * @author Jeongho Nam - https://github.com/samchon
932
- */
933
- function createEquals<T>(): (input: unknown) => input is T;
934
-
935
- /**
936
- * @internal
937
- */
938
- function createEquals<T>(): (input: unknown) => input is T {
939
- halt("createEquals");
940
- }
941
- const createEqualsPure = /** @__PURE__ */ Object.assign<
942
- typeof createEquals,
943
- {}
944
- >(createEquals, equalsPure);
945
- export { createEqualsPure as createEquals };
946
-
947
- /**
948
- * Creates a reusable {@link validateEquals} function.
949
- *
950
- * @danger You must configure the generic argument `T`
951
- * @returns Nothing until you configure the generic argument `T`
952
- * @throws compile error
953
- *
954
- * @author Jeongho Nam - https://github.com/samchon
955
- */
956
- function createValidateEquals(): never;
957
-
958
- /**
959
- * Creates a reusable {@link validateEquals} function.
960
- *
961
- * @template T Type of the input value
962
- * @returns A reusable `validateEquals` function
963
- *
964
- * @author Jeongho Nam - https://github.com/samchon
965
- */
966
- function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
967
-
968
- /**
969
- * @internal
970
- */
971
- function createValidateEquals(): (input: unknown) => IValidation {
972
- halt("createValidateEquals");
973
- }
974
- const createValidateEqualsPure = /** @__PURE__ */ Object.assign<
975
- typeof createValidateEquals,
976
- {}
977
- >(createValidateEquals, validateEqualsPure);
978
- export { createValidateEqualsPure as createValidateEquals };
979
-
980
- /**
981
- * Creates a reusable {@link random} function.
982
- *
983
- * @danger You must configure the generic argument `T`
984
- * @param generator Random data generator
985
- * @returns Nothing until you configure the generic argument `T`
986
- * @throws compile error
987
- *
988
- * @author Jeongho Nam - https://github.com/samchon
989
- */
990
- function createRandom(generator?: Partial<IRandomGenerator>): never;
991
-
992
- /**
993
- * Creates a resuable {@link random} function.
994
- *
995
- * @template T Type of the input value
996
- * @param generator Random data generator
997
- * @returns A reusable `random` function
998
- *
999
- * @author Jeongho Nam - https://github.com/samchon
1000
- */
1001
- function createRandom<T>(
1002
- generator?: Partial<IRandomGenerator>,
1003
- ): () => Resolved<T>;
1004
-
1005
- /**
1006
- * @internal
1007
- */
1008
- function createRandom(): never {
1009
- halt("createRandom");
1010
- }
1011
- const createRandomPure = /** @__PURE__ */ Object.assign<
1012
- typeof createRandom,
1013
- {}
1014
- >(createRandom, randomPure);
1015
- export { createRandomPure as createRandom };
1016
-
1017
- /**
1018
- * @internal
1019
- */
1020
- function halt(name: string): never {
1021
- throw new Error(
1022
- `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
1023
- );
1024
- }
1
+ import * as Namespace from "./functional/Namespace";
2
+
3
+ import { AssertionGuard } from "./AssertionGuard";
4
+ import { IRandomGenerator } from "./IRandomGenerator";
5
+ import { IValidation } from "./IValidation";
6
+ import { Resolved } from "./Resolved";
7
+ import { TypeGuardError } from "./TypeGuardError";
8
+
9
+ export * as functional from "./functional";
10
+ export * as http from "./http";
11
+ export * as json from "./json";
12
+ export * as misc from "./misc";
13
+ export * as notations from "./notations";
14
+ export * as protobuf from "./protobuf";
15
+ export * as reflect from "./reflect";
16
+ export * as tags from "./tags";
17
+
18
+ export * from "./schemas/metadata/IJsDocTagInfo";
19
+ export * from "./schemas/json/IJsonApplication";
20
+ export * from "./schemas/json/IJsonComponents";
21
+ export * from "./schemas/json/IJsonSchema";
22
+ export * from "./AssertionGuard";
23
+ export * from "./IRandomGenerator";
24
+ export * from "./IValidation";
25
+ export * from "./TypeGuardError";
26
+
27
+ export * from "./Primitive";
28
+ export * from "./Resolved";
29
+ export * from "./CamelCase";
30
+ export * from "./PascalCase";
31
+ export * from "./SnakeCase";
32
+
33
+ /* -----------------------------------------------------------
34
+ BASIC VALIDATORS
35
+ ----------------------------------------------------------- */
36
+ /**
37
+ * Asserts a value type.
38
+ *
39
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
40
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
41
+ * value is following the type `T`, just input parameter would be returned.
42
+ *
43
+ * If what you want is not asserting but just knowing whether the parametric value is
44
+ * following the type `T` or not, you can choose the {@link is} function instead.
45
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
46
+ * Also, if you want to automatically cast the parametric value to the type `T`
47
+ * when no problem (perform the assertion guard of type).
48
+ *
49
+ * On the other and, if you don't want to allow any superfluous property that is not
50
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
51
+ *
52
+ * @template T Type of the input value
53
+ * @param input A value to be asserted
54
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
55
+ * @returns Parametric input value
56
+ * @throws A {@link TypeGuardError} instance with detailed reason
57
+ *
58
+ * @author Jeongho Nam - https://github.com/samchon
59
+ */
60
+ function assert<T>(
61
+ input: T,
62
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
63
+ ): T;
64
+
65
+ /**
66
+ * Asserts a value type.
67
+ *
68
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
69
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
70
+ * value is following the type `T`, just input parameter would be returned.
71
+ *
72
+ * If what you want is not asserting but just knowing whether the parametric value is
73
+ * following the type `T` or not, you can choose the {@link is} function instead.
74
+ * Otherwise, you want to know all the errors, {@link validate} is the way to go.
75
+ *
76
+ * On the other and, if you don't want to allow any superfluous property that is not
77
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
78
+ *
79
+ * @template T Type of the input value
80
+ * @param input A value to be asserted
81
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
82
+ * @returns Parametric input value casted as `T`
83
+ * @throws A {@link TypeGuardError} instance with detailed reason
84
+ *
85
+ * @author Jeongho Nam - https://github.com/samchon
86
+ */
87
+ function assert<T>(
88
+ input: unknown,
89
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
90
+ ): T;
91
+
92
+ /**
93
+ * @internal
94
+ */
95
+ function assert(): never {
96
+ halt("assert");
97
+ }
98
+ const assertPure = /** @__PURE__ */ Object.assign<typeof assert, {}>(
99
+ assert,
100
+ /** @__PURE__ */ Namespace.assert("assert"),
101
+ );
102
+ export { assertPure as assert };
103
+
104
+ /**
105
+ * Assertion guard of a value type.
106
+ *
107
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
108
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
109
+ * value is following the type `T`, nothing would be returned, but the input value
110
+ * would be automatically casted to the type `T`. This is the concept of
111
+ * "Assertion Guard" of a value type.
112
+ *
113
+ * If what you want is not asserting but just knowing whether the parametric value is
114
+ * following the type `T` or not, you can choose the {@link is} function instead.
115
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
116
+ * Also, if you want to returns the parametric value when no problem, you can use
117
+ * {@link assert} function instead.
118
+ *
119
+ * On the other and, if you don't want to allow any superfluous property that is not
120
+ * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
121
+ *
122
+ * @template T Type of the input value
123
+ * @param input A value to be asserted
124
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
125
+ * @throws A {@link TypeGuardError} instance with detailed reason
126
+ *
127
+ * @author Jeongho Nam - https://github.com/samchon
128
+ */
129
+ function assertGuard<T>(
130
+ input: T,
131
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
132
+ ): asserts input is T;
133
+
134
+ /**
135
+ * Assertion guard of a value type.
136
+ *
137
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
138
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
139
+ * value is following the type `T`, nothing would be returned, but the input value
140
+ * would be automatically casted to the type `T`. This is the concept of
141
+ * "Assertion Guard" of a value type.
142
+ *
143
+ * If what you want is not asserting but just knowing whether the parametric value is
144
+ * following the type `T` or not, you can choose the {@link is} function instead.
145
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
146
+ * Also, if you want to returns the parametric value when no problem, you can use
147
+ * {@link assert} function instead.
148
+ *
149
+ * On the other and, if you don't want to allow any superfluous property that is not
150
+ * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
151
+ *
152
+ * @template T Type of the input value
153
+ * @param input A value to be asserted
154
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
155
+ * @throws A {@link TypeGuardError} instance with detailed reason
156
+ *
157
+ * @author Jeongho Nam - https://github.com/samchon
158
+ */
159
+ function assertGuard<T>(
160
+ input: unknown,
161
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
162
+ ): asserts input is T;
163
+
164
+ /**
165
+ * @internal
166
+ */
167
+ function assertGuard(): never {
168
+ halt("assertGuard");
169
+ }
170
+ const assertGuardPure = /** @__PURE__ */ Object.assign<typeof assertGuard, {}>(
171
+ assertGuard,
172
+ /** @__PURE__ */ Namespace.assert("assertGuard"),
173
+ );
174
+ export { assertGuardPure as assertGuard };
175
+
176
+ /**
177
+ * Tests a value type.
178
+ *
179
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
180
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
181
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
182
+ * returned.
183
+ *
184
+ * If what you want is not just knowing whether the parametric value is following the
185
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
186
+ * {@link assert} function instead. Also, if you want to know all the errors with
187
+ * detailed reasons, {@link validate} function would be useful.
188
+ *
189
+ * On the other and, if you don't want to allow any superfluous property that is not
190
+ * enrolled to the type `T`, you can use {@link equals} function instead.
191
+ *
192
+ * @template T Type of the input value
193
+ * @param input A value to be tested
194
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
195
+ * @returns Whether the parametric value is following the type `T` or not
196
+ *
197
+ * @author Jeongho Nam - https://github.com/samchon
198
+ */
199
+ function is<T>(input: T): input is T;
200
+
201
+ /**
202
+ * Tests a value type.
203
+ *
204
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
205
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
206
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
207
+ * returned.
208
+ *
209
+ * If what you want is not just knowing whether the parametric value is following the
210
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
211
+ * {@link assert} function instead. Also, if you want to know all the errors with
212
+ * detailed reasons, {@link validate} function would be useful.
213
+ *
214
+ * On the other and, if you don't want to allow any superfluous property that is not
215
+ * enrolled to the type `T`, you can use {@link equals} function instead.
216
+ *
217
+ * @template T Type of the input value
218
+ * @param input A value to be tested
219
+ * @returns Whether the parametric value is following the type `T` or not
220
+ *
221
+ * @author Jeongho Nam - https://github.com/samchon
222
+ */
223
+ function is<T>(input: unknown): input is T;
224
+
225
+ /**
226
+ * @internal
227
+ */
228
+ function is(): never {
229
+ halt("is");
230
+ }
231
+ const isPure = /** @__PURE__ */ Object.assign<typeof is, {}>(
232
+ is,
233
+ /** @__PURE__ */ Namespace.assert("is"),
234
+ );
235
+ export { isPure as is };
236
+
237
+ /**
238
+ * Validates a value type.
239
+ *
240
+ * Validates a parametric value type and archives all the type errors into an
241
+ * {@link IValidation.errors} array, if the parametric value is not following the
242
+ * type `T`. Of course, if the parametric value is following the type `T`, the
243
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
244
+ * would have the `true` value.
245
+ *
246
+ * If what you want is not finding all the error, but asserting the parametric value
247
+ * type with exception throwing, you can choose {@link assert} function instead.
248
+ * Otherwise, you just want to know whether the parametric value is matched with the
249
+ * type `T`, {@link is} function is the way to go.
250
+ *
251
+ * On the other and, if you don't want to allow any superfluous property that is not
252
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
253
+ *
254
+ * @template Type of the input value
255
+ * @param input A value to be validated
256
+ * @returns Validation result
257
+ *
258
+ * @author Jeongho Nam - https://github.com/samchon
259
+ */
260
+ function validate<T>(input: T): IValidation<T>;
261
+
262
+ /**
263
+ * Validates a value type.
264
+ *
265
+ * Validates a parametric value type and archives all the type errors into an
266
+ * {@link IValidation.errors} array, if the parametric value is not following the
267
+ * type `T`. Of course, if the parametric value is following the type `T`, the
268
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
269
+ * would have the `true` value.
270
+ *
271
+ * If what you want is not finding all the error, but asserting the parametric value
272
+ * type with exception throwing, you can choose {@link assert} function instead.
273
+ * Otherwise, you just want to know whether the parametric value is matched with the
274
+ * type `T`, {@link is} function is the way to go.
275
+ *
276
+ * On the other and, if you don't want to allow any superfluous property that is not
277
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
278
+ *
279
+ * @template Type of the input value
280
+ * @param input A value to be validated
281
+ * @returns Validation result
282
+ *
283
+ * @author Jeongho Nam - https://github.com/samchon
284
+ */
285
+ function validate<T>(input: unknown): IValidation<T>;
286
+
287
+ /**
288
+ * @internal
289
+ */
290
+ function validate(): never {
291
+ halt("validate");
292
+ }
293
+ const validatePure = /** @__PURE__ */ Object.assign<typeof validate, {}>(
294
+ validate,
295
+ /** @__PURE__ */ Namespace.validate(),
296
+ );
297
+ export { validatePure as validate };
298
+
299
+ /* -----------------------------------------------------------
300
+ STRICT VALIDATORS
301
+ ----------------------------------------------------------- */
302
+ /**
303
+ * Asserts equality between a value and its type.
304
+ *
305
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
306
+ * reason, if the parametric value is not following the type `T` or some superfluous
307
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
308
+ * following the type `T` without any superfluous property, just input parameter would
309
+ * be returned.
310
+ *
311
+ * If what you want is not asserting but just knowing whether the parametric value is
312
+ * following the type `T` or not, you can choose the {@link equals} function instead.
313
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
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 assert} function instead.
317
+ *
318
+ * @template T Type of the input value
319
+ * @param input A value to be asserted
320
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
321
+ * @returns Parametric input value
322
+ * @throws A {@link TypeGuardError} instance with detailed reason
323
+ *
324
+ * @author Jeongho Nam - https://github.com/samchon
325
+ */
326
+ function assertEquals<T>(
327
+ input: T,
328
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
329
+ ): T;
330
+
331
+ /**
332
+ * Asserts equality between a value and its type.
333
+ *
334
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
335
+ * reason, if the parametric value is not following the type `T` or some superfluous
336
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
337
+ * following the type `T` without any superfluous property, just input parameter would
338
+ * be returned.
339
+ *
340
+ * If what you want is not asserting but just knowing whether the parametric value is
341
+ * following the type `T` or not, you can choose the {@link equals} function instead.
342
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
343
+ *
344
+ * On the other hand, if you want to allow superfluous property that is not enrolled
345
+ * to the type `T`, you can use {@link assert} function instead.
346
+ *
347
+ * @template T Type of the input value
348
+ * @param input A value to be asserted
349
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
350
+ * @returns Parametric input value casted as `T`
351
+ * @throws A {@link TypeGuardError} instance with detailed reason
352
+ *
353
+ * @author Jeongho Nam - https://github.com/samchon
354
+ */
355
+ function assertEquals<T>(
356
+ input: unknown,
357
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
358
+ ): T;
359
+
360
+ /**
361
+ * @internal
362
+ */
363
+ function assertEquals(): never {
364
+ halt("assertEquals");
365
+ }
366
+ const assertEqualsPure = /** @__PURE__ */ Object.assign<
367
+ typeof assertEquals,
368
+ {}
369
+ >(assertEquals, /** @__PURE__ */ Namespace.assert("assertEquals"));
370
+ export { assertEqualsPure as assertEquals };
371
+
372
+ /**
373
+ * Assertion guard of a type with equality.
374
+ *
375
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
376
+ * reason, if the parametric value is not following the type `T` or some superfluous
377
+ * property that is not listed on the type `T` has been found.
378
+ *
379
+ * Otherwise, the value is following the type `T` without any superfluous property,
380
+ * nothing would be returned, but the input value would be automatically casted to
381
+ * the type `T`. This is the concept of "Assertion Guard" of a value type.
382
+ *
383
+ * If what you want is not asserting but just knowing whether the parametric value is
384
+ * following the type `T` or not, you can choose the {@link equals} function instead.
385
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
386
+ * Also, if you want to returns the parametric value when no problem, you can use
387
+ * {@link assert} function instead.
388
+ *
389
+ * On the other hand, if you want to allow superfluous property that is not enrolled
390
+ * to the type `T`, you can use {@link assertEquals} function instead.
391
+ *
392
+ * @template T Type of the input value
393
+ * @param input A value to be asserted
394
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
395
+ * @returns Parametric input value casted as `T`
396
+ * @throws A {@link TypeGuardError} instance with detailed reason
397
+ *
398
+ * @author Jeongho Nam - https://github.com/samchon
399
+ */
400
+ function assertGuardEquals<T>(
401
+ input: T,
402
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
403
+ ): asserts input is T;
404
+
405
+ /**
406
+ * Assertion guard of a type with equality.
407
+ *
408
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
409
+ * reason, if the parametric value is not following the type `T` or some superfluous
410
+ * property that is not listed on the type `T` has been found.
411
+ *
412
+ * Otherwise, the value is following the type `T` without any superfluous property,
413
+ * nothing would be returned, but the input value would be automatically casted to
414
+ * the type `T`. This is the concept of "Assertion Guard" of a value type.
415
+ *
416
+ * If what you want is not asserting but just knowing whether the parametric value is
417
+ * following the type `T` or not, you can choose the {@link equals} function instead.
418
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
419
+ * Also, if you want to returns the parametric value when no problem, you can use
420
+ * {@link assertEquals} function instead.
421
+ *
422
+ * On the other hand, if you want to allow superfluous property that is not enrolled
423
+ * to the type `T`, you can use {@link assertGuard} function instead.
424
+ *
425
+ * @template T Type of the input value
426
+ * @param input A value to be asserted
427
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
428
+ * @returns Parametric input value casted as `T`
429
+ * @throws A {@link TypeGuardError} instance with detailed reason
430
+ *
431
+ * @author Jeongho Nam - https://github.com/samchon
432
+ */
433
+ function assertGuardEquals<T>(
434
+ input: unknown,
435
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
436
+ ): asserts input is T;
437
+
438
+ /**
439
+ * @internal
440
+ */
441
+ function assertGuardEquals(): never {
442
+ halt("assertGuardEquals");
443
+ }
444
+ const assertGuardEqualsPure = /** @__PURE__ */ Object.assign<
445
+ typeof assertGuardEquals,
446
+ {}
447
+ >(assertGuardEquals, /** @__PURE__ */ Namespace.assert("assertGuardEquals"));
448
+ export { assertGuardEqualsPure as assertGuardEquals };
449
+
450
+ /**
451
+ * Tests equality between a value and its type.
452
+ *
453
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
454
+ * or not. If the parametric value is matched with the type `T` and there's not any
455
+ * superfluous property that is not listed on the type `T`, `true` value would be
456
+ * returned. Otherwise, the parametric value is not following the type `T` or some
457
+ * superfluous property exists, `false` value would be returned.
458
+ *
459
+ * If what you want is not just knowing whether the parametric value is following the
460
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
461
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
462
+ * detailed reasons, {@link validateEquals} function would be useful.
463
+ *
464
+ * On the other hand, if you want to allow superfluous property that is not enrolled
465
+ * to the type `T`, you can use {@link is} function instead.
466
+ *
467
+ * @template T Type of the input value
468
+ * @param input A value to be tested
469
+ * @returns Whether the parametric value is equivalent to the type `T` or not
470
+ *
471
+ * @author Jeongho Nam - https://github.com/samchon
472
+ */
473
+ function equals<T>(input: T): input is T;
474
+
475
+ /**
476
+ * Tests equality between a value and its type.
477
+ *
478
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
479
+ * or not. If the parametric value is matched with the type `T` and there's not any
480
+ * superfluous property that is not listed on the type `T`, `true` value would be
481
+ * returned. Otherwise, the parametric value is not following the type `T` or some
482
+ * superfluous property exists, `false` value would be returned.
483
+ *
484
+ * If what you want is not just knowing whether the parametric value is following the
485
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
486
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
487
+ * detailed reasons, {@link validateEquals} function would be useful.
488
+ *
489
+ * On the other hand, if you want to allow superfluous property that is not enrolled
490
+ * to the type `T`, you can use {@link is} function instead.
491
+ *
492
+ * @template T Type of the input value
493
+ * @param input A value to be tested
494
+ * @returns Whether the parametric value is equivalent to the type `T` or not
495
+ *
496
+ * @author Jeongho Nam - https://github.com/samchon
497
+ */
498
+ function equals<T>(input: unknown): input is T;
499
+
500
+ /**
501
+ * @internal
502
+ */
503
+ function equals(): never {
504
+ halt("equals");
505
+ }
506
+ const equalsPure = /** @__PURE__ */ Object.assign<typeof equals, {}>(
507
+ equals,
508
+ /** @__PURE__ */ Namespace.is(),
509
+ );
510
+ export { equalsPure as equals };
511
+
512
+ /**
513
+ * Validates equality between a value and its type.
514
+ *
515
+ * Validates a parametric value type and archives all the type errors into an
516
+ * {@link IValidation.errors} array, if the parametric value is not following the
517
+ * type `T` or some superfluous property that is not listed on the type `T` has been
518
+ * found. Of course, if the parametric value is following the type `T` and no
519
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
520
+ * and {@link IValidation.success} would have the `true` value.
521
+ *
522
+ * If what you want is not finding all the error, but asserting the parametric value
523
+ * type with exception throwing, you can choose {@link assert} function instead.
524
+ * Otherwise, you just want to know whether the parametric value is matched with the
525
+ * type `T`, {@link is} function is the way to go.
526
+ *
527
+ * On the other and, if you don't want to allow any superfluous property that is not
528
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
529
+ *
530
+ * @template Type of the input value
531
+ * @param input A value to be validated
532
+ * @returns Validation result
533
+ *
534
+ * @author Jeongho Nam - https://github.com/samchon
535
+ */
536
+ function validateEquals<T>(input: T): IValidation<T>;
537
+
538
+ /**
539
+ * Validates equality between a value and its type.
540
+ *
541
+ * Validates a parametric value type and archives all the type errors into an
542
+ * {@link IValidation.errors} array, if the parametric value is not following the
543
+ * type `T` or some superfluous property that is not listed on the type `T` has been
544
+ * found. Of course, if the parametric value is following the type `T` and no
545
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
546
+ * and {@link IValidation.success} would have the `true` value.
547
+ *
548
+ * If what you want is not finding all the error, but asserting the parametric value
549
+ * type with exception throwing, you can choose {@link assert} function instead.
550
+ * Otherwise, you just want to know whether the parametric value is matched with the
551
+ * type `T`, {@link is} function is the way to go.
552
+ *
553
+ * On the other and, if you don't want to allow any superfluous property that is not
554
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
555
+ *
556
+ * @template Type of the input value
557
+ * @param input A value to be validated
558
+ * @returns Validation result
559
+ *
560
+ * @author Jeongho Nam - https://github.com/samchon
561
+ */
562
+ function validateEquals<T>(input: unknown): IValidation<T>;
563
+
564
+ /**
565
+ * @internal
566
+ */
567
+ function validateEquals(): never {
568
+ halt("validateEquals");
569
+ }
570
+ const validateEqualsPure = /** @__PURE__ */ Object.assign<
571
+ typeof validateEquals,
572
+ {}
573
+ >(validateEquals, /** @__PURE__ */ Namespace.validate());
574
+ export { validateEqualsPure as validateEquals };
575
+
576
+ /* -----------------------------------------------------------
577
+ RANDOM
578
+ ----------------------------------------------------------- */
579
+ /**
580
+ * > You must configure the generic argument `T`.
581
+ *
582
+ * Generate random data.
583
+ *
584
+ * Generates a random data following type the `T`.
585
+ *
586
+ * For reference, this `typia.random()` function generates only primitive type.
587
+ * If there're some methods in the type `T` or its nested instances, those would
588
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
589
+ * would be generated instead.
590
+ *
591
+ * @template T Type of data to generate
592
+ * @param generator Random data generator
593
+ * @return Randomly generated data
594
+ *
595
+ * @author Jeongho Nam - https://github.com/samchon
596
+ */
597
+ function random(generator?: Partial<IRandomGenerator>): never;
598
+
599
+ /**
600
+ * Generate random data.
601
+ *
602
+ * Generates a random data following type the `T`.
603
+ *
604
+ * For reference, this `typia.random()` function generates only primitive type.
605
+ * If there're some methods in the type `T` or its nested instances, those would
606
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
607
+ * would be generated instead.
608
+ *
609
+ * @template T Type of data to generate
610
+ * @param generator Random data generator
611
+ * @return Randomly generated data
612
+ *
613
+ * @author Jeongho Nam - https://github.com/samchon
614
+ */
615
+ function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
616
+
617
+ /**
618
+ * @internal
619
+ */
620
+ function random(): never {
621
+ halt("random");
622
+ }
623
+ const randomPure = /** @__PURE__ */ Object.assign<typeof random, {}>(
624
+ random,
625
+ /** @__PURE__ */ Namespace.random(),
626
+ );
627
+ export { randomPure as random };
628
+
629
+ /* -----------------------------------------------------------
630
+ FACTORY FUNCTIONS
631
+ ----------------------------------------------------------- */
632
+ /**
633
+ * Creates a reusable {@link assert} function.
634
+ *
635
+ * @danger You must configure the generic argument `T`
636
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
637
+ * @returns Nothing until you configure the generic argument `T`
638
+ * @throws compile error
639
+ *
640
+ * @author Jeongho Nam - https://github.com/samchon
641
+ */
642
+ function createAssert(
643
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
644
+ ): never;
645
+
646
+ /**
647
+ * Creates a reusable {@link assert} function.
648
+ *
649
+ * @template T Type of the input value
650
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
651
+ * @returns A reusable `assert` function
652
+ *
653
+ * @author Jeongho Nam - https://github.com/samchon
654
+ */
655
+ function createAssert<T>(
656
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
657
+ ): (input: unknown) => T;
658
+
659
+ /**
660
+ * @internal
661
+ */
662
+ function createAssert<T>(): (input: unknown) => T {
663
+ halt("createAssert");
664
+ }
665
+ const createAssertPure = /** @__PURE__ */ Object.assign<
666
+ typeof createAssert,
667
+ {}
668
+ >(createAssert, assertPure);
669
+ export { createAssertPure as createAssert };
670
+
671
+ /**
672
+ * Creates a reusable {@link assertGuard} function.
673
+ *
674
+ * Note that, you've to declare the variable type of the factory function caller
675
+ * like below. If you don't declare the variable type, compilation error be thrown.
676
+ * This is the special rule of the TypeScript compiler.
677
+ *
678
+ * ```typescript
679
+ * // MUST DECLARE THE VARIABLE TYPE
680
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
681
+ *
682
+ * // IF NOT, COMPILATION ERROR BE OCCURED
683
+ * const func = typia.createAssertGuard<number>();
684
+ * ```
685
+ *
686
+ * > *Assertions require every name in the call target to be declared with an*
687
+ * > *explicit type annotation.*
688
+ *
689
+ * @danger You must configure the generic argument `T`
690
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
691
+ * @returns Nothing until you configure the generic argument `T`
692
+ * @throws compile error
693
+ *
694
+ * @author Jeongho Nam - https://github.com/samchon
695
+ */
696
+ function createAssertGuard(
697
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
698
+ ): never;
699
+
700
+ /**
701
+ * Creates a reusable {@link assertGuard} function.
702
+ *
703
+ * Note that, you've to declare the variable type of the factory function caller
704
+ * like below. If you don't declare the variable type, compilation error be thrown.
705
+ * This is the special rule of the TypeScript compiler.
706
+ *
707
+ * ```typescript
708
+ * // MUST DECLARE THE VARIABLE TYPE
709
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
710
+ *
711
+ * // IF NOT, COMPILATION ERROR BE OCCURED
712
+ * const func = typia.createAssertGuard<number>();
713
+ * ```
714
+ *
715
+ * > *Assertions require every name in the call target to be declared with an*
716
+ * > *explicit type annotation.*
717
+ *
718
+ * @returns Nothing until you configure the generic argument `T`
719
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
720
+ * @throws compile error
721
+ *
722
+ * @author Jeongho Nam - https://github.com/samchon
723
+ */
724
+ function createAssertGuard<T>(
725
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
726
+ ): (input: unknown) => AssertionGuard<T>;
727
+
728
+ /**
729
+ * @internal
730
+ */
731
+ function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
732
+ halt("createAssertGuard");
733
+ }
734
+ const createAssertGuardPure = /** @__PURE__ */ Object.assign<
735
+ typeof createAssertGuard,
736
+ {}
737
+ >(createAssertGuard, assertGuardPure);
738
+ export { createAssertGuardPure as createAssertGuard };
739
+
740
+ /**
741
+ * Creates a reusable {@link is} function.
742
+ *
743
+ * @danger You must configure the generic argument `T`
744
+ * @returns Nothing until you configure the generic argument `T`
745
+ * @throws compile error
746
+ *
747
+ * @author Jeongho Nam - https://github.com/samchon
748
+ */
749
+ function createIs(): never;
750
+
751
+ /**
752
+ * Creates a reusable {@link is} function.
753
+ *
754
+ * @template T Type of the input value
755
+ * @returns A reusable `is` function
756
+ *
757
+ * @author Jeongho Nam - https://github.com/samchon
758
+ */
759
+ function createIs<T>(): (input: unknown) => input is T;
760
+
761
+ /**
762
+ * @internal
763
+ */
764
+ function createIs<T>(): (input: unknown) => input is T {
765
+ halt("createIs");
766
+ }
767
+ const createIsPure = /** @__PURE__ */ Object.assign<typeof createIs, {}>(
768
+ createIs,
769
+ isPure,
770
+ );
771
+ export { createIsPure as createIs };
772
+
773
+ /**
774
+ * Creates a reusable {@link validate} function.
775
+ *
776
+ * @danger You must configure the generic argument `T`
777
+ * @returns Nothing until you configure the generic argument `T`
778
+ * @throws compile error
779
+ *
780
+ * @author Jeongho Nam - https://github.com/samchon
781
+ */
782
+ function createValidate(): never;
783
+
784
+ /**
785
+ * Creates a reusable {@link validate} function.
786
+ *
787
+ * @template T Type of the input value
788
+ * @returns A reusable `validate` function
789
+ *
790
+ * @author Jeongho Nam - https://github.com/samchon
791
+ */
792
+ function createValidate<T>(): (input: unknown) => IValidation<T>;
793
+
794
+ /**
795
+ * @internal
796
+ */
797
+ function createValidate(): (input: unknown) => IValidation {
798
+ halt("createValidate");
799
+ }
800
+ const createValidatePure = /** @__PURE__ */ Object.assign<
801
+ typeof createValidate,
802
+ {}
803
+ >(createValidate, validatePure);
804
+ export { createValidatePure as createValidate };
805
+
806
+ /**
807
+ * Creates a reusable {@link assertEquals} function.
808
+ *
809
+ * @danger You must configure the generic argument `T`
810
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
811
+ * @returns Nothing until you configure the generic argument `T`
812
+ * @throws compile error
813
+ *
814
+ * @author Jeongho Nam - https://github.com/samchon
815
+ */
816
+ function createAssertEquals(
817
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
818
+ ): never;
819
+
820
+ /**
821
+ * Creates a reusable {@link assertEquals} function.
822
+ *
823
+ * @template T Type of the input value
824
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
825
+ * @returns A reusable `assertEquals` function
826
+ *
827
+ * @author Jeongho Nam - https://github.com/samchon
828
+ */
829
+ function createAssertEquals<T>(
830
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
831
+ ): (input: unknown) => T;
832
+
833
+ /**
834
+ * @internal
835
+ */
836
+ function createAssertEquals<T>(): (input: unknown) => T {
837
+ halt("createAssertEquals");
838
+ }
839
+ const createAssertEqualsPure = /** @__PURE__ */ Object.assign<
840
+ typeof createAssertEquals,
841
+ {}
842
+ >(createAssertEquals, assertEqualsPure);
843
+ export { createAssertEqualsPure as createAssertEquals };
844
+
845
+ /**
846
+ * Creates a reusable {@link assertGuardEquals} function.
847
+ *
848
+ * Note that, you've to declare the variable type of the factory function caller
849
+ * like below. If you don't declare the variable type, compilation error be thrown.
850
+ * This is the special rule of the TypeScript compiler.
851
+ *
852
+ * ```typescript
853
+ * // MUST DECLARE THE VARIABLE TYPE
854
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
855
+ *
856
+ * // IF NOT, COMPILATION ERROR BE OCCURED
857
+ * const func = typia.createAssertGuardEquals<number>();
858
+ * ```
859
+ *
860
+ * > *Assertions require every name in the call target to be declared with an*
861
+ * > *explicit type annotation.*
862
+ *
863
+ * @danger You must configure the generic argument `T`
864
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
865
+ * @returns Nothing until you configure the generic argument `T`
866
+ * @throws compile error
867
+ *
868
+ * @author Jeongho Nam - https://github.com/samchon
869
+ */
870
+ function createAssertGuardEquals(
871
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
872
+ ): never;
873
+
874
+ /**
875
+ * Creates a reusable {@link assertGuardEquals} function.
876
+ *
877
+ * Note that, you've to declare the variable type of the factory function caller
878
+ * like below. If you don't declare the variable type, compilation error be thrown.
879
+ * This is the special rule of the TypeScript compiler.
880
+ *
881
+ * ```typescript
882
+ * // MUST DECLARE THE VARIABLE TYPE
883
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
884
+ *
885
+ * // IF NOT, COMPILATION ERROR BE OCCURED
886
+ * const func = typia.createAssertGuardEquals<number>();
887
+ * ```
888
+ *
889
+ * > *Assertions require every name in the call target to be declared with an*
890
+ * > *explicit type annotation.*
891
+ *
892
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
893
+ * @returns Nothing until you configure the generic argument `T`
894
+ * @throws compile error
895
+ *
896
+ * @author Jeongho Nam - https://github.com/samchon
897
+ */
898
+ function createAssertGuardEquals<T>(
899
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
900
+ ): (input: unknown) => AssertionGuard<T>;
901
+
902
+ /**
903
+ * @internal
904
+ */
905
+ function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T> {
906
+ halt("createAssertGuardEquals");
907
+ }
908
+ const createAssertGuardEqualsPure = /** @__PURE__ */ Object.assign<
909
+ typeof createAssertGuardEquals,
910
+ {}
911
+ >(createAssertGuardEquals, assertGuardEqualsPure);
912
+ export { createAssertGuardEqualsPure as createAssertGuardEquals };
913
+
914
+ /**
915
+ * Creates a reusable {@link equals} function.
916
+ *
917
+ * @danger You must configure the generic argument `T`
918
+ * @returns Nothing until you configure the generic argument `T`
919
+ * @throws compile error
920
+ *
921
+ * @author Jeongho Nam - https://github.com/samchon
922
+ */
923
+ function createEquals(): never;
924
+
925
+ /**
926
+ * Creates a reusable {@link equals} function.
927
+ *
928
+ * @template T Type of the input value
929
+ * @returns A reusable `equals` function
930
+ *
931
+ * @author Jeongho Nam - https://github.com/samchon
932
+ */
933
+ function createEquals<T>(): (input: unknown) => input is T;
934
+
935
+ /**
936
+ * @internal
937
+ */
938
+ function createEquals<T>(): (input: unknown) => input is T {
939
+ halt("createEquals");
940
+ }
941
+ const createEqualsPure = /** @__PURE__ */ Object.assign<
942
+ typeof createEquals,
943
+ {}
944
+ >(createEquals, equalsPure);
945
+ export { createEqualsPure as createEquals };
946
+
947
+ /**
948
+ * Creates a reusable {@link validateEquals} function.
949
+ *
950
+ * @danger You must configure the generic argument `T`
951
+ * @returns Nothing until you configure the generic argument `T`
952
+ * @throws compile error
953
+ *
954
+ * @author Jeongho Nam - https://github.com/samchon
955
+ */
956
+ function createValidateEquals(): never;
957
+
958
+ /**
959
+ * Creates a reusable {@link validateEquals} function.
960
+ *
961
+ * @template T Type of the input value
962
+ * @returns A reusable `validateEquals` function
963
+ *
964
+ * @author Jeongho Nam - https://github.com/samchon
965
+ */
966
+ function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
967
+
968
+ /**
969
+ * @internal
970
+ */
971
+ function createValidateEquals(): (input: unknown) => IValidation {
972
+ halt("createValidateEquals");
973
+ }
974
+ const createValidateEqualsPure = /** @__PURE__ */ Object.assign<
975
+ typeof createValidateEquals,
976
+ {}
977
+ >(createValidateEquals, validateEqualsPure);
978
+ export { createValidateEqualsPure as createValidateEquals };
979
+
980
+ /**
981
+ * Creates a reusable {@link random} function.
982
+ *
983
+ * @danger You must configure the generic argument `T`
984
+ * @param generator Random data generator
985
+ * @returns Nothing until you configure the generic argument `T`
986
+ * @throws compile error
987
+ *
988
+ * @author Jeongho Nam - https://github.com/samchon
989
+ */
990
+ function createRandom(generator?: Partial<IRandomGenerator>): never;
991
+
992
+ /**
993
+ * Creates a resuable {@link random} function.
994
+ *
995
+ * @template T Type of the input value
996
+ * @param generator Random data generator
997
+ * @returns A reusable `random` function
998
+ *
999
+ * @author Jeongho Nam - https://github.com/samchon
1000
+ */
1001
+ function createRandom<T>(
1002
+ generator?: Partial<IRandomGenerator>,
1003
+ ): () => Resolved<T>;
1004
+
1005
+ /**
1006
+ * @internal
1007
+ */
1008
+ function createRandom(): never {
1009
+ halt("createRandom");
1010
+ }
1011
+ const createRandomPure = /** @__PURE__ */ Object.assign<
1012
+ typeof createRandom,
1013
+ {}
1014
+ >(createRandom, randomPure);
1015
+ export { createRandomPure as createRandom };
1016
+
1017
+ /**
1018
+ * @internal
1019
+ */
1020
+ function halt(name: string): never {
1021
+ throw new Error(
1022
+ `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
1023
+ );
1024
+ }