typia 5.3.12-dev.20240119 → 5.3.12-dev.20240121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/module.ts CHANGED
@@ -1,965 +1,965 @@
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
-
8
- export * as http from "./http";
9
- export * as json from "./json";
10
- export * as misc from "./misc";
11
- export * as notations from "./notations";
12
- export * as protobuf from "./protobuf";
13
- export * as reflect from "./reflect";
14
- export * as tags from "./tags";
15
-
16
- export * from "./schemas/metadata/IJsDocTagInfo";
17
- export * from "./schemas/json/IJsonApplication";
18
- export * from "./schemas/json/IJsonComponents";
19
- export * from "./schemas/json/IJsonSchema";
20
- export * from "./AssertionGuard";
21
- export * from "./IRandomGenerator";
22
- export * from "./IValidation";
23
- export * from "./TypeGuardError";
24
-
25
- export * from "./Primitive";
26
- export * from "./Resolved";
27
- export * from "./CamelCase";
28
- export * from "./PascalCase";
29
- export * from "./SnakeCase";
30
-
31
- /* -----------------------------------------------------------
32
- BASIC VALIDATORS
33
- ----------------------------------------------------------- */
34
- /**
35
- * Asserts a value type.
36
- *
37
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
38
- * reason, if the parametric value is not following the type `T`. Otherwise, the
39
- * value is following the type `T`, just input parameter would be returned.
40
- *
41
- * If what you want is not asserting but just knowing whether the parametric value is
42
- * following the type `T` or not, you can choose the {@link is} function instead.
43
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
44
- * Also, if you want to automatically cast the parametric value to the type `T`
45
- * when no problem (perform the assertion guard of type).
46
- *
47
- * On the other and, if you don't want to allow any superfluous property that is not
48
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
49
- *
50
- * @template T Type of the input value
51
- * @param input A value to be asserted
52
- * @returns Parametric input value
53
- * @throws A {@link TypeGuardError} instance with detailed reason
54
- *
55
- * @author Jeongho Nam - https://github.com/samchon
56
- */
57
- function assert<T>(input: T): T;
58
-
59
- /**
60
- * Asserts a value type.
61
- *
62
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
63
- * reason, if the parametric value is not following the type `T`. Otherwise, the
64
- * value is following the type `T`, just input parameter would be returned.
65
- *
66
- * If what you want is not asserting but just knowing whether the parametric value is
67
- * following the type `T` or not, you can choose the {@link is} function instead.
68
- * Otherwise, you want to know all the errors, {@link validate} is the way to go.
69
- *
70
- * On the other and, if you don't want to allow any superfluous property that is not
71
- * enrolled to the type `T`, you can use {@link assertEquals} function instead.
72
- *
73
- * @template T Type of the input value
74
- * @param input A value to be asserted
75
- * @returns Parametric input value casted as `T`
76
- * @throws A {@link TypeGuardError} instance with detailed reason
77
- *
78
- * @author Jeongho Nam - https://github.com/samchon
79
- */
80
- function assert<T>(input: unknown): T;
81
-
82
- /**
83
- * @internal
84
- */
85
- function assert(): never {
86
- halt("assert");
87
- }
88
- const assertPure = /** @__PURE__ */ Object.assign<typeof assert, {}>(
89
- assert,
90
- /** @__PURE__ */ Namespace.assert("assert"),
91
- );
92
- export { assertPure as assert };
93
-
94
- /**
95
- * Assertion guard of a value type.
96
- *
97
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
98
- * reason, if the parametric value is not following the type `T`. Otherwise, the
99
- * value is following the type `T`, nothing would be returned, but the input value
100
- * would be automatically casted to the type `T`. This is the concept of
101
- * "Assertion Guard" of a value type.
102
- *
103
- * If what you want is not asserting but just knowing whether the parametric value is
104
- * following the type `T` or not, you can choose the {@link is} function instead.
105
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
106
- * Also, if you want to returns the parametric value when no problem, you can use
107
- * {@link assert} function instead.
108
- *
109
- * On the other and, if you don't want to allow any superfluous property that is not
110
- * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
111
- *
112
- * @template T Type of the input value
113
- * @param input A value to be asserted
114
- * @throws A {@link TypeGuardError} instance with detailed reason
115
- *
116
- * @author Jeongho Nam - https://github.com/samchon
117
- */
118
- function assertGuard<T>(input: T): asserts input is T;
119
-
120
- /**
121
- * Assertion guard of a value type.
122
- *
123
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
124
- * reason, if the parametric value is not following the type `T`. Otherwise, the
125
- * value is following the type `T`, nothing would be returned, but the input value
126
- * would be automatically casted to the type `T`. This is the concept of
127
- * "Assertion Guard" of a value type.
128
- *
129
- * If what you want is not asserting but just knowing whether the parametric value is
130
- * following the type `T` or not, you can choose the {@link is} function instead.
131
- * Otherwise you want to know all the errors, {@link validate} is the way to go.
132
- * Also, if you want to returns the parametric value when no problem, you can use
133
- * {@link assert} function instead.
134
- *
135
- * On the other and, if you don't want to allow any superfluous property that is not
136
- * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
137
- *
138
- * @template T Type of the input value
139
- * @param input A value to be asserted
140
- * @throws A {@link TypeGuardError} instance with detailed reason
141
- *
142
- * @author Jeongho Nam - https://github.com/samchon
143
- */
144
- function assertGuard<T>(input: unknown): asserts input is T;
145
-
146
- /**
147
- * @internal
148
- */
149
- function assertGuard(): never {
150
- halt("assertGuard");
151
- }
152
- const assertGuardPure = /** @__PURE__ */ Object.assign<typeof assertGuard, {}>(
153
- assertGuard,
154
- /** @__PURE__ */ Namespace.assert("assertGuard"),
155
- );
156
- export { assertGuardPure as assertGuard };
157
-
158
- /**
159
- * Tests a value type.
160
- *
161
- * Tests a parametric value type and returns whether it's following the type `T` or not.
162
- * If the parametric value is matched with the type `T`, `true` value would be returned.
163
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
164
- * returned.
165
- *
166
- * If what you want is not just knowing whether the parametric value is following the
167
- * type `T` or not, but throwing an exception with detailed reason, you can choose
168
- * {@link assert} function instead. Also, if you want to know all the errors with
169
- * detailed reasons, {@link validate} function would be useful.
170
- *
171
- * On the other and, if you don't want to allow any superfluous property that is not
172
- * enrolled to the type `T`, you can use {@link equals} function instead.
173
- *
174
- * @template T Type of the input value
175
- * @param input A value to be tested
176
- * @returns Whether the parametric value is following the type `T` or not
177
- *
178
- * @author Jeongho Nam - https://github.com/samchon
179
- */
180
- function is<T>(input: T): input is T;
181
-
182
- /**
183
- * Tests a value type.
184
- *
185
- * Tests a parametric value type and returns whether it's following the type `T` or not.
186
- * If the parametric value is matched with the type `T`, `true` value would be returned.
187
- * Otherwise, the parametric value is not following the type `T`, `false` value would be
188
- * returned.
189
- *
190
- * If what you want is not just knowing whether the parametric value is following the
191
- * type `T` or not, but throwing an exception with detailed reason, you can choose
192
- * {@link assert} function instead. Also, if you want to know all the errors with
193
- * detailed reasons, {@link validate} function would be useful.
194
- *
195
- * On the other and, if you don't want to allow any superfluous property that is not
196
- * enrolled to the type `T`, you can use {@link equals} function instead.
197
- *
198
- * @template T Type of the input value
199
- * @param input A value to be tested
200
- * @returns Whether the parametric value is following the type `T` or not
201
- *
202
- * @author Jeongho Nam - https://github.com/samchon
203
- */
204
- function is<T>(input: unknown): input is T;
205
-
206
- /**
207
- * @internal
208
- */
209
- function is(): never {
210
- halt("is");
211
- }
212
- const isPure = /** @__PURE__ */ Object.assign<typeof is, {}>(
213
- is,
214
- /** @__PURE__ */ Namespace.assert("is"),
215
- );
216
- export { isPure as is };
217
-
218
- /**
219
- * Validates a value type.
220
- *
221
- * Validates a parametric value type and archives all the type errors into an
222
- * {@link IValidation.errors} array, if the parametric value is not following the
223
- * type `T`. Of course, if the parametric value is following the type `T`, the
224
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
225
- * would have the `true` value.
226
- *
227
- * If what you want is not finding all the error, but asserting the parametric value
228
- * type with exception throwing, you can choose {@link assert} function instead.
229
- * Otherwise, you just want to know whether the parametric value is matched with the
230
- * type `T`, {@link is} function is the way to go.
231
- *
232
- * On the other and, if you don't want to allow any superfluous property that is not
233
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
234
- *
235
- * @template Type of the input value
236
- * @param input A value to be validated
237
- * @returns Validation result
238
- *
239
- * @author Jeongho Nam - https://github.com/samchon
240
- */
241
- function validate<T>(input: T): IValidation<T>;
242
-
243
- /**
244
- * Validates a value type.
245
- *
246
- * Validates a parametric value type and archives all the type errors into an
247
- * {@link IValidation.errors} array, if the parametric value is not following the
248
- * type `T`. Of course, if the parametric value is following the type `T`, the
249
- * {@link IValidation.errors} array would be empty and {@link IValidation.success}
250
- * would have the `true` value.
251
- *
252
- * If what you want is not finding all the error, but asserting the parametric value
253
- * type with exception throwing, you can choose {@link assert} function instead.
254
- * Otherwise, you just want to know whether the parametric value is matched with the
255
- * type `T`, {@link is} function is the way to go.
256
- *
257
- * On the other and, if you don't want to allow any superfluous property that is not
258
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
259
- *
260
- * @template Type of the input value
261
- * @param input A value to be validated
262
- * @returns Validation result
263
- *
264
- * @author Jeongho Nam - https://github.com/samchon
265
- */
266
- function validate<T>(input: unknown): IValidation<T>;
267
-
268
- /**
269
- * @internal
270
- */
271
- function validate(): never {
272
- halt("validate");
273
- }
274
- const validatePure = /** @__PURE__ */ Object.assign<typeof validate, {}>(
275
- validate,
276
- /** @__PURE__ */ Namespace.validate(),
277
- );
278
- export { validatePure as validate };
279
-
280
- /* -----------------------------------------------------------
281
- STRICT VALIDATORS
282
- ----------------------------------------------------------- */
283
- /**
284
- * Asserts equality between a value and its type.
285
- *
286
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
287
- * reason, if the parametric value is not following the type `T` or some superfluous
288
- * property that is not listed on the type `T` has been found. Otherwise, the value is
289
- * following the type `T` without any superfluous property, just input parameter would
290
- * be returned.
291
- *
292
- * If what you want is not asserting but just knowing whether the parametric value is
293
- * following the type `T` or not, you can choose the {@link equals} function instead.
294
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
295
- *
296
- * On the other hand, if you want to allow superfluous property that is not enrolled
297
- * to the type `T`, you can use {@link assert} function instead.
298
- *
299
- * @template T Type of the input value
300
- * @param input A value to be asserted
301
- * @returns Parametric input value
302
- * @throws A {@link TypeGuardError} instance with detailed reason
303
- *
304
- * @author Jeongho Nam - https://github.com/samchon
305
- */
306
- function assertEquals<T>(input: T): T;
307
-
308
- /**
309
- * Asserts equality between a value and its type.
310
- *
311
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
312
- * reason, if the parametric value is not following the type `T` or some superfluous
313
- * property that is not listed on the type `T` has been found. Otherwise, the value is
314
- * following the type `T` without any superfluous property, just input parameter would
315
- * be returned.
316
- *
317
- * If what you want is not asserting but just knowing whether the parametric value is
318
- * following the type `T` or not, you can choose the {@link equals} function instead.
319
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
320
- *
321
- * On the other hand, if you want to allow superfluous property that is not enrolled
322
- * to the type `T`, you can use {@link assert} function instead.
323
- *
324
- * @template T Type of the input value
325
- * @param input A value to be asserted
326
- * @returns Parametric input value casted as `T`
327
- * @throws A {@link TypeGuardError} instance with detailed reason
328
- *
329
- * @author Jeongho Nam - https://github.com/samchon
330
- */
331
- function assertEquals<T>(input: unknown): T;
332
-
333
- /**
334
- * @internal
335
- */
336
- function assertEquals(): never {
337
- halt("assertEquals");
338
- }
339
- const assertEqualsPure = /** @__PURE__ */ Object.assign<
340
- typeof assertEquals,
341
- {}
342
- >(assertEquals, /** @__PURE__ */ Namespace.assert("assertEquals"));
343
- export { assertEqualsPure as assertEquals };
344
-
345
- /**
346
- * Assertion guard of a type with equality.
347
- *
348
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
349
- * reason, if the parametric value is not following the type `T` or some superfluous
350
- * property that is not listed on the type `T` has been found.
351
- *
352
- * Otherwise, the value is following the type `T` without any superfluous property,
353
- * nothing would be returned, but the input value would be automatically casted to
354
- * the type `T`. This is the concept of "Assertion Guard" of a value type.
355
- *
356
- * If what you want is not asserting but just knowing whether the parametric value is
357
- * following the type `T` or not, you can choose the {@link equals} function instead.
358
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
359
- * Also, if you want to returns the parametric value when no problem, you can use
360
- * {@link assert} function instead.
361
- *
362
- * On the other hand, if you want to allow superfluous property that is not enrolled
363
- * to the type `T`, you can use {@link assertEquals} function instead.
364
- *
365
- * @template T Type of the input value
366
- * @param input A value to be asserted
367
- * @returns Parametric input value casted as `T`
368
- * @throws A {@link TypeGuardError} instance with detailed reason
369
- *
370
- * @author Jeongho Nam - https://github.com/samchon
371
- */
372
- function assertGuardEquals<T>(input: T): asserts input is T;
373
-
374
- /**
375
- * Assertion guard of a type with equality.
376
- *
377
- * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
378
- * reason, if the parametric value is not following the type `T` or some superfluous
379
- * property that is not listed on the type `T` has been found.
380
- *
381
- * Otherwise, the value is following the type `T` without any superfluous property,
382
- * nothing would be returned, but the input value would be automatically casted to
383
- * the type `T`. This is the concept of "Assertion Guard" of a value type.
384
- *
385
- * If what you want is not asserting but just knowing whether the parametric value is
386
- * following the type `T` or not, you can choose the {@link equals} function instead.
387
- * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
388
- * Also, if you want to returns the parametric value when no problem, you can use
389
- * {@link assertEquals} function instead.
390
- *
391
- * On the other hand, if you want to allow superfluous property that is not enrolled
392
- * to the type `T`, you can use {@link assertGuard} function instead.
393
- *
394
- * @template T Type of the input value
395
- * @param input A value to be asserted
396
- * @returns Parametric input value casted as `T`
397
- * @throws A {@link TypeGuardError} instance with detailed reason
398
- *
399
- * @author Jeongho Nam - https://github.com/samchon
400
- */
401
- function assertGuardEquals<T>(input: unknown): asserts input is T;
402
-
403
- /**
404
- * @internal
405
- */
406
- function assertGuardEquals(): never {
407
- halt("assertGuardEquals");
408
- }
409
- const assertGuardEqualsPure = /** @__PURE__ */ Object.assign<
410
- typeof assertGuardEquals,
411
- {}
412
- >(assertGuardEquals, /** @__PURE__ */ Namespace.assert("assertGuardEquals"));
413
- export { assertGuardEqualsPure as assertGuardEquals };
414
-
415
- /**
416
- * Tests equality between a value and its type.
417
- *
418
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
419
- * or not. If the parametric value is matched with the type `T` and there's not any
420
- * superfluous property that is not listed on the type `T`, `true` value would be
421
- * returned. Otherwise, the parametric value is not following the type `T` or some
422
- * superfluous property exists, `false` value would be returned.
423
- *
424
- * If what you want is not just knowing whether the parametric value is following the
425
- * type `T` or not, but throwing an exception with detailed reason, you can choose
426
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
427
- * detailed reasons, {@link validateEquals} function would be useful.
428
- *
429
- * On the other hand, if you want to allow superfluous property that is not enrolled
430
- * to the type `T`, you can use {@link is} function instead.
431
- *
432
- * @template T Type of the input value
433
- * @param input A value to be tested
434
- * @returns Whether the parametric value is equivalent to the type `T` or not
435
- *
436
- * @author Jeongho Nam - https://github.com/samchon
437
- */
438
- function equals<T>(input: T): input is T;
439
-
440
- /**
441
- * Tests equality between a value and its type.
442
- *
443
- * Tests a parametric value type and returns whether it's equivalent to the type `T`
444
- * or not. If the parametric value is matched with the type `T` and there's not any
445
- * superfluous property that is not listed on the type `T`, `true` value would be
446
- * returned. Otherwise, the parametric value is not following the type `T` or some
447
- * superfluous property exists, `false` value would be returned.
448
- *
449
- * If what you want is not just knowing whether the parametric value is following the
450
- * type `T` or not, but throwing an exception with detailed reason, you can choose
451
- * {@link assertEquals} function instead. Also, if you want to know all the errors with
452
- * detailed reasons, {@link validateEquals} function would be useful.
453
- *
454
- * On the other hand, if you want to allow superfluous property that is not enrolled
455
- * to the type `T`, you can use {@link is} function instead.
456
- *
457
- * @template T Type of the input value
458
- * @param input A value to be tested
459
- * @returns Whether the parametric value is equivalent to the type `T` or not
460
- *
461
- * @author Jeongho Nam - https://github.com/samchon
462
- */
463
- function equals<T>(input: unknown): input is T;
464
-
465
- /**
466
- * @internal
467
- */
468
- function equals(): never {
469
- halt("equals");
470
- }
471
- const equalsPure = /** @__PURE__ */ Object.assign<typeof equals, {}>(
472
- equals,
473
- /** @__PURE__ */ Namespace.is(),
474
- );
475
- export { equalsPure as equals };
476
-
477
- /**
478
- * Validates equality between a value and its type.
479
- *
480
- * Validates a parametric value type and archives all the type errors into an
481
- * {@link IValidation.errors} array, if the parametric value is not following the
482
- * type `T` or some superfluous property that is not listed on the type `T` has been
483
- * found. Of course, if the parametric value is following the type `T` and no
484
- * superfluous property exists, the {@link IValidation.errors} array would be empty
485
- * and {@link IValidation.success} would have the `true` value.
486
- *
487
- * If what you want is not finding all the error, but asserting the parametric value
488
- * type with exception throwing, you can choose {@link assert} function instead.
489
- * Otherwise, you just want to know whether the parametric value is matched with the
490
- * type `T`, {@link is} function is the way to go.
491
- *
492
- * On the other and, if you don't want to allow any superfluous property that is not
493
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
494
- *
495
- * @template Type of the input value
496
- * @param input A value to be validated
497
- * @returns Validation result
498
- *
499
- * @author Jeongho Nam - https://github.com/samchon
500
- */
501
- function validateEquals<T>(input: T): IValidation<T>;
502
-
503
- /**
504
- * Validates equality between a value and its type.
505
- *
506
- * Validates a parametric value type and archives all the type errors into an
507
- * {@link IValidation.errors} array, if the parametric value is not following the
508
- * type `T` or some superfluous property that is not listed on the type `T` has been
509
- * found. Of course, if the parametric value is following the type `T` and no
510
- * superfluous property exists, the {@link IValidation.errors} array would be empty
511
- * and {@link IValidation.success} would have the `true` value.
512
- *
513
- * If what you want is not finding all the error, but asserting the parametric value
514
- * type with exception throwing, you can choose {@link assert} function instead.
515
- * Otherwise, you just want to know whether the parametric value is matched with the
516
- * type `T`, {@link is} function is the way to go.
517
- *
518
- * On the other and, if you don't want to allow any superfluous property that is not
519
- * enrolled to the type `T`, you can use {@link validateEquals} function instead.
520
- *
521
- * @template Type of the input value
522
- * @param input A value to be validated
523
- * @returns Validation result
524
- *
525
- * @author Jeongho Nam - https://github.com/samchon
526
- */
527
- function validateEquals<T>(input: unknown): IValidation<T>;
528
-
529
- /**
530
- * @internal
531
- */
532
- function validateEquals(): never {
533
- halt("validateEquals");
534
- }
535
- const validateEqualsPure = /** @__PURE__ */ Object.assign<
536
- typeof validateEquals,
537
- {}
538
- >(validateEquals, /** @__PURE__ */ Namespace.validate());
539
- export { validateEqualsPure as validateEquals };
540
-
541
- /* -----------------------------------------------------------
542
- RANDOM
543
- ----------------------------------------------------------- */
544
- /**
545
- * > You must configure the generic argument `T`.
546
- *
547
- * Generate random data.
548
- *
549
- * Generates a random data following type the `T`.
550
- *
551
- * For reference, this `typia.random()` function generates only primitive type.
552
- * If there're some methods in the type `T` or its nested instances, those would
553
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
554
- * would be generated instead.
555
- *
556
- * @template T Type of data to generate
557
- * @param generator Random data generator
558
- * @return Randomly generated data
559
- *
560
- * @author Jeongho Nam - https://github.com/samchon
561
- */
562
- function random(generator?: Partial<IRandomGenerator>): never;
563
-
564
- /**
565
- * Generate random data.
566
- *
567
- * Generates a random data following type the `T`.
568
- *
569
- * For reference, this `typia.random()` function generates only primitive type.
570
- * If there're some methods in the type `T` or its nested instances, those would
571
- * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
572
- * would be generated instead.
573
- *
574
- * @template T Type of data to generate
575
- * @param generator Random data generator
576
- * @return Randomly generated data
577
- *
578
- * @author Jeongho Nam - https://github.com/samchon
579
- */
580
- function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
581
-
582
- /**
583
- * @internal
584
- */
585
- function random(): never {
586
- halt("random");
587
- }
588
- const randomPure = /** @__PURE__ */ Object.assign<typeof random, {}>(
589
- random,
590
- /** @__PURE__ */ Namespace.random(),
591
- );
592
- export { randomPure as random };
593
-
594
- /* -----------------------------------------------------------
595
- FACTORY FUNCTIONS
596
- ----------------------------------------------------------- */
597
- /**
598
- * Creates a reusable {@link assert} function.
599
- *
600
- * @danger You must configure the generic argument `T`
601
- * @returns Nothing until you configure the generic argument `T`
602
- * @throws compile error
603
- *
604
- * @author Jeongho Nam - https://github.com/samchon
605
- */
606
- function createAssert(): never;
607
-
608
- /**
609
- * Creates a reusable {@link assert} function.
610
- *
611
- * @template T Type of the input value
612
- * @returns A reusable `assert` function
613
- *
614
- * @author Jeongho Nam - https://github.com/samchon
615
- */
616
- function createAssert<T>(): (input: unknown) => T;
617
-
618
- /**
619
- * @internal
620
- */
621
- function createAssert<T>(): (input: unknown) => T {
622
- halt("createAssert");
623
- }
624
- const createAssertPure = /** @__PURE__ */ Object.assign<
625
- typeof createAssert,
626
- {}
627
- >(createAssert, assert);
628
- export { createAssertPure as createAssert };
629
-
630
- /**
631
- * Creates a reusable {@link assertGuard} function.
632
- *
633
- * Note that, you've to declare the variable type of the factory function caller
634
- * like below. If you don't declare the variable type, compilation error be thrown.
635
- * This is the special rule of the TypeScript compiler.
636
- *
637
- * ```typescript
638
- * // MUST DECLARE THE VARIABLE TYPE
639
- * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
640
- *
641
- * // IF NOT, COMPILATION ERROR BE OCCURED
642
- * const func = typia.createAssertGuard<number>();
643
- * ```
644
- *
645
- * > *Assertions require every name in the call target to be declared with an*
646
- * > *explicit type annotation.*
647
- *
648
- * @danger You must configure the generic argument `T`
649
- * @returns Nothing until you configure the generic argument `T`
650
- * @throws compile error
651
- *
652
- * @author Jeongho Nam - https://github.com/samchon
653
- */
654
- function createAssertGuard(): never;
655
-
656
- /**
657
- * Creates a reusable {@link assertGuard} function.
658
- *
659
- * Note that, you've to declare the variable type of the factory function caller
660
- * like below. If you don't declare the variable type, compilation error be thrown.
661
- * This is the special rule of the TypeScript compiler.
662
- *
663
- * ```typescript
664
- * // MUST DECLARE THE VARIABLE TYPE
665
- * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
666
- *
667
- * // IF NOT, COMPILATION ERROR BE OCCURED
668
- * const func = typia.createAssertGuard<number>();
669
- * ```
670
- *
671
- * > *Assertions require every name in the call target to be declared with an*
672
- * > *explicit type annotation.*
673
- *
674
- * @returns Nothing until you configure the generic argument `T`
675
- * @throws compile error
676
- *
677
- * @author Jeongho Nam - https://github.com/samchon
678
- */
679
- function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T>;
680
-
681
- /**
682
- * @internal
683
- */
684
- function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
685
- halt("createAssertGuard");
686
- }
687
- const createAssertGuardPure = /** @__PURE__ */ Object.assign<
688
- typeof createAssertGuard,
689
- {}
690
- >(createAssertGuard, assertGuard);
691
- export { createAssertGuardPure as createAssertGuard };
692
-
693
- /**
694
- * Creates a reusable {@link is} function.
695
- *
696
- * @danger You must configure the generic argument `T`
697
- * @returns Nothing until you configure the generic argument `T`
698
- * @throws compile error
699
- *
700
- * @author Jeongho Nam - https://github.com/samchon
701
- */
702
- function createIs(): never;
703
-
704
- /**
705
- * Creates a reusable {@link is} function.
706
- *
707
- * @template T Type of the input value
708
- * @returns A reusable `is` function
709
- *
710
- * @author Jeongho Nam - https://github.com/samchon
711
- */
712
- function createIs<T>(): (input: unknown) => input is T;
713
-
714
- /**
715
- * @internal
716
- */
717
- function createIs<T>(): (input: unknown) => input is T {
718
- halt("createIs");
719
- }
720
- const createIsPure = /** @__PURE__ */ Object.assign<typeof createIs, {}>(
721
- createIs,
722
- is,
723
- );
724
- export { createIsPure as createIs };
725
-
726
- /**
727
- * Creates a reusable {@link validate} function.
728
- *
729
- * @danger You must configure the generic argument `T`
730
- * @returns Nothing until you configure the generic argument `T`
731
- * @throws compile error
732
- *
733
- * @author Jeongho Nam - https://github.com/samchon
734
- */
735
- function createValidate(): never;
736
-
737
- /**
738
- * Creates a reusable {@link validate} function.
739
- *
740
- * @template T Type of the input value
741
- * @returns A reusable `validate` function
742
- *
743
- * @author Jeongho Nam - https://github.com/samchon
744
- */
745
- function createValidate<T>(): (input: unknown) => IValidation<T>;
746
-
747
- /**
748
- * @internal
749
- */
750
- function createValidate(): (input: unknown) => IValidation {
751
- halt("createValidate");
752
- }
753
- const createValidatePure = /** @__PURE__ */ Object.assign<
754
- typeof createValidate,
755
- {}
756
- >(createValidate, validate);
757
- export { createValidatePure as createValidate };
758
-
759
- /**
760
- * Creates a reusable {@link assertEquals} function.
761
- *
762
- * @danger You must configure the generic argument `T`
763
- * @returns Nothing until you configure the generic argument `T`
764
- * @throws compile error
765
- *
766
- * @author Jeongho Nam - https://github.com/samchon
767
- */
768
- function createAssertEquals(): never;
769
-
770
- /**
771
- * Creates a reusable {@link assertEquals} function.
772
- *
773
- * @template T Type of the input value
774
- * @returns A reusable `assertEquals` function
775
- *
776
- * @author Jeongho Nam - https://github.com/samchon
777
- */
778
- function createAssertEquals<T>(): (input: unknown) => T;
779
-
780
- /**
781
- * @internal
782
- */
783
- function createAssertEquals<T>(): (input: unknown) => T {
784
- halt("createAssertEquals");
785
- }
786
- const createAssertEqualsPure = /** @__PURE__ */ Object.assign<
787
- typeof createAssertEquals,
788
- {}
789
- >(createAssertEquals, assertEquals);
790
- export { createAssertEqualsPure as createAssertEquals };
791
-
792
- /**
793
- * Creates a reusable {@link assertGuardEquals} function.
794
- *
795
- * Note that, you've to declare the variable type of the factory function caller
796
- * like below. If you don't declare the variable type, compilation error be thrown.
797
- * This is the special rule of the TypeScript compiler.
798
- *
799
- * ```typescript
800
- * // MUST DECLARE THE VARIABLE TYPE
801
- * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
802
- *
803
- * // IF NOT, COMPILATION ERROR BE OCCURED
804
- * const func = typia.createAssertGuardEquals<number>();
805
- * ```
806
- *
807
- * > *Assertions require every name in the call target to be declared with an*
808
- * > *explicit type annotation.*
809
- *
810
- * @danger You must configure the generic argument `T`
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 createAssertGuardEquals(): never;
817
-
818
- /**
819
- * Creates a reusable {@link assertGuardEquals} function.
820
- *
821
- * Note that, you've to declare the variable type of the factory function caller
822
- * like below. If you don't declare the variable type, compilation error be thrown.
823
- * This is the special rule of the TypeScript compiler.
824
- *
825
- * ```typescript
826
- * // MUST DECLARE THE VARIABLE TYPE
827
- * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
828
- *
829
- * // IF NOT, COMPILATION ERROR BE OCCURED
830
- * const func = typia.createAssertGuardEquals<number>();
831
- * ```
832
- *
833
- * > *Assertions require every name in the call target to be declared with an*
834
- * > *explicit type annotation.*
835
- *
836
- * @returns Nothing until you configure the generic argument `T`
837
- * @throws compile error
838
- *
839
- * @author Jeongho Nam - https://github.com/samchon
840
- */
841
- function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T>;
842
-
843
- /**
844
- * @internal
845
- */
846
- function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T> {
847
- halt("createAssertGuardEquals");
848
- }
849
- const createAssertGuardEqualsPure = /** @__PURE__ */ Object.assign<
850
- typeof createAssertGuardEquals,
851
- {}
852
- >(createAssertGuardEquals, assertGuardEquals);
853
- export { createAssertGuardEqualsPure as createAssertGuardEquals };
854
-
855
- /**
856
- * Creates a reusable {@link equals} function.
857
- *
858
- * @danger You must configure the generic argument `T`
859
- * @returns Nothing until you configure the generic argument `T`
860
- * @throws compile error
861
- *
862
- * @author Jeongho Nam - https://github.com/samchon
863
- */
864
- function createEquals(): never;
865
-
866
- /**
867
- * Creates a reusable {@link equals} function.
868
- *
869
- * @template T Type of the input value
870
- * @returns A reusable `equals` function
871
- *
872
- * @author Jeongho Nam - https://github.com/samchon
873
- */
874
- function createEquals<T>(): (input: unknown) => input is T;
875
-
876
- /**
877
- * @internal
878
- */
879
- function createEquals<T>(): (input: unknown) => input is T {
880
- halt("createEquals");
881
- }
882
- const createEqualsPure = /** @__PURE__ */ Object.assign<
883
- typeof createEquals,
884
- {}
885
- >(createEquals, equals);
886
- export { createEqualsPure as createEquals };
887
-
888
- /**
889
- * Creates a reusable {@link validateEquals} function.
890
- *
891
- * @danger You must configure the generic argument `T`
892
- * @returns Nothing until you configure the generic argument `T`
893
- * @throws compile error
894
- *
895
- * @author Jeongho Nam - https://github.com/samchon
896
- */
897
- function createValidateEquals(): never;
898
-
899
- /**
900
- * Creates a reusable {@link validateEquals} function.
901
- *
902
- * @template T Type of the input value
903
- * @returns A reusable `validateEquals` function
904
- *
905
- * @author Jeongho Nam - https://github.com/samchon
906
- */
907
- function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
908
-
909
- /**
910
- * @internal
911
- */
912
- function createValidateEquals(): (input: unknown) => IValidation {
913
- halt("createValidateEquals");
914
- }
915
- const createValidateEqualsPure = /** @__PURE__ */ Object.assign<
916
- typeof createValidateEquals,
917
- {}
918
- >(createValidateEquals, validateEquals);
919
- export { createValidateEqualsPure as createValidateEquals };
920
-
921
- /**
922
- * Creates a reusable {@link random} function.
923
- *
924
- * @danger You must configure the generic argument `T`
925
- * @param generator Random data generator
926
- * @returns Nothing until you configure the generic argument `T`
927
- * @throws compile error
928
- *
929
- * @author Jeongho Nam - https://github.com/samchon
930
- */
931
- function createRandom(generator?: Partial<IRandomGenerator>): never;
932
-
933
- /**
934
- * Creates a resuable {@link random} function.
935
- *
936
- * @template T Type of the input value
937
- * @param generator Random data generator
938
- * @returns A reusable `random` function
939
- *
940
- * @author Jeongho Nam - https://github.com/samchon
941
- */
942
- function createRandom<T>(
943
- generator?: Partial<IRandomGenerator>,
944
- ): () => Resolved<T>;
945
-
946
- /**
947
- * @internal
948
- */
949
- function createRandom(): never {
950
- halt("createRandom");
951
- }
952
- const createRandomPure = /** @__PURE__ */ Object.assign<
953
- typeof createRandom,
954
- {}
955
- >(createRandom, random);
956
- export { createRandomPure as createRandom };
957
-
958
- /**
959
- * @internal
960
- */
961
- function halt(name: string): never {
962
- throw new Error(
963
- `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
964
- );
965
- }
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
+
8
+ export * as http from "./http";
9
+ export * as json from "./json";
10
+ export * as misc from "./misc";
11
+ export * as notations from "./notations";
12
+ export * as protobuf from "./protobuf";
13
+ export * as reflect from "./reflect";
14
+ export * as tags from "./tags";
15
+
16
+ export * from "./schemas/metadata/IJsDocTagInfo";
17
+ export * from "./schemas/json/IJsonApplication";
18
+ export * from "./schemas/json/IJsonComponents";
19
+ export * from "./schemas/json/IJsonSchema";
20
+ export * from "./AssertionGuard";
21
+ export * from "./IRandomGenerator";
22
+ export * from "./IValidation";
23
+ export * from "./TypeGuardError";
24
+
25
+ export * from "./Primitive";
26
+ export * from "./Resolved";
27
+ export * from "./CamelCase";
28
+ export * from "./PascalCase";
29
+ export * from "./SnakeCase";
30
+
31
+ /* -----------------------------------------------------------
32
+ BASIC VALIDATORS
33
+ ----------------------------------------------------------- */
34
+ /**
35
+ * Asserts a value type.
36
+ *
37
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
38
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
39
+ * value is following the type `T`, just input parameter would be returned.
40
+ *
41
+ * If what you want is not asserting but just knowing whether the parametric value is
42
+ * following the type `T` or not, you can choose the {@link is} function instead.
43
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
44
+ * Also, if you want to automatically cast the parametric value to the type `T`
45
+ * when no problem (perform the assertion guard of type).
46
+ *
47
+ * On the other and, if you don't want to allow any superfluous property that is not
48
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
49
+ *
50
+ * @template T Type of the input value
51
+ * @param input A value to be asserted
52
+ * @returns Parametric input value
53
+ * @throws A {@link TypeGuardError} instance with detailed reason
54
+ *
55
+ * @author Jeongho Nam - https://github.com/samchon
56
+ */
57
+ function assert<T>(input: T): T;
58
+
59
+ /**
60
+ * Asserts a value type.
61
+ *
62
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
63
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
64
+ * value is following the type `T`, just input parameter would be returned.
65
+ *
66
+ * If what you want is not asserting but just knowing whether the parametric value is
67
+ * following the type `T` or not, you can choose the {@link is} function instead.
68
+ * Otherwise, you want to know all the errors, {@link validate} is the way to go.
69
+ *
70
+ * On the other and, if you don't want to allow any superfluous property that is not
71
+ * enrolled to the type `T`, you can use {@link assertEquals} function instead.
72
+ *
73
+ * @template T Type of the input value
74
+ * @param input A value to be asserted
75
+ * @returns Parametric input value casted as `T`
76
+ * @throws A {@link TypeGuardError} instance with detailed reason
77
+ *
78
+ * @author Jeongho Nam - https://github.com/samchon
79
+ */
80
+ function assert<T>(input: unknown): T;
81
+
82
+ /**
83
+ * @internal
84
+ */
85
+ function assert(): never {
86
+ halt("assert");
87
+ }
88
+ const assertPure = /** @__PURE__ */ Object.assign<typeof assert, {}>(
89
+ assert,
90
+ /** @__PURE__ */ Namespace.assert("assert"),
91
+ );
92
+ export { assertPure as assert };
93
+
94
+ /**
95
+ * Assertion guard of a value type.
96
+ *
97
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
98
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
99
+ * value is following the type `T`, nothing would be returned, but the input value
100
+ * would be automatically casted to the type `T`. This is the concept of
101
+ * "Assertion Guard" of a value type.
102
+ *
103
+ * If what you want is not asserting but just knowing whether the parametric value is
104
+ * following the type `T` or not, you can choose the {@link is} function instead.
105
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
106
+ * Also, if you want to returns the parametric value when no problem, you can use
107
+ * {@link assert} function instead.
108
+ *
109
+ * On the other and, if you don't want to allow any superfluous property that is not
110
+ * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
111
+ *
112
+ * @template T Type of the input value
113
+ * @param input A value to be asserted
114
+ * @throws A {@link TypeGuardError} instance with detailed reason
115
+ *
116
+ * @author Jeongho Nam - https://github.com/samchon
117
+ */
118
+ function assertGuard<T>(input: T): asserts input is T;
119
+
120
+ /**
121
+ * Assertion guard of a value type.
122
+ *
123
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
124
+ * reason, if the parametric value is not following the type `T`. Otherwise, the
125
+ * value is following the type `T`, nothing would be returned, but the input value
126
+ * would be automatically casted to the type `T`. This is the concept of
127
+ * "Assertion Guard" of a value type.
128
+ *
129
+ * If what you want is not asserting but just knowing whether the parametric value is
130
+ * following the type `T` or not, you can choose the {@link is} function instead.
131
+ * Otherwise you want to know all the errors, {@link validate} is the way to go.
132
+ * Also, if you want to returns the parametric value when no problem, you can use
133
+ * {@link assert} function instead.
134
+ *
135
+ * On the other and, if you don't want to allow any superfluous property that is not
136
+ * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
137
+ *
138
+ * @template T Type of the input value
139
+ * @param input A value to be asserted
140
+ * @throws A {@link TypeGuardError} instance with detailed reason
141
+ *
142
+ * @author Jeongho Nam - https://github.com/samchon
143
+ */
144
+ function assertGuard<T>(input: unknown): asserts input is T;
145
+
146
+ /**
147
+ * @internal
148
+ */
149
+ function assertGuard(): never {
150
+ halt("assertGuard");
151
+ }
152
+ const assertGuardPure = /** @__PURE__ */ Object.assign<typeof assertGuard, {}>(
153
+ assertGuard,
154
+ /** @__PURE__ */ Namespace.assert("assertGuard"),
155
+ );
156
+ export { assertGuardPure as assertGuard };
157
+
158
+ /**
159
+ * Tests a value type.
160
+ *
161
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
162
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
163
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
164
+ * returned.
165
+ *
166
+ * If what you want is not just knowing whether the parametric value is following the
167
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
168
+ * {@link assert} function instead. Also, if you want to know all the errors with
169
+ * detailed reasons, {@link validate} function would be useful.
170
+ *
171
+ * On the other and, if you don't want to allow any superfluous property that is not
172
+ * enrolled to the type `T`, you can use {@link equals} function instead.
173
+ *
174
+ * @template T Type of the input value
175
+ * @param input A value to be tested
176
+ * @returns Whether the parametric value is following the type `T` or not
177
+ *
178
+ * @author Jeongho Nam - https://github.com/samchon
179
+ */
180
+ function is<T>(input: T): input is T;
181
+
182
+ /**
183
+ * Tests a value type.
184
+ *
185
+ * Tests a parametric value type and returns whether it's following the type `T` or not.
186
+ * If the parametric value is matched with the type `T`, `true` value would be returned.
187
+ * Otherwise, the parametric value is not following the type `T`, `false` value would be
188
+ * returned.
189
+ *
190
+ * If what you want is not just knowing whether the parametric value is following the
191
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
192
+ * {@link assert} function instead. Also, if you want to know all the errors with
193
+ * detailed reasons, {@link validate} function would be useful.
194
+ *
195
+ * On the other and, if you don't want to allow any superfluous property that is not
196
+ * enrolled to the type `T`, you can use {@link equals} function instead.
197
+ *
198
+ * @template T Type of the input value
199
+ * @param input A value to be tested
200
+ * @returns Whether the parametric value is following the type `T` or not
201
+ *
202
+ * @author Jeongho Nam - https://github.com/samchon
203
+ */
204
+ function is<T>(input: unknown): input is T;
205
+
206
+ /**
207
+ * @internal
208
+ */
209
+ function is(): never {
210
+ halt("is");
211
+ }
212
+ const isPure = /** @__PURE__ */ Object.assign<typeof is, {}>(
213
+ is,
214
+ /** @__PURE__ */ Namespace.assert("is"),
215
+ );
216
+ export { isPure as is };
217
+
218
+ /**
219
+ * Validates a value type.
220
+ *
221
+ * Validates a parametric value type and archives all the type errors into an
222
+ * {@link IValidation.errors} array, if the parametric value is not following the
223
+ * type `T`. Of course, if the parametric value is following the type `T`, the
224
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
225
+ * would have the `true` value.
226
+ *
227
+ * If what you want is not finding all the error, but asserting the parametric value
228
+ * type with exception throwing, you can choose {@link assert} function instead.
229
+ * Otherwise, you just want to know whether the parametric value is matched with the
230
+ * type `T`, {@link is} function is the way to go.
231
+ *
232
+ * On the other and, if you don't want to allow any superfluous property that is not
233
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
234
+ *
235
+ * @template Type of the input value
236
+ * @param input A value to be validated
237
+ * @returns Validation result
238
+ *
239
+ * @author Jeongho Nam - https://github.com/samchon
240
+ */
241
+ function validate<T>(input: T): IValidation<T>;
242
+
243
+ /**
244
+ * Validates a value type.
245
+ *
246
+ * Validates a parametric value type and archives all the type errors into an
247
+ * {@link IValidation.errors} array, if the parametric value is not following the
248
+ * type `T`. Of course, if the parametric value is following the type `T`, the
249
+ * {@link IValidation.errors} array would be empty and {@link IValidation.success}
250
+ * would have the `true` value.
251
+ *
252
+ * If what you want is not finding all the error, but asserting the parametric value
253
+ * type with exception throwing, you can choose {@link assert} function instead.
254
+ * Otherwise, you just want to know whether the parametric value is matched with the
255
+ * type `T`, {@link is} function is the way to go.
256
+ *
257
+ * On the other and, if you don't want to allow any superfluous property that is not
258
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
259
+ *
260
+ * @template Type of the input value
261
+ * @param input A value to be validated
262
+ * @returns Validation result
263
+ *
264
+ * @author Jeongho Nam - https://github.com/samchon
265
+ */
266
+ function validate<T>(input: unknown): IValidation<T>;
267
+
268
+ /**
269
+ * @internal
270
+ */
271
+ function validate(): never {
272
+ halt("validate");
273
+ }
274
+ const validatePure = /** @__PURE__ */ Object.assign<typeof validate, {}>(
275
+ validate,
276
+ /** @__PURE__ */ Namespace.validate(),
277
+ );
278
+ export { validatePure as validate };
279
+
280
+ /* -----------------------------------------------------------
281
+ STRICT VALIDATORS
282
+ ----------------------------------------------------------- */
283
+ /**
284
+ * Asserts equality between a value and its type.
285
+ *
286
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
287
+ * reason, if the parametric value is not following the type `T` or some superfluous
288
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
289
+ * following the type `T` without any superfluous property, just input parameter would
290
+ * be returned.
291
+ *
292
+ * If what you want is not asserting but just knowing whether the parametric value is
293
+ * following the type `T` or not, you can choose the {@link equals} function instead.
294
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
295
+ *
296
+ * On the other hand, if you want to allow superfluous property that is not enrolled
297
+ * to the type `T`, you can use {@link assert} function instead.
298
+ *
299
+ * @template T Type of the input value
300
+ * @param input A value to be asserted
301
+ * @returns Parametric input value
302
+ * @throws A {@link TypeGuardError} instance with detailed reason
303
+ *
304
+ * @author Jeongho Nam - https://github.com/samchon
305
+ */
306
+ function assertEquals<T>(input: T): T;
307
+
308
+ /**
309
+ * Asserts equality between a value and its type.
310
+ *
311
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
312
+ * reason, if the parametric value is not following the type `T` or some superfluous
313
+ * property that is not listed on the type `T` has been found. Otherwise, the value is
314
+ * following the type `T` without any superfluous property, just input parameter would
315
+ * be returned.
316
+ *
317
+ * If what you want is not asserting but just knowing whether the parametric value is
318
+ * following the type `T` or not, you can choose the {@link equals} function instead.
319
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
320
+ *
321
+ * On the other hand, if you want to allow superfluous property that is not enrolled
322
+ * to the type `T`, you can use {@link assert} function instead.
323
+ *
324
+ * @template T Type of the input value
325
+ * @param input A value to be asserted
326
+ * @returns Parametric input value casted as `T`
327
+ * @throws A {@link TypeGuardError} instance with detailed reason
328
+ *
329
+ * @author Jeongho Nam - https://github.com/samchon
330
+ */
331
+ function assertEquals<T>(input: unknown): T;
332
+
333
+ /**
334
+ * @internal
335
+ */
336
+ function assertEquals(): never {
337
+ halt("assertEquals");
338
+ }
339
+ const assertEqualsPure = /** @__PURE__ */ Object.assign<
340
+ typeof assertEquals,
341
+ {}
342
+ >(assertEquals, /** @__PURE__ */ Namespace.assert("assertEquals"));
343
+ export { assertEqualsPure as assertEquals };
344
+
345
+ /**
346
+ * Assertion guard of a type with equality.
347
+ *
348
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
349
+ * reason, if the parametric value is not following the type `T` or some superfluous
350
+ * property that is not listed on the type `T` has been found.
351
+ *
352
+ * Otherwise, the value is following the type `T` without any superfluous property,
353
+ * nothing would be returned, but the input value would be automatically casted to
354
+ * the type `T`. This is the concept of "Assertion Guard" of a value type.
355
+ *
356
+ * If what you want is not asserting but just knowing whether the parametric value is
357
+ * following the type `T` or not, you can choose the {@link equals} function instead.
358
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
359
+ * Also, if you want to returns the parametric value when no problem, you can use
360
+ * {@link assert} function instead.
361
+ *
362
+ * On the other hand, if you want to allow superfluous property that is not enrolled
363
+ * to the type `T`, you can use {@link assertEquals} function instead.
364
+ *
365
+ * @template T Type of the input value
366
+ * @param input A value to be asserted
367
+ * @returns Parametric input value casted as `T`
368
+ * @throws A {@link TypeGuardError} instance with detailed reason
369
+ *
370
+ * @author Jeongho Nam - https://github.com/samchon
371
+ */
372
+ function assertGuardEquals<T>(input: T): asserts input is T;
373
+
374
+ /**
375
+ * Assertion guard of a type with equality.
376
+ *
377
+ * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
378
+ * reason, if the parametric value is not following the type `T` or some superfluous
379
+ * property that is not listed on the type `T` has been found.
380
+ *
381
+ * Otherwise, the value is following the type `T` without any superfluous property,
382
+ * nothing would be returned, but the input value would be automatically casted to
383
+ * the type `T`. This is the concept of "Assertion Guard" of a value type.
384
+ *
385
+ * If what you want is not asserting but just knowing whether the parametric value is
386
+ * following the type `T` or not, you can choose the {@link equals} function instead.
387
+ * Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
388
+ * Also, if you want to returns the parametric value when no problem, you can use
389
+ * {@link assertEquals} function instead.
390
+ *
391
+ * On the other hand, if you want to allow superfluous property that is not enrolled
392
+ * to the type `T`, you can use {@link assertGuard} function instead.
393
+ *
394
+ * @template T Type of the input value
395
+ * @param input A value to be asserted
396
+ * @returns Parametric input value casted as `T`
397
+ * @throws A {@link TypeGuardError} instance with detailed reason
398
+ *
399
+ * @author Jeongho Nam - https://github.com/samchon
400
+ */
401
+ function assertGuardEquals<T>(input: unknown): asserts input is T;
402
+
403
+ /**
404
+ * @internal
405
+ */
406
+ function assertGuardEquals(): never {
407
+ halt("assertGuardEquals");
408
+ }
409
+ const assertGuardEqualsPure = /** @__PURE__ */ Object.assign<
410
+ typeof assertGuardEquals,
411
+ {}
412
+ >(assertGuardEquals, /** @__PURE__ */ Namespace.assert("assertGuardEquals"));
413
+ export { assertGuardEqualsPure as assertGuardEquals };
414
+
415
+ /**
416
+ * Tests equality between a value and its type.
417
+ *
418
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
419
+ * or not. If the parametric value is matched with the type `T` and there's not any
420
+ * superfluous property that is not listed on the type `T`, `true` value would be
421
+ * returned. Otherwise, the parametric value is not following the type `T` or some
422
+ * superfluous property exists, `false` value would be returned.
423
+ *
424
+ * If what you want is not just knowing whether the parametric value is following the
425
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
426
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
427
+ * detailed reasons, {@link validateEquals} function would be useful.
428
+ *
429
+ * On the other hand, if you want to allow superfluous property that is not enrolled
430
+ * to the type `T`, you can use {@link is} function instead.
431
+ *
432
+ * @template T Type of the input value
433
+ * @param input A value to be tested
434
+ * @returns Whether the parametric value is equivalent to the type `T` or not
435
+ *
436
+ * @author Jeongho Nam - https://github.com/samchon
437
+ */
438
+ function equals<T>(input: T): input is T;
439
+
440
+ /**
441
+ * Tests equality between a value and its type.
442
+ *
443
+ * Tests a parametric value type and returns whether it's equivalent to the type `T`
444
+ * or not. If the parametric value is matched with the type `T` and there's not any
445
+ * superfluous property that is not listed on the type `T`, `true` value would be
446
+ * returned. Otherwise, the parametric value is not following the type `T` or some
447
+ * superfluous property exists, `false` value would be returned.
448
+ *
449
+ * If what you want is not just knowing whether the parametric value is following the
450
+ * type `T` or not, but throwing an exception with detailed reason, you can choose
451
+ * {@link assertEquals} function instead. Also, if you want to know all the errors with
452
+ * detailed reasons, {@link validateEquals} function would be useful.
453
+ *
454
+ * On the other hand, if you want to allow superfluous property that is not enrolled
455
+ * to the type `T`, you can use {@link is} function instead.
456
+ *
457
+ * @template T Type of the input value
458
+ * @param input A value to be tested
459
+ * @returns Whether the parametric value is equivalent to the type `T` or not
460
+ *
461
+ * @author Jeongho Nam - https://github.com/samchon
462
+ */
463
+ function equals<T>(input: unknown): input is T;
464
+
465
+ /**
466
+ * @internal
467
+ */
468
+ function equals(): never {
469
+ halt("equals");
470
+ }
471
+ const equalsPure = /** @__PURE__ */ Object.assign<typeof equals, {}>(
472
+ equals,
473
+ /** @__PURE__ */ Namespace.is(),
474
+ );
475
+ export { equalsPure as equals };
476
+
477
+ /**
478
+ * Validates equality between a value and its type.
479
+ *
480
+ * Validates a parametric value type and archives all the type errors into an
481
+ * {@link IValidation.errors} array, if the parametric value is not following the
482
+ * type `T` or some superfluous property that is not listed on the type `T` has been
483
+ * found. Of course, if the parametric value is following the type `T` and no
484
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
485
+ * and {@link IValidation.success} would have the `true` value.
486
+ *
487
+ * If what you want is not finding all the error, but asserting the parametric value
488
+ * type with exception throwing, you can choose {@link assert} function instead.
489
+ * Otherwise, you just want to know whether the parametric value is matched with the
490
+ * type `T`, {@link is} function is the way to go.
491
+ *
492
+ * On the other and, if you don't want to allow any superfluous property that is not
493
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
494
+ *
495
+ * @template Type of the input value
496
+ * @param input A value to be validated
497
+ * @returns Validation result
498
+ *
499
+ * @author Jeongho Nam - https://github.com/samchon
500
+ */
501
+ function validateEquals<T>(input: T): IValidation<T>;
502
+
503
+ /**
504
+ * Validates equality between a value and its type.
505
+ *
506
+ * Validates a parametric value type and archives all the type errors into an
507
+ * {@link IValidation.errors} array, if the parametric value is not following the
508
+ * type `T` or some superfluous property that is not listed on the type `T` has been
509
+ * found. Of course, if the parametric value is following the type `T` and no
510
+ * superfluous property exists, the {@link IValidation.errors} array would be empty
511
+ * and {@link IValidation.success} would have the `true` value.
512
+ *
513
+ * If what you want is not finding all the error, but asserting the parametric value
514
+ * type with exception throwing, you can choose {@link assert} function instead.
515
+ * Otherwise, you just want to know whether the parametric value is matched with the
516
+ * type `T`, {@link is} function is the way to go.
517
+ *
518
+ * On the other and, if you don't want to allow any superfluous property that is not
519
+ * enrolled to the type `T`, you can use {@link validateEquals} function instead.
520
+ *
521
+ * @template Type of the input value
522
+ * @param input A value to be validated
523
+ * @returns Validation result
524
+ *
525
+ * @author Jeongho Nam - https://github.com/samchon
526
+ */
527
+ function validateEquals<T>(input: unknown): IValidation<T>;
528
+
529
+ /**
530
+ * @internal
531
+ */
532
+ function validateEquals(): never {
533
+ halt("validateEquals");
534
+ }
535
+ const validateEqualsPure = /** @__PURE__ */ Object.assign<
536
+ typeof validateEquals,
537
+ {}
538
+ >(validateEquals, /** @__PURE__ */ Namespace.validate());
539
+ export { validateEqualsPure as validateEquals };
540
+
541
+ /* -----------------------------------------------------------
542
+ RANDOM
543
+ ----------------------------------------------------------- */
544
+ /**
545
+ * > You must configure the generic argument `T`.
546
+ *
547
+ * Generate random data.
548
+ *
549
+ * Generates a random data following type the `T`.
550
+ *
551
+ * For reference, this `typia.random()` function generates only primitive type.
552
+ * If there're some methods in the type `T` or its nested instances, those would
553
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
554
+ * would be generated instead.
555
+ *
556
+ * @template T Type of data to generate
557
+ * @param generator Random data generator
558
+ * @return Randomly generated data
559
+ *
560
+ * @author Jeongho Nam - https://github.com/samchon
561
+ */
562
+ function random(generator?: Partial<IRandomGenerator>): never;
563
+
564
+ /**
565
+ * Generate random data.
566
+ *
567
+ * Generates a random data following type the `T`.
568
+ *
569
+ * For reference, this `typia.random()` function generates only primitive type.
570
+ * If there're some methods in the type `T` or its nested instances, those would
571
+ * be ignored. Also, when the type `T` has a `toJSON()` method, its return type
572
+ * would be generated instead.
573
+ *
574
+ * @template T Type of data to generate
575
+ * @param generator Random data generator
576
+ * @return Randomly generated data
577
+ *
578
+ * @author Jeongho Nam - https://github.com/samchon
579
+ */
580
+ function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
581
+
582
+ /**
583
+ * @internal
584
+ */
585
+ function random(): never {
586
+ halt("random");
587
+ }
588
+ const randomPure = /** @__PURE__ */ Object.assign<typeof random, {}>(
589
+ random,
590
+ /** @__PURE__ */ Namespace.random(),
591
+ );
592
+ export { randomPure as random };
593
+
594
+ /* -----------------------------------------------------------
595
+ FACTORY FUNCTIONS
596
+ ----------------------------------------------------------- */
597
+ /**
598
+ * Creates a reusable {@link assert} function.
599
+ *
600
+ * @danger You must configure the generic argument `T`
601
+ * @returns Nothing until you configure the generic argument `T`
602
+ * @throws compile error
603
+ *
604
+ * @author Jeongho Nam - https://github.com/samchon
605
+ */
606
+ function createAssert(): never;
607
+
608
+ /**
609
+ * Creates a reusable {@link assert} function.
610
+ *
611
+ * @template T Type of the input value
612
+ * @returns A reusable `assert` function
613
+ *
614
+ * @author Jeongho Nam - https://github.com/samchon
615
+ */
616
+ function createAssert<T>(): (input: unknown) => T;
617
+
618
+ /**
619
+ * @internal
620
+ */
621
+ function createAssert<T>(): (input: unknown) => T {
622
+ halt("createAssert");
623
+ }
624
+ const createAssertPure = /** @__PURE__ */ Object.assign<
625
+ typeof createAssert,
626
+ {}
627
+ >(createAssert, assertPure);
628
+ export { createAssertPure as createAssert };
629
+
630
+ /**
631
+ * Creates a reusable {@link assertGuard} function.
632
+ *
633
+ * Note that, you've to declare the variable type of the factory function caller
634
+ * like below. If you don't declare the variable type, compilation error be thrown.
635
+ * This is the special rule of the TypeScript compiler.
636
+ *
637
+ * ```typescript
638
+ * // MUST DECLARE THE VARIABLE TYPE
639
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
640
+ *
641
+ * // IF NOT, COMPILATION ERROR BE OCCURED
642
+ * const func = typia.createAssertGuard<number>();
643
+ * ```
644
+ *
645
+ * > *Assertions require every name in the call target to be declared with an*
646
+ * > *explicit type annotation.*
647
+ *
648
+ * @danger You must configure the generic argument `T`
649
+ * @returns Nothing until you configure the generic argument `T`
650
+ * @throws compile error
651
+ *
652
+ * @author Jeongho Nam - https://github.com/samchon
653
+ */
654
+ function createAssertGuard(): never;
655
+
656
+ /**
657
+ * Creates a reusable {@link assertGuard} function.
658
+ *
659
+ * Note that, you've to declare the variable type of the factory function caller
660
+ * like below. If you don't declare the variable type, compilation error be thrown.
661
+ * This is the special rule of the TypeScript compiler.
662
+ *
663
+ * ```typescript
664
+ * // MUST DECLARE THE VARIABLE TYPE
665
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
666
+ *
667
+ * // IF NOT, COMPILATION ERROR BE OCCURED
668
+ * const func = typia.createAssertGuard<number>();
669
+ * ```
670
+ *
671
+ * > *Assertions require every name in the call target to be declared with an*
672
+ * > *explicit type annotation.*
673
+ *
674
+ * @returns Nothing until you configure the generic argument `T`
675
+ * @throws compile error
676
+ *
677
+ * @author Jeongho Nam - https://github.com/samchon
678
+ */
679
+ function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T>;
680
+
681
+ /**
682
+ * @internal
683
+ */
684
+ function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
685
+ halt("createAssertGuard");
686
+ }
687
+ const createAssertGuardPure = /** @__PURE__ */ Object.assign<
688
+ typeof createAssertGuard,
689
+ {}
690
+ >(createAssertGuard, assertGuardPure);
691
+ export { createAssertGuardPure as createAssertGuard };
692
+
693
+ /**
694
+ * Creates a reusable {@link is} function.
695
+ *
696
+ * @danger You must configure the generic argument `T`
697
+ * @returns Nothing until you configure the generic argument `T`
698
+ * @throws compile error
699
+ *
700
+ * @author Jeongho Nam - https://github.com/samchon
701
+ */
702
+ function createIs(): never;
703
+
704
+ /**
705
+ * Creates a reusable {@link is} function.
706
+ *
707
+ * @template T Type of the input value
708
+ * @returns A reusable `is` function
709
+ *
710
+ * @author Jeongho Nam - https://github.com/samchon
711
+ */
712
+ function createIs<T>(): (input: unknown) => input is T;
713
+
714
+ /**
715
+ * @internal
716
+ */
717
+ function createIs<T>(): (input: unknown) => input is T {
718
+ halt("createIs");
719
+ }
720
+ const createIsPure = /** @__PURE__ */ Object.assign<typeof createIs, {}>(
721
+ createIs,
722
+ isPure,
723
+ );
724
+ export { createIsPure as createIs };
725
+
726
+ /**
727
+ * Creates a reusable {@link validate} function.
728
+ *
729
+ * @danger You must configure the generic argument `T`
730
+ * @returns Nothing until you configure the generic argument `T`
731
+ * @throws compile error
732
+ *
733
+ * @author Jeongho Nam - https://github.com/samchon
734
+ */
735
+ function createValidate(): never;
736
+
737
+ /**
738
+ * Creates a reusable {@link validate} function.
739
+ *
740
+ * @template T Type of the input value
741
+ * @returns A reusable `validate` function
742
+ *
743
+ * @author Jeongho Nam - https://github.com/samchon
744
+ */
745
+ function createValidate<T>(): (input: unknown) => IValidation<T>;
746
+
747
+ /**
748
+ * @internal
749
+ */
750
+ function createValidate(): (input: unknown) => IValidation {
751
+ halt("createValidate");
752
+ }
753
+ const createValidatePure = /** @__PURE__ */ Object.assign<
754
+ typeof createValidate,
755
+ {}
756
+ >(createValidate, validatePure);
757
+ export { createValidatePure as createValidate };
758
+
759
+ /**
760
+ * Creates a reusable {@link assertEquals} function.
761
+ *
762
+ * @danger You must configure the generic argument `T`
763
+ * @returns Nothing until you configure the generic argument `T`
764
+ * @throws compile error
765
+ *
766
+ * @author Jeongho Nam - https://github.com/samchon
767
+ */
768
+ function createAssertEquals(): never;
769
+
770
+ /**
771
+ * Creates a reusable {@link assertEquals} function.
772
+ *
773
+ * @template T Type of the input value
774
+ * @returns A reusable `assertEquals` function
775
+ *
776
+ * @author Jeongho Nam - https://github.com/samchon
777
+ */
778
+ function createAssertEquals<T>(): (input: unknown) => T;
779
+
780
+ /**
781
+ * @internal
782
+ */
783
+ function createAssertEquals<T>(): (input: unknown) => T {
784
+ halt("createAssertEquals");
785
+ }
786
+ const createAssertEqualsPure = /** @__PURE__ */ Object.assign<
787
+ typeof createAssertEquals,
788
+ {}
789
+ >(createAssertEquals, assertEqualsPure);
790
+ export { createAssertEqualsPure as createAssertEquals };
791
+
792
+ /**
793
+ * Creates a reusable {@link assertGuardEquals} function.
794
+ *
795
+ * Note that, you've to declare the variable type of the factory function caller
796
+ * like below. If you don't declare the variable type, compilation error be thrown.
797
+ * This is the special rule of the TypeScript compiler.
798
+ *
799
+ * ```typescript
800
+ * // MUST DECLARE THE VARIABLE TYPE
801
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
802
+ *
803
+ * // IF NOT, COMPILATION ERROR BE OCCURED
804
+ * const func = typia.createAssertGuardEquals<number>();
805
+ * ```
806
+ *
807
+ * > *Assertions require every name in the call target to be declared with an*
808
+ * > *explicit type annotation.*
809
+ *
810
+ * @danger You must configure the generic argument `T`
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 createAssertGuardEquals(): never;
817
+
818
+ /**
819
+ * Creates a reusable {@link assertGuardEquals} function.
820
+ *
821
+ * Note that, you've to declare the variable type of the factory function caller
822
+ * like below. If you don't declare the variable type, compilation error be thrown.
823
+ * This is the special rule of the TypeScript compiler.
824
+ *
825
+ * ```typescript
826
+ * // MUST DECLARE THE VARIABLE TYPE
827
+ * const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
828
+ *
829
+ * // IF NOT, COMPILATION ERROR BE OCCURED
830
+ * const func = typia.createAssertGuardEquals<number>();
831
+ * ```
832
+ *
833
+ * > *Assertions require every name in the call target to be declared with an*
834
+ * > *explicit type annotation.*
835
+ *
836
+ * @returns Nothing until you configure the generic argument `T`
837
+ * @throws compile error
838
+ *
839
+ * @author Jeongho Nam - https://github.com/samchon
840
+ */
841
+ function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T>;
842
+
843
+ /**
844
+ * @internal
845
+ */
846
+ function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T> {
847
+ halt("createAssertGuardEquals");
848
+ }
849
+ const createAssertGuardEqualsPure = /** @__PURE__ */ Object.assign<
850
+ typeof createAssertGuardEquals,
851
+ {}
852
+ >(createAssertGuardEquals, assertGuardEqualsPure);
853
+ export { createAssertGuardEqualsPure as createAssertGuardEquals };
854
+
855
+ /**
856
+ * Creates a reusable {@link equals} function.
857
+ *
858
+ * @danger You must configure the generic argument `T`
859
+ * @returns Nothing until you configure the generic argument `T`
860
+ * @throws compile error
861
+ *
862
+ * @author Jeongho Nam - https://github.com/samchon
863
+ */
864
+ function createEquals(): never;
865
+
866
+ /**
867
+ * Creates a reusable {@link equals} function.
868
+ *
869
+ * @template T Type of the input value
870
+ * @returns A reusable `equals` function
871
+ *
872
+ * @author Jeongho Nam - https://github.com/samchon
873
+ */
874
+ function createEquals<T>(): (input: unknown) => input is T;
875
+
876
+ /**
877
+ * @internal
878
+ */
879
+ function createEquals<T>(): (input: unknown) => input is T {
880
+ halt("createEquals");
881
+ }
882
+ const createEqualsPure = /** @__PURE__ */ Object.assign<
883
+ typeof createEquals,
884
+ {}
885
+ >(createEquals, equalsPure);
886
+ export { createEqualsPure as createEquals };
887
+
888
+ /**
889
+ * Creates a reusable {@link validateEquals} function.
890
+ *
891
+ * @danger You must configure the generic argument `T`
892
+ * @returns Nothing until you configure the generic argument `T`
893
+ * @throws compile error
894
+ *
895
+ * @author Jeongho Nam - https://github.com/samchon
896
+ */
897
+ function createValidateEquals(): never;
898
+
899
+ /**
900
+ * Creates a reusable {@link validateEquals} function.
901
+ *
902
+ * @template T Type of the input value
903
+ * @returns A reusable `validateEquals` function
904
+ *
905
+ * @author Jeongho Nam - https://github.com/samchon
906
+ */
907
+ function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
908
+
909
+ /**
910
+ * @internal
911
+ */
912
+ function createValidateEquals(): (input: unknown) => IValidation {
913
+ halt("createValidateEquals");
914
+ }
915
+ const createValidateEqualsPure = /** @__PURE__ */ Object.assign<
916
+ typeof createValidateEquals,
917
+ {}
918
+ >(createValidateEquals, validateEqualsPure);
919
+ export { createValidateEqualsPure as createValidateEquals };
920
+
921
+ /**
922
+ * Creates a reusable {@link random} function.
923
+ *
924
+ * @danger You must configure the generic argument `T`
925
+ * @param generator Random data generator
926
+ * @returns Nothing until you configure the generic argument `T`
927
+ * @throws compile error
928
+ *
929
+ * @author Jeongho Nam - https://github.com/samchon
930
+ */
931
+ function createRandom(generator?: Partial<IRandomGenerator>): never;
932
+
933
+ /**
934
+ * Creates a resuable {@link random} function.
935
+ *
936
+ * @template T Type of the input value
937
+ * @param generator Random data generator
938
+ * @returns A reusable `random` function
939
+ *
940
+ * @author Jeongho Nam - https://github.com/samchon
941
+ */
942
+ function createRandom<T>(
943
+ generator?: Partial<IRandomGenerator>,
944
+ ): () => Resolved<T>;
945
+
946
+ /**
947
+ * @internal
948
+ */
949
+ function createRandom(): never {
950
+ halt("createRandom");
951
+ }
952
+ const createRandomPure = /** @__PURE__ */ Object.assign<
953
+ typeof createRandom,
954
+ {}
955
+ >(createRandom, randomPure);
956
+ export { createRandomPure as createRandom };
957
+
958
+ /**
959
+ * @internal
960
+ */
961
+ function halt(name: string): never {
962
+ throw new Error(
963
+ `Error on typia.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
964
+ );
965
+ }