typia 12.0.0-dev.20260309 → 12.0.0-dev.20260310

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 (134) hide show
  1. package/lib/executable/setup/PluginConfigurator.js +3 -3
  2. package/lib/executable/setup/PluginConfigurator.mjs +3 -3
  3. package/lib/executable/setup/PluginConfigurator.mjs.map +1 -1
  4. package/lib/executable/typia.js +15 -15
  5. package/lib/executable/typia.mjs +15 -15
  6. package/package.json +5 -5
  7. package/src/TypeGuardError.ts +145 -145
  8. package/src/executable/TypiaGenerateWizard.ts +82 -82
  9. package/src/executable/TypiaPatchWizard.ts +45 -45
  10. package/src/executable/TypiaSetupWizard.ts +171 -171
  11. package/src/executable/setup/ArgumentParser.ts +42 -42
  12. package/src/executable/setup/CommandExecutor.ts +8 -8
  13. package/src/executable/setup/FileRetriever.ts +19 -19
  14. package/src/executable/setup/PackageManager.ts +87 -87
  15. package/src/executable/setup/PluginConfigurator.ts +74 -74
  16. package/src/executable/typia.ts +55 -55
  17. package/src/functional.ts +600 -600
  18. package/src/http.ts +843 -843
  19. package/src/index.ts +4 -4
  20. package/src/internal/_IProtobufWriter.ts +18 -18
  21. package/src/internal/_ProtobufReader.ts +187 -187
  22. package/src/internal/_ProtobufSizer.ts +137 -137
  23. package/src/internal/_ProtobufWriter.ts +135 -135
  24. package/src/internal/_accessExpressionAsString.ts +46 -46
  25. package/src/internal/_assertGuard.ts +13 -13
  26. package/src/internal/_coerceLlmArguments.ts +7 -7
  27. package/src/internal/_createStandardSchema.ts +133 -133
  28. package/src/internal/_functionalTypeGuardErrorFactory.ts +4 -4
  29. package/src/internal/_httpFormDataReadArray.ts +4 -4
  30. package/src/internal/_httpFormDataReadBigint.ts +18 -18
  31. package/src/internal/_httpFormDataReadBlob.ts +10 -10
  32. package/src/internal/_httpFormDataReadBoolean.ts +16 -16
  33. package/src/internal/_httpFormDataReadFile.ts +10 -10
  34. package/src/internal/_httpFormDataReadNumber.ts +15 -15
  35. package/src/internal/_httpFormDataReadString.ts +10 -10
  36. package/src/internal/_httpHeaderReadBigint.ts +10 -10
  37. package/src/internal/_httpHeaderReadBoolean.ts +8 -8
  38. package/src/internal/_httpHeaderReadNumber.ts +7 -7
  39. package/src/internal/_httpParameterReadBigint.ts +10 -10
  40. package/src/internal/_httpParameterReadBoolean.ts +8 -8
  41. package/src/internal/_httpParameterReadNumber.ts +7 -7
  42. package/src/internal/_httpParameterReadString.ts +2 -2
  43. package/src/internal/_httpQueryParseURLSearchParams.ts +12 -12
  44. package/src/internal/_httpQueryReadArray.ts +4 -4
  45. package/src/internal/_httpQueryReadBigint.ts +12 -12
  46. package/src/internal/_httpQueryReadBoolean.ts +14 -14
  47. package/src/internal/_httpQueryReadNumber.ts +9 -9
  48. package/src/internal/_httpQueryReadString.ts +4 -4
  49. package/src/internal/_isBetween.ts +2 -2
  50. package/src/internal/_isBigintString.ts +8 -8
  51. package/src/internal/_isFormatByte.ts +7 -7
  52. package/src/internal/_isFormatDate.ts +3 -3
  53. package/src/internal/_isFormatDateTime.ts +4 -4
  54. package/src/internal/_isFormatDuration.ts +4 -4
  55. package/src/internal/_isFormatEmail.ts +4 -4
  56. package/src/internal/_isFormatHostname.ts +4 -4
  57. package/src/internal/_isFormatIdnEmail.ts +4 -4
  58. package/src/internal/_isFormatIdnHostname.ts +4 -4
  59. package/src/internal/_isFormatIpv4.ts +4 -4
  60. package/src/internal/_isFormatIpv6.ts +4 -4
  61. package/src/internal/_isFormatIri.ts +3 -3
  62. package/src/internal/_isFormatIriReference.ts +4 -4
  63. package/src/internal/_isFormatJsonPointer.ts +3 -3
  64. package/src/internal/_isFormatPassword.ts +1 -1
  65. package/src/internal/_isFormatRegex.ts +8 -8
  66. package/src/internal/_isFormatRelativeJsonPointer.ts +4 -4
  67. package/src/internal/_isFormatTime.ts +4 -4
  68. package/src/internal/_isFormatUri.ts +6 -6
  69. package/src/internal/_isFormatUriReference.ts +5 -5
  70. package/src/internal/_isFormatUriTemplate.ts +4 -4
  71. package/src/internal/_isFormatUrl.ts +4 -4
  72. package/src/internal/_isFormatUuid.ts +3 -3
  73. package/src/internal/_isTypeFloat.ts +5 -5
  74. package/src/internal/_isTypeInt32.ts +5 -5
  75. package/src/internal/_isTypeInt64.ts +5 -5
  76. package/src/internal/_isTypeUint32.ts +5 -5
  77. package/src/internal/_isTypeUint64.ts +5 -5
  78. package/src/internal/_isUniqueItems.ts +159 -159
  79. package/src/internal/_jsonStringifyNumber.ts +12 -12
  80. package/src/internal/_jsonStringifyRest.ts +3 -3
  81. package/src/internal/_jsonStringifyString.ts +42 -42
  82. package/src/internal/_jsonStringifyTail.ts +2 -2
  83. package/src/internal/_llmApplicationFinalize.ts +24 -24
  84. package/src/internal/_miscCloneAny.ts +46 -46
  85. package/src/internal/_notationAny.ts +37 -37
  86. package/src/internal/_notationCamel.ts +13 -13
  87. package/src/internal/_notationPascal.ts +8 -8
  88. package/src/internal/_notationSnake.ts +43 -43
  89. package/src/internal/_parseLlmArguments.ts +7 -7
  90. package/src/internal/_randomArray.ts +21 -21
  91. package/src/internal/_randomBigint.ts +6 -6
  92. package/src/internal/_randomBoolean.ts +1 -1
  93. package/src/internal/_randomFormatByte.ts +3 -3
  94. package/src/internal/_randomFormatDate.ts +18 -18
  95. package/src/internal/_randomFormatDatetime.ts +16 -16
  96. package/src/internal/_randomFormatDuration.ts +27 -27
  97. package/src/internal/_randomFormatEmail.ts +11 -11
  98. package/src/internal/_randomFormatHostname.ts +6 -6
  99. package/src/internal/_randomFormatIdnEmail.ts +3 -3
  100. package/src/internal/_randomFormatIdnHostname.ts +3 -3
  101. package/src/internal/_randomFormatIpv4.ts +11 -11
  102. package/src/internal/_randomFormatIpv6.ts +11 -11
  103. package/src/internal/_randomFormatIri.ts +3 -3
  104. package/src/internal/_randomFormatIriReference.ts +3 -3
  105. package/src/internal/_randomFormatJsonPointer.ts +7 -7
  106. package/src/internal/_randomFormatPassword.ts +8 -8
  107. package/src/internal/_randomFormatRegex.ts +4 -4
  108. package/src/internal/_randomFormatRelativeJsonPointer.ts +8 -8
  109. package/src/internal/_randomFormatTime.ts +14 -14
  110. package/src/internal/_randomFormatUri.ts +3 -3
  111. package/src/internal/_randomFormatUriReference.ts +3 -3
  112. package/src/internal/_randomFormatUriTemplate.ts +3 -3
  113. package/src/internal/_randomFormatUrl.ts +11 -11
  114. package/src/internal/_randomFormatUuid.ts +6 -6
  115. package/src/internal/_randomInteger.ts +53 -53
  116. package/src/internal/_randomNumber.ts +80 -80
  117. package/src/internal/_randomPattern.ts +10 -10
  118. package/src/internal/_randomPick.ts +9 -9
  119. package/src/internal/_randomString.ts +24 -24
  120. package/src/internal/_throwTypeGuardError.ts +5 -5
  121. package/src/internal/_validateReport.ts +21 -21
  122. package/src/internal/private/__notationCapitalize.ts +2 -2
  123. package/src/internal/private/__notationUnsnake.ts +24 -24
  124. package/src/json.ts +553 -553
  125. package/src/llm.ts +408 -408
  126. package/src/misc.ts +448 -448
  127. package/src/module.ts +811 -811
  128. package/src/notations.ts +624 -624
  129. package/src/programmers/TypiaProgrammer.ts +8 -8
  130. package/src/protobuf.ts +499 -499
  131. package/src/re-exports.ts +33 -33
  132. package/src/reflect.ts +75 -75
  133. package/src/transform.ts +5 -5
  134. package/src/transformers/NoTransformConfigurationError.ts +16 -16
package/src/module.ts CHANGED
@@ -1,811 +1,811 @@
1
- import { StandardSchemaV1 } from "@standard-schema/spec";
2
- import {
3
- AssertionGuard,
4
- IRandomGenerator,
5
- IValidation,
6
- Resolved,
7
- } from "@typia/interface";
8
-
9
- import { TypeGuardError } from "./TypeGuardError";
10
- import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
11
-
12
- export * as functional from "./functional";
13
- export * as http from "./http";
14
- export * as llm from "./llm";
15
- export * as json from "./json";
16
- export * as misc from "./misc";
17
- export * as notations from "./notations";
18
- export * as protobuf from "./protobuf";
19
- export * as reflect from "./reflect";
20
-
21
- export * from "./TypeGuardError";
22
-
23
- export * from "./re-exports";
24
-
25
- /* -----------------------------------------------------------
26
- BASIC VALIDATORS
27
- ----------------------------------------------------------- */
28
- /**
29
- * Asserts type `T`.
30
- *
31
- * Performs runtime type checking against compile-time type `T`. Stops at first
32
- * mismatch and throws {@link TypeGuardError} containing:
33
- *
34
- * - `path`: Property path where error occurred (e.g., `"input.user.age"`)
35
- * - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`)
36
- * - `value`: Actual value that failed validation
37
- *
38
- * Related functions:
39
- *
40
- * - {@link is} — Returns `boolean` instead of throwing
41
- * - {@link validate} — Collects all errors instead of stopping at first
42
- * - {@link assertGuard} — Type guard with no return value (narrows type only)
43
- * - {@link assertEquals} — Also rejects properties not defined in `T`
44
- *
45
- * @template T Target type to validate against
46
- * @param input Value to assert
47
- * @param errorFactory Custom error factory receiving
48
- * {@link TypeGuardError.IProps}
49
- * @returns The input value typed as `T`
50
- * @throws {TypeGuardError} When input doesn't conform to type `T`
51
- */
52
- export function assert<T>(
53
- input: T,
54
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
55
- ): T;
56
-
57
- /**
58
- * Asserts type `T`.
59
- *
60
- * Performs runtime type checking against compile-time type `T`. Stops at first
61
- * mismatch and throws {@link TypeGuardError} containing:
62
- *
63
- * - `path`: Property path where error occurred (e.g., `"input.user.age"`)
64
- * - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`)
65
- * - `value`: Actual value that failed validation
66
- *
67
- * Related functions:
68
- *
69
- * - {@link is} — Returns `boolean` instead of throwing
70
- * - {@link validate} — Collects all errors instead of stopping at first
71
- * - {@link assertGuard} — Type guard with no return value (narrows type only)
72
- * - {@link assertEquals} — Also rejects properties not defined in `T`
73
- *
74
- * @template T Target type to validate against
75
- * @param input Value to assert
76
- * @param errorFactory Custom error factory receiving
77
- * {@link TypeGuardError.IProps}
78
- * @returns The input value typed as `T`
79
- * @throws {TypeGuardError} When input doesn't conform to type `T`
80
- */
81
- export function assert<T>(
82
- input: unknown,
83
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
84
- ): T;
85
-
86
- /** @internal */
87
- export function assert(): never {
88
- NoTransformConfigurationError("assert");
89
- }
90
-
91
- /**
92
- * Asserts type `T` as assertion guard.
93
- *
94
- * Unlike {@link assert}, returns nothing (`asserts input is T`). After this
95
- * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when
96
- * you need type narrowing with runtime validation but don't need the return
97
- * value.
98
- *
99
- * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and
100
- * `value`.
101
- *
102
- * Related functions:
103
- *
104
- * - {@link assert} — Same validation but returns the input value
105
- * - {@link is} — Returns `boolean` instead of throwing
106
- * - {@link validate} — Collects all errors instead of throwing
107
- * - {@link assertGuardEquals} — Also rejects properties not defined in `T`
108
- *
109
- * @template T Target type to validate against
110
- * @param input Value to assert (narrowed to `T` after call)
111
- * @param errorFactory Custom error factory receiving
112
- * {@link TypeGuardError.IProps}
113
- * @throws {TypeGuardError} When input doesn't conform to type `T`
114
- */
115
- export function assertGuard<T>(
116
- input: T,
117
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
118
- ): asserts input is T;
119
-
120
- /**
121
- * Asserts type `T` as assertion guard.
122
- *
123
- * Unlike {@link assert}, returns nothing (`asserts input is T`). After this
124
- * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when
125
- * you need type narrowing with runtime validation but don't need the return
126
- * value.
127
- *
128
- * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and
129
- * `value`.
130
- *
131
- * Related functions:
132
- *
133
- * - {@link assert} — Same validation but returns the input value
134
- * - {@link is} — Returns `boolean` instead of throwing
135
- * - {@link validate} — Collects all errors instead of throwing
136
- * - {@link assertGuardEquals} — Also rejects properties not defined in `T`
137
- *
138
- * @template T Target type to validate against
139
- * @param input Value to assert (narrowed to `T` after call)
140
- * @param errorFactory Custom error factory receiving
141
- * {@link TypeGuardError.IProps}
142
- * @throws {TypeGuardError} When input doesn't conform to type `T`
143
- */
144
- export function assertGuard<T>(
145
- input: unknown,
146
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
147
- ): asserts input is T;
148
-
149
- /** @internal */
150
- export function assertGuard(): never {
151
- NoTransformConfigurationError("assertGuard");
152
- }
153
-
154
- /**
155
- * Tests type `T`.
156
- *
157
- * Performs runtime type checking without throwing exceptions. Acts as
158
- * TypeScript type guard, narrowing the input type in conditional branches when
159
- * result is `true`.
160
- *
161
- * Related functions:
162
- *
163
- * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on
164
- * mismatch
165
- * - {@link validate} — Returns all errors without throwing
166
- * - {@link equals} — Also rejects properties not defined in `T`
167
- *
168
- * @template T Target type to check
169
- * @param input Value to test
170
- * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
171
- */
172
- export function is<T>(input: T): input is T;
173
-
174
- /**
175
- * Tests type `T`.
176
- *
177
- * Performs runtime type checking without throwing exceptions. Acts as
178
- * TypeScript type guard, narrowing the input type in conditional branches when
179
- * result is `true`.
180
- *
181
- * Related functions:
182
- *
183
- * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on
184
- * mismatch
185
- * - {@link validate} — Returns all errors without throwing
186
- * - {@link equals} — Also rejects properties not defined in `T`
187
- *
188
- * @template T Target type to check
189
- * @param input Value to test
190
- * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
191
- */
192
- export function is<T>(input: unknown): input is T;
193
-
194
- /** @internal */
195
- export function is(): never {
196
- NoTransformConfigurationError("is");
197
- }
198
-
199
- /**
200
- * Validates type `T`.
201
- *
202
- * Unlike {@link assert} which throws on first error, this function continues
203
- * checking and collects all type mismatches into {@link IValidation.errors}
204
- * array. Never throws.
205
- *
206
- * Return structure:
207
- *
208
- * - `success: true` → `data` contains validated input as `T`
209
- * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,
210
- * `expected`, `value`
211
- *
212
- * Related functions:
213
- *
214
- * - {@link assert} — Throws on first error instead of collecting all
215
- * - {@link is} — Simple boolean check
216
- * - {@link validateEquals} — Also rejects properties not defined in `T`
217
- *
218
- * @template T Target type to validate against
219
- * @param input Value to validate
220
- * @returns {@link IValidation} <T> containing either `data` or `errors`
221
- */
222
- export function validate<T>(input: T): IValidation<T>;
223
-
224
- /**
225
- * Validates type `T`.
226
- *
227
- * Unlike {@link assert} which throws on first error, this function continues
228
- * checking and collects all type mismatches into {@link IValidation.errors}
229
- * array. Never throws.
230
- *
231
- * Return structure:
232
- *
233
- * - `success: true` → `data` contains validated input as `T`
234
- * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,
235
- * `expected`, `value`
236
- *
237
- * Related functions:
238
- *
239
- * - {@link assert} — Throws on first error instead of collecting all
240
- * - {@link is} — Simple boolean check
241
- * - {@link validateEquals} — Also rejects properties not defined in `T`
242
- *
243
- * @template T Target type to validate against
244
- * @param input Value to validate
245
- * @returns {@link IValidation} <T> containing either `data` or `errors`
246
- */
247
- export function validate<T>(input: unknown): IValidation<T>;
248
-
249
- /** @internal */
250
- export function validate(): never {
251
- NoTransformConfigurationError("validate");
252
- }
253
-
254
- /* -----------------------------------------------------------
255
- STRICT VALIDATORS
256
- ----------------------------------------------------------- */
257
- /**
258
- * Asserts type `T` with strict equality.
259
- *
260
- * Stricter than {@link assert}: also fails when input contains any property not
261
- * defined in type `T`. For extra property errors, `expected` will be
262
- * `"undefined"`.
263
- *
264
- * Related functions:
265
- *
266
- * - {@link assert} — Allows extra properties
267
- * - {@link equals} — Boolean result without throwing
268
- * - {@link validateEquals} — Collects all errors without throwing
269
- * - {@link assertGuardEquals} — Type guard version with no return value
270
- *
271
- * @template T Target type for exact match
272
- * @param input Value to validate
273
- * @param errorFactory Custom error factory receiving
274
- * {@link TypeGuardError.IProps}
275
- * @returns The input value typed as `T`
276
- * @throws {TypeGuardError} When type mismatch or extra property detected
277
- */
278
- export function assertEquals<T>(
279
- input: T,
280
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
281
- ): T;
282
-
283
- /**
284
- * Asserts type `T` with strict equality.
285
- *
286
- * Stricter than {@link assert}: also fails when input contains any property not
287
- * defined in type `T`. For extra property errors, `expected` will be
288
- * `"undefined"`.
289
- *
290
- * Related functions:
291
- *
292
- * - {@link assert} — Allows extra properties
293
- * - {@link equals} — Boolean result without throwing
294
- * - {@link validateEquals} — Collects all errors without throwing
295
- * - {@link assertGuardEquals} — Type guard version with no return value
296
- *
297
- * @template T Target type for exact match
298
- * @param input Value to validate
299
- * @param errorFactory Custom error factory receiving
300
- * {@link TypeGuardError.IProps}
301
- * @returns The input value typed as `T`
302
- * @throws {TypeGuardError} When type mismatch or extra property detected
303
- */
304
- export function assertEquals<T>(
305
- input: unknown,
306
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
307
- ): T;
308
-
309
- /** @internal */
310
- export function assertEquals(): never {
311
- NoTransformConfigurationError("assertEquals");
312
- }
313
-
314
- /**
315
- * Asserts type `T` with strict equality as assertion guard.
316
- *
317
- * Combines {@link assertGuard} with strict equality checking. Returns nothing
318
- * but narrows input to type `T`. Also fails when input contains properties not
319
- * in `T`.
320
- *
321
- * Related functions:
322
- *
323
- * - {@link assertGuard} — Allows extra properties
324
- * - {@link assertEquals} — Returns value instead of type guard
325
- * - {@link equals} — Boolean result without throwing
326
- * - {@link validateEquals} — Collects all errors without throwing
327
- *
328
- * @template T Target type for exact match
329
- * @param input Value to assert (narrowed to `T` after call)
330
- * @param errorFactory Custom error factory receiving
331
- * {@link TypeGuardError.IProps}
332
- * @throws {TypeGuardError} When type mismatch or extra property detected
333
- */
334
- export function assertGuardEquals<T>(
335
- input: T,
336
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
337
- ): asserts input is T;
338
-
339
- /**
340
- * Asserts type `T` with strict equality as assertion guard.
341
- *
342
- * Combines {@link assertGuard} with strict equality checking. Returns nothing
343
- * but narrows input to type `T`. Also fails when input contains properties not
344
- * in `T`.
345
- *
346
- * Related functions:
347
- *
348
- * - {@link assertGuard} — Allows extra properties
349
- * - {@link assertEquals} — Returns value instead of type guard
350
- * - {@link equals} — Boolean result without throwing
351
- * - {@link validateEquals} — Collects all errors without throwing
352
- *
353
- * @template T Target type for exact match
354
- * @param input Value to assert (narrowed to `T` after call)
355
- * @param errorFactory Custom error factory receiving
356
- * {@link TypeGuardError.IProps}
357
- * @throws {TypeGuardError} When type mismatch or extra property detected
358
- */
359
- export function assertGuardEquals<T>(
360
- input: unknown,
361
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
362
- ): asserts input is T;
363
-
364
- /** @internal */
365
- export function assertGuardEquals(): never {
366
- NoTransformConfigurationError("assertGuardEquals");
367
- }
368
-
369
- /**
370
- * Tests type `T` with strict equality.
371
- *
372
- * Stricter than {@link is}: also returns `false` when input contains any
373
- * property not defined in type `T`. Useful for detecting unexpected data or
374
- * typos.
375
- *
376
- * Related functions:
377
- *
378
- * - {@link is} — Allows extra properties
379
- * - {@link assertEquals} — Throws with detailed error info on mismatch
380
- * - {@link validateEquals} — Returns all errors without throwing
381
- *
382
- * @template T Target type for exact match
383
- * @param input Value to test
384
- * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
385
- */
386
- export function equals<T>(input: T): input is T;
387
-
388
- /**
389
- * Tests type `T` with strict equality.
390
- *
391
- * Stricter than {@link is}: also returns `false` when input contains any
392
- * property not defined in type `T`. Useful for detecting unexpected data or
393
- * typos.
394
- *
395
- * Related functions:
396
- *
397
- * - {@link is} — Allows extra properties
398
- * - {@link assertEquals} — Throws with detailed error info on mismatch
399
- * - {@link validateEquals} — Returns all errors without throwing
400
- *
401
- * @template T Target type for exact match
402
- * @param input Value to test
403
- * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
404
- */
405
- export function equals<T>(input: unknown): input is T;
406
-
407
- /** @internal */
408
- export function equals(): never {
409
- NoTransformConfigurationError("equals");
410
- }
411
-
412
- /**
413
- * Validates type `T` with strict equality.
414
- *
415
- * Combines {@link validate} with strict equality checking. Collects all errors
416
- * including extra property violations into {@link IValidation.errors} array.
417
- *
418
- * Return structure:
419
- *
420
- * - `success: true` → `data` contains validated input as `T`
421
- * - `success: false` → `errors` array with `path`, `expected`, `value` for each
422
- * mismatch
423
- *
424
- * Related functions:
425
- *
426
- * - {@link validate} — Allows extra properties
427
- * - {@link assertEquals} — Throws on first error
428
- * - {@link equals} — Simple boolean check
429
- *
430
- * @template T Target type for exact match
431
- * @param input Value to validate
432
- * @returns {@link IValidation} <T> containing either `data` or `errors`
433
- */
434
- export function validateEquals<T>(input: T): IValidation<T>;
435
-
436
- /**
437
- * Validates type `T` with strict equality.
438
- *
439
- * Combines {@link validate} with strict equality checking. Collects all errors
440
- * including extra property violations into {@link IValidation.errors} array.
441
- *
442
- * Return structure:
443
- *
444
- * - `success: true` → `data` contains validated input as `T`
445
- * - `success: false` → `errors` array with `path`, `expected`, `value` for each
446
- * mismatch
447
- *
448
- * Related functions:
449
- *
450
- * - {@link validate} — Allows extra properties
451
- * - {@link assertEquals} — Throws on first error
452
- * - {@link equals} — Simple boolean check
453
- *
454
- * @template T Target type for exact match
455
- * @param input Value to validate
456
- * @returns {@link IValidation} <T> containing either `data` or `errors`
457
- */
458
- export function validateEquals<T>(input: unknown): IValidation<T>;
459
-
460
- /** @internal */
461
- export function validateEquals(): never {
462
- NoTransformConfigurationError("validateEquals");
463
- }
464
-
465
- /* -----------------------------------------------------------
466
- RANDOM
467
- ----------------------------------------------------------- */
468
- /**
469
- * Generates random data of type `T`.
470
- *
471
- * Creates random instance conforming to compile-time type `T`. Generates only
472
- * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,
473
- * generates its return type instead.
474
- *
475
- * @template T Type of data to generate
476
- * @param generator Custom random generator implementing {@link IRandomGenerator}
477
- * @returns Randomly generated data as `Resolved<T>`
478
- * @danger You must configure the generic argument `T`
479
- */
480
- export function random(generator?: Partial<IRandomGenerator>): never;
481
-
482
- /**
483
- * Generates random data of type `T`.
484
- *
485
- * Creates random instance conforming to compile-time type `T`. Generates only
486
- * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,
487
- * generates its return type instead.
488
- *
489
- * @template T Type of data to generate
490
- * @param generator Custom random generator implementing {@link IRandomGenerator}
491
- * @returns Randomly generated data as `Resolved<T>`
492
- */
493
- export function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
494
-
495
- /** @internal */
496
- export function random(): never {
497
- NoTransformConfigurationError("random");
498
- }
499
-
500
- /* -----------------------------------------------------------
501
- FACTORY FUNCTIONS
502
- ----------------------------------------------------------- */
503
- /**
504
- * Creates reusable {@link assert} function.
505
- *
506
- * Returns a function that can be called multiple times without recompilation.
507
- * Useful when the same type validation is needed repeatedly.
508
- *
509
- * @template T Target type to validate against
510
- * @param errorFactory Custom error factory receiving
511
- * {@link TypeGuardError.IProps}
512
- * @returns Reusable assert function `(input: unknown) => T`
513
- * @danger You must configure the generic argument `T`
514
- */
515
- export function createAssert(
516
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
517
- ): never;
518
-
519
- /**
520
- * Creates reusable {@link assert} function.
521
- *
522
- * Returns a function that can be called multiple times without recompilation.
523
- * Useful when the same type validation is needed repeatedly.
524
- *
525
- * @template T Target type to validate against
526
- * @param errorFactory Custom error factory receiving
527
- * {@link TypeGuardError.IProps}
528
- * @returns Reusable assert function `(input: unknown) => T`
529
- */
530
- export function createAssert<T>(
531
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
532
- ): (input: unknown) => T;
533
-
534
- /** @internal */
535
- export function createAssert<T>(): (input: unknown) => T {
536
- NoTransformConfigurationError("createAssert");
537
- }
538
-
539
- /**
540
- * Creates reusable {@link assertGuard} function.
541
- *
542
- * Returns a reusable type guard assertion function.
543
- *
544
- * TypeScript requirement: You must declare the variable type explicitly. `const
545
- * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.
546
- *
547
- * @template T Target type to validate against
548
- * @param errorFactory Custom error factory receiving
549
- * {@link TypeGuardError.IProps}
550
- * @returns Reusable assertion guard function
551
- * @danger You must configure the generic argument `T`
552
- */
553
- export function createAssertGuard(
554
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
555
- ): never;
556
-
557
- /**
558
- * Creates reusable {@link assertGuard} function.
559
- *
560
- * Returns a reusable type guard assertion function.
561
- *
562
- * TypeScript requirement: You must declare the variable type explicitly. `const
563
- * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.
564
- *
565
- * @template T Target type to validate against
566
- * @param errorFactory Custom error factory receiving
567
- * {@link TypeGuardError.IProps}
568
- * @returns Reusable assertion guard function
569
- */
570
- export function createAssertGuard<T>(
571
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
572
- ): (input: unknown) => AssertionGuard<T>;
573
-
574
- /** @internal */
575
- export function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
576
- NoTransformConfigurationError("createAssertGuard");
577
- }
578
-
579
- /**
580
- * Creates reusable {@link is} function.
581
- *
582
- * Returns a type guard function that can be called multiple times without
583
- * recompilation.
584
- *
585
- * @template T Target type to check
586
- * @returns Reusable type guard function `(input: unknown) => input is T`
587
- * @danger You must configure the generic argument `T`
588
- */
589
- export function createIs(): never;
590
-
591
- /**
592
- * Creates reusable {@link is} function.
593
- *
594
- * Returns a type guard function that can be called multiple times without
595
- * recompilation.
596
- *
597
- * @template T Target type to check
598
- * @returns Reusable type guard function `(input: unknown) => input is T`
599
- */
600
- export function createIs<T>(): (input: unknown) => input is T;
601
-
602
- /** @internal */
603
- export function createIs<T>(): (input: unknown) => input is T {
604
- NoTransformConfigurationError("createIs");
605
- }
606
-
607
- /**
608
- * Creates reusable {@link validate} function.
609
- *
610
- * Returns a validation function that can be called multiple times without
611
- * recompilation. Also implements {@link StandardSchemaV1} interface for
612
- * interoperability.
613
- *
614
- * @template T Target type to validate against
615
- * @returns Reusable validate function `(input: unknown) => IValidation<T>`
616
- * @danger You must configure the generic argument `T`
617
- */
618
- export function createValidate(): never;
619
-
620
- /**
621
- * Creates reusable {@link validate} function.
622
- *
623
- * Returns a validation function that can be called multiple times without
624
- * recompilation. Also implements {@link StandardSchemaV1} interface for
625
- * interoperability.
626
- *
627
- * @template T Target type to validate against
628
- * @returns Reusable validate function `(input: unknown) => IValidation<T>`
629
- */
630
- export function createValidate<T>(): ((input: unknown) => IValidation<T>) &
631
- StandardSchemaV1<T, T>;
632
-
633
- /** @internal */
634
- export function createValidate(): ((input: unknown) => IValidation) &
635
- StandardSchemaV1<unknown, unknown> {
636
- NoTransformConfigurationError("createValidate");
637
- }
638
-
639
- /**
640
- * Creates reusable {@link assertEquals} function.
641
- *
642
- * Returns a strict assertion function that rejects superfluous properties. Can
643
- * be called multiple times without recompilation.
644
- *
645
- * @template T Target type for exact match
646
- * @param errorFactory Custom error factory receiving
647
- * {@link TypeGuardError.IProps}
648
- * @returns Reusable assertEquals function `(input: unknown) => T`
649
- * @danger You must configure the generic argument `T`
650
- */
651
- export function createAssertEquals(
652
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
653
- ): never;
654
-
655
- /**
656
- * Creates reusable {@link assertEquals} function.
657
- *
658
- * Returns a strict assertion function that rejects superfluous properties. Can
659
- * be called multiple times without recompilation.
660
- *
661
- * @template T Target type for exact match
662
- * @param errorFactory Custom error factory receiving
663
- * {@link TypeGuardError.IProps}
664
- * @returns Reusable assertEquals function `(input: unknown) => T`
665
- */
666
- export function createAssertEquals<T>(
667
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
668
- ): (input: unknown) => T;
669
-
670
- /** @internal */
671
- export function createAssertEquals<T>(): (input: unknown) => T {
672
- NoTransformConfigurationError("createAssertEquals");
673
- }
674
-
675
- /**
676
- * Creates reusable {@link assertGuardEquals} function.
677
- *
678
- * Returns a strict assertion guard that rejects superfluous properties.
679
- *
680
- * TypeScript requirement: You must declare the variable type explicitly. `const
681
- * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile
682
- * error.
683
- *
684
- * @template T Target type for exact match
685
- * @param errorFactory Custom error factory receiving
686
- * {@link TypeGuardError.IProps}
687
- * @returns Reusable assertion guard function
688
- * @danger You must configure the generic argument `T`
689
- */
690
- export function createAssertGuardEquals(
691
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
692
- ): never;
693
-
694
- /**
695
- * Creates reusable {@link assertGuardEquals} function.
696
- *
697
- * Returns a strict assertion guard that rejects superfluous properties.
698
- *
699
- * TypeScript requirement: You must declare the variable type explicitly. `const
700
- * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile
701
- * error.
702
- *
703
- * @template T Target type for exact match
704
- * @param errorFactory Custom error factory receiving
705
- * {@link TypeGuardError.IProps}
706
- * @returns Reusable assertion guard function
707
- */
708
- export function createAssertGuardEquals<T>(
709
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
710
- ): (input: unknown) => AssertionGuard<T>;
711
-
712
- /** @internal */
713
- export function createAssertGuardEquals<T>(): (
714
- input: unknown,
715
- ) => AssertionGuard<T> {
716
- NoTransformConfigurationError("createAssertGuardEquals");
717
- }
718
-
719
- /**
720
- * Creates reusable {@link equals} function.
721
- *
722
- * Returns a strict type guard that rejects superfluous properties. Can be
723
- * called multiple times without recompilation.
724
- *
725
- * @template T Target type for exact match
726
- * @returns Reusable type guard function `(input: unknown) => input is T`
727
- * @danger You must configure the generic argument `T`
728
- */
729
- export function createEquals(): never;
730
-
731
- /**
732
- * Creates reusable {@link equals} function.
733
- *
734
- * Returns a strict type guard that rejects superfluous properties. Can be
735
- * called multiple times without recompilation.
736
- *
737
- * @template T Target type for exact match
738
- * @returns Reusable type guard function `(input: unknown) => input is T`
739
- */
740
- export function createEquals<T>(): (input: unknown) => input is T;
741
-
742
- /** @internal */
743
- export function createEquals<T>(): (input: unknown) => input is T {
744
- NoTransformConfigurationError("createEquals");
745
- }
746
-
747
- /**
748
- * Creates reusable {@link validateEquals} function.
749
- *
750
- * Returns a strict validation function that rejects superfluous properties.
751
- * Also implements {@link StandardSchemaV1} interface for interoperability.
752
- *
753
- * @template T Target type for exact match
754
- * @returns Reusable validateEquals function `(input: unknown) =>
755
- * IValidation<T>`
756
- * @danger You must configure the generic argument `T`
757
- */
758
- export function createValidateEquals(): never;
759
-
760
- /**
761
- * Creates reusable {@link validateEquals} function.
762
- *
763
- * Returns a strict validation function that rejects superfluous properties.
764
- * Also implements {@link StandardSchemaV1} interface for interoperability.
765
- *
766
- * @template T Target type for exact match
767
- * @returns Reusable validateEquals function `(input: unknown) =>
768
- * IValidation<T>`
769
- */
770
- export function createValidateEquals<T>(): ((
771
- input: unknown,
772
- ) => IValidation<T>) &
773
- StandardSchemaV1<T, T>;
774
-
775
- /** @internal */
776
- export function createValidateEquals(): ((input: unknown) => IValidation) &
777
- StandardSchemaV1<unknown, unknown> {
778
- NoTransformConfigurationError("createValidateEquals");
779
- }
780
-
781
- /**
782
- * Creates reusable {@link random} function.
783
- *
784
- * Returns a random data generator that can be called multiple times without
785
- * recompilation.
786
- *
787
- * @template T Type of data to generate
788
- * @param generator Custom random generator implementing {@link IRandomGenerator}
789
- * @returns Reusable random function `() => Resolved<T>`
790
- * @danger You must configure the generic argument `T`
791
- */
792
- export function createRandom(generator?: Partial<IRandomGenerator>): never;
793
-
794
- /**
795
- * Creates reusable {@link random} function.
796
- *
797
- * Returns a random data generator that can be called multiple times without
798
- * recompilation.
799
- *
800
- * @template T Type of data to generate
801
- * @param generator Custom random generator implementing {@link IRandomGenerator}
802
- * @returns Reusable random function `() => Resolved<T>`
803
- */
804
- export function createRandom<T>(
805
- generator?: Partial<IRandomGenerator>,
806
- ): () => Resolved<T>;
807
-
808
- /** @internal */
809
- export function createRandom(): never {
810
- NoTransformConfigurationError("createRandom");
811
- }
1
+ import { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import {
3
+ AssertionGuard,
4
+ IRandomGenerator,
5
+ IValidation,
6
+ Resolved,
7
+ } from "@typia/interface";
8
+
9
+ import { TypeGuardError } from "./TypeGuardError";
10
+ import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
11
+
12
+ export * as functional from "./functional";
13
+ export * as http from "./http";
14
+ export * as llm from "./llm";
15
+ export * as json from "./json";
16
+ export * as misc from "./misc";
17
+ export * as notations from "./notations";
18
+ export * as protobuf from "./protobuf";
19
+ export * as reflect from "./reflect";
20
+
21
+ export * from "./TypeGuardError";
22
+
23
+ export * from "./re-exports";
24
+
25
+ /* -----------------------------------------------------------
26
+ BASIC VALIDATORS
27
+ ----------------------------------------------------------- */
28
+ /**
29
+ * Asserts type `T`.
30
+ *
31
+ * Performs runtime type checking against compile-time type `T`. Stops at first
32
+ * mismatch and throws {@link TypeGuardError} containing:
33
+ *
34
+ * - `path`: Property path where error occurred (e.g., `"input.user.age"`)
35
+ * - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`)
36
+ * - `value`: Actual value that failed validation
37
+ *
38
+ * Related functions:
39
+ *
40
+ * - {@link is} — Returns `boolean` instead of throwing
41
+ * - {@link validate} — Collects all errors instead of stopping at first
42
+ * - {@link assertGuard} — Type guard with no return value (narrows type only)
43
+ * - {@link assertEquals} — Also rejects properties not defined in `T`
44
+ *
45
+ * @template T Target type to validate against
46
+ * @param input Value to assert
47
+ * @param errorFactory Custom error factory receiving
48
+ * {@link TypeGuardError.IProps}
49
+ * @returns The input value typed as `T`
50
+ * @throws {TypeGuardError} When input doesn't conform to type `T`
51
+ */
52
+ export function assert<T>(
53
+ input: T,
54
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
55
+ ): T;
56
+
57
+ /**
58
+ * Asserts type `T`.
59
+ *
60
+ * Performs runtime type checking against compile-time type `T`. Stops at first
61
+ * mismatch and throws {@link TypeGuardError} containing:
62
+ *
63
+ * - `path`: Property path where error occurred (e.g., `"input.user.age"`)
64
+ * - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`)
65
+ * - `value`: Actual value that failed validation
66
+ *
67
+ * Related functions:
68
+ *
69
+ * - {@link is} — Returns `boolean` instead of throwing
70
+ * - {@link validate} — Collects all errors instead of stopping at first
71
+ * - {@link assertGuard} — Type guard with no return value (narrows type only)
72
+ * - {@link assertEquals} — Also rejects properties not defined in `T`
73
+ *
74
+ * @template T Target type to validate against
75
+ * @param input Value to assert
76
+ * @param errorFactory Custom error factory receiving
77
+ * {@link TypeGuardError.IProps}
78
+ * @returns The input value typed as `T`
79
+ * @throws {TypeGuardError} When input doesn't conform to type `T`
80
+ */
81
+ export function assert<T>(
82
+ input: unknown,
83
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
84
+ ): T;
85
+
86
+ /** @internal */
87
+ export function assert(): never {
88
+ NoTransformConfigurationError("assert");
89
+ }
90
+
91
+ /**
92
+ * Asserts type `T` as assertion guard.
93
+ *
94
+ * Unlike {@link assert}, returns nothing (`asserts input is T`). After this
95
+ * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when
96
+ * you need type narrowing with runtime validation but don't need the return
97
+ * value.
98
+ *
99
+ * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and
100
+ * `value`.
101
+ *
102
+ * Related functions:
103
+ *
104
+ * - {@link assert} — Same validation but returns the input value
105
+ * - {@link is} — Returns `boolean` instead of throwing
106
+ * - {@link validate} — Collects all errors instead of throwing
107
+ * - {@link assertGuardEquals} — Also rejects properties not defined in `T`
108
+ *
109
+ * @template T Target type to validate against
110
+ * @param input Value to assert (narrowed to `T` after call)
111
+ * @param errorFactory Custom error factory receiving
112
+ * {@link TypeGuardError.IProps}
113
+ * @throws {TypeGuardError} When input doesn't conform to type `T`
114
+ */
115
+ export function assertGuard<T>(
116
+ input: T,
117
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
118
+ ): asserts input is T;
119
+
120
+ /**
121
+ * Asserts type `T` as assertion guard.
122
+ *
123
+ * Unlike {@link assert}, returns nothing (`asserts input is T`). After this
124
+ * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when
125
+ * you need type narrowing with runtime validation but don't need the return
126
+ * value.
127
+ *
128
+ * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and
129
+ * `value`.
130
+ *
131
+ * Related functions:
132
+ *
133
+ * - {@link assert} — Same validation but returns the input value
134
+ * - {@link is} — Returns `boolean` instead of throwing
135
+ * - {@link validate} — Collects all errors instead of throwing
136
+ * - {@link assertGuardEquals} — Also rejects properties not defined in `T`
137
+ *
138
+ * @template T Target type to validate against
139
+ * @param input Value to assert (narrowed to `T` after call)
140
+ * @param errorFactory Custom error factory receiving
141
+ * {@link TypeGuardError.IProps}
142
+ * @throws {TypeGuardError} When input doesn't conform to type `T`
143
+ */
144
+ export function assertGuard<T>(
145
+ input: unknown,
146
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
147
+ ): asserts input is T;
148
+
149
+ /** @internal */
150
+ export function assertGuard(): never {
151
+ NoTransformConfigurationError("assertGuard");
152
+ }
153
+
154
+ /**
155
+ * Tests type `T`.
156
+ *
157
+ * Performs runtime type checking without throwing exceptions. Acts as
158
+ * TypeScript type guard, narrowing the input type in conditional branches when
159
+ * result is `true`.
160
+ *
161
+ * Related functions:
162
+ *
163
+ * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on
164
+ * mismatch
165
+ * - {@link validate} — Returns all errors without throwing
166
+ * - {@link equals} — Also rejects properties not defined in `T`
167
+ *
168
+ * @template T Target type to check
169
+ * @param input Value to test
170
+ * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
171
+ */
172
+ export function is<T>(input: T): input is T;
173
+
174
+ /**
175
+ * Tests type `T`.
176
+ *
177
+ * Performs runtime type checking without throwing exceptions. Acts as
178
+ * TypeScript type guard, narrowing the input type in conditional branches when
179
+ * result is `true`.
180
+ *
181
+ * Related functions:
182
+ *
183
+ * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on
184
+ * mismatch
185
+ * - {@link validate} — Returns all errors without throwing
186
+ * - {@link equals} — Also rejects properties not defined in `T`
187
+ *
188
+ * @template T Target type to check
189
+ * @param input Value to test
190
+ * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
191
+ */
192
+ export function is<T>(input: unknown): input is T;
193
+
194
+ /** @internal */
195
+ export function is(): never {
196
+ NoTransformConfigurationError("is");
197
+ }
198
+
199
+ /**
200
+ * Validates type `T`.
201
+ *
202
+ * Unlike {@link assert} which throws on first error, this function continues
203
+ * checking and collects all type mismatches into {@link IValidation.errors}
204
+ * array. Never throws.
205
+ *
206
+ * Return structure:
207
+ *
208
+ * - `success: true` → `data` contains validated input as `T`
209
+ * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,
210
+ * `expected`, `value`
211
+ *
212
+ * Related functions:
213
+ *
214
+ * - {@link assert} — Throws on first error instead of collecting all
215
+ * - {@link is} — Simple boolean check
216
+ * - {@link validateEquals} — Also rejects properties not defined in `T`
217
+ *
218
+ * @template T Target type to validate against
219
+ * @param input Value to validate
220
+ * @returns {@link IValidation} <T> containing either `data` or `errors`
221
+ */
222
+ export function validate<T>(input: T): IValidation<T>;
223
+
224
+ /**
225
+ * Validates type `T`.
226
+ *
227
+ * Unlike {@link assert} which throws on first error, this function continues
228
+ * checking and collects all type mismatches into {@link IValidation.errors}
229
+ * array. Never throws.
230
+ *
231
+ * Return structure:
232
+ *
233
+ * - `success: true` → `data` contains validated input as `T`
234
+ * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,
235
+ * `expected`, `value`
236
+ *
237
+ * Related functions:
238
+ *
239
+ * - {@link assert} — Throws on first error instead of collecting all
240
+ * - {@link is} — Simple boolean check
241
+ * - {@link validateEquals} — Also rejects properties not defined in `T`
242
+ *
243
+ * @template T Target type to validate against
244
+ * @param input Value to validate
245
+ * @returns {@link IValidation} <T> containing either `data` or `errors`
246
+ */
247
+ export function validate<T>(input: unknown): IValidation<T>;
248
+
249
+ /** @internal */
250
+ export function validate(): never {
251
+ NoTransformConfigurationError("validate");
252
+ }
253
+
254
+ /* -----------------------------------------------------------
255
+ STRICT VALIDATORS
256
+ ----------------------------------------------------------- */
257
+ /**
258
+ * Asserts type `T` with strict equality.
259
+ *
260
+ * Stricter than {@link assert}: also fails when input contains any property not
261
+ * defined in type `T`. For extra property errors, `expected` will be
262
+ * `"undefined"`.
263
+ *
264
+ * Related functions:
265
+ *
266
+ * - {@link assert} — Allows extra properties
267
+ * - {@link equals} — Boolean result without throwing
268
+ * - {@link validateEquals} — Collects all errors without throwing
269
+ * - {@link assertGuardEquals} — Type guard version with no return value
270
+ *
271
+ * @template T Target type for exact match
272
+ * @param input Value to validate
273
+ * @param errorFactory Custom error factory receiving
274
+ * {@link TypeGuardError.IProps}
275
+ * @returns The input value typed as `T`
276
+ * @throws {TypeGuardError} When type mismatch or extra property detected
277
+ */
278
+ export function assertEquals<T>(
279
+ input: T,
280
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
281
+ ): T;
282
+
283
+ /**
284
+ * Asserts type `T` with strict equality.
285
+ *
286
+ * Stricter than {@link assert}: also fails when input contains any property not
287
+ * defined in type `T`. For extra property errors, `expected` will be
288
+ * `"undefined"`.
289
+ *
290
+ * Related functions:
291
+ *
292
+ * - {@link assert} — Allows extra properties
293
+ * - {@link equals} — Boolean result without throwing
294
+ * - {@link validateEquals} — Collects all errors without throwing
295
+ * - {@link assertGuardEquals} — Type guard version with no return value
296
+ *
297
+ * @template T Target type for exact match
298
+ * @param input Value to validate
299
+ * @param errorFactory Custom error factory receiving
300
+ * {@link TypeGuardError.IProps}
301
+ * @returns The input value typed as `T`
302
+ * @throws {TypeGuardError} When type mismatch or extra property detected
303
+ */
304
+ export function assertEquals<T>(
305
+ input: unknown,
306
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
307
+ ): T;
308
+
309
+ /** @internal */
310
+ export function assertEquals(): never {
311
+ NoTransformConfigurationError("assertEquals");
312
+ }
313
+
314
+ /**
315
+ * Asserts type `T` with strict equality as assertion guard.
316
+ *
317
+ * Combines {@link assertGuard} with strict equality checking. Returns nothing
318
+ * but narrows input to type `T`. Also fails when input contains properties not
319
+ * in `T`.
320
+ *
321
+ * Related functions:
322
+ *
323
+ * - {@link assertGuard} — Allows extra properties
324
+ * - {@link assertEquals} — Returns value instead of type guard
325
+ * - {@link equals} — Boolean result without throwing
326
+ * - {@link validateEquals} — Collects all errors without throwing
327
+ *
328
+ * @template T Target type for exact match
329
+ * @param input Value to assert (narrowed to `T` after call)
330
+ * @param errorFactory Custom error factory receiving
331
+ * {@link TypeGuardError.IProps}
332
+ * @throws {TypeGuardError} When type mismatch or extra property detected
333
+ */
334
+ export function assertGuardEquals<T>(
335
+ input: T,
336
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
337
+ ): asserts input is T;
338
+
339
+ /**
340
+ * Asserts type `T` with strict equality as assertion guard.
341
+ *
342
+ * Combines {@link assertGuard} with strict equality checking. Returns nothing
343
+ * but narrows input to type `T`. Also fails when input contains properties not
344
+ * in `T`.
345
+ *
346
+ * Related functions:
347
+ *
348
+ * - {@link assertGuard} — Allows extra properties
349
+ * - {@link assertEquals} — Returns value instead of type guard
350
+ * - {@link equals} — Boolean result without throwing
351
+ * - {@link validateEquals} — Collects all errors without throwing
352
+ *
353
+ * @template T Target type for exact match
354
+ * @param input Value to assert (narrowed to `T` after call)
355
+ * @param errorFactory Custom error factory receiving
356
+ * {@link TypeGuardError.IProps}
357
+ * @throws {TypeGuardError} When type mismatch or extra property detected
358
+ */
359
+ export function assertGuardEquals<T>(
360
+ input: unknown,
361
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
362
+ ): asserts input is T;
363
+
364
+ /** @internal */
365
+ export function assertGuardEquals(): never {
366
+ NoTransformConfigurationError("assertGuardEquals");
367
+ }
368
+
369
+ /**
370
+ * Tests type `T` with strict equality.
371
+ *
372
+ * Stricter than {@link is}: also returns `false` when input contains any
373
+ * property not defined in type `T`. Useful for detecting unexpected data or
374
+ * typos.
375
+ *
376
+ * Related functions:
377
+ *
378
+ * - {@link is} — Allows extra properties
379
+ * - {@link assertEquals} — Throws with detailed error info on mismatch
380
+ * - {@link validateEquals} — Returns all errors without throwing
381
+ *
382
+ * @template T Target type for exact match
383
+ * @param input Value to test
384
+ * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
385
+ */
386
+ export function equals<T>(input: T): input is T;
387
+
388
+ /**
389
+ * Tests type `T` with strict equality.
390
+ *
391
+ * Stricter than {@link is}: also returns `false` when input contains any
392
+ * property not defined in type `T`. Useful for detecting unexpected data or
393
+ * typos.
394
+ *
395
+ * Related functions:
396
+ *
397
+ * - {@link is} — Allows extra properties
398
+ * - {@link assertEquals} — Throws with detailed error info on mismatch
399
+ * - {@link validateEquals} — Returns all errors without throwing
400
+ *
401
+ * @template T Target type for exact match
402
+ * @param input Value to test
403
+ * @returns `true` if valid, `false` otherwise (type predicate `input is T`)
404
+ */
405
+ export function equals<T>(input: unknown): input is T;
406
+
407
+ /** @internal */
408
+ export function equals(): never {
409
+ NoTransformConfigurationError("equals");
410
+ }
411
+
412
+ /**
413
+ * Validates type `T` with strict equality.
414
+ *
415
+ * Combines {@link validate} with strict equality checking. Collects all errors
416
+ * including extra property violations into {@link IValidation.errors} array.
417
+ *
418
+ * Return structure:
419
+ *
420
+ * - `success: true` → `data` contains validated input as `T`
421
+ * - `success: false` → `errors` array with `path`, `expected`, `value` for each
422
+ * mismatch
423
+ *
424
+ * Related functions:
425
+ *
426
+ * - {@link validate} — Allows extra properties
427
+ * - {@link assertEquals} — Throws on first error
428
+ * - {@link equals} — Simple boolean check
429
+ *
430
+ * @template T Target type for exact match
431
+ * @param input Value to validate
432
+ * @returns {@link IValidation} <T> containing either `data` or `errors`
433
+ */
434
+ export function validateEquals<T>(input: T): IValidation<T>;
435
+
436
+ /**
437
+ * Validates type `T` with strict equality.
438
+ *
439
+ * Combines {@link validate} with strict equality checking. Collects all errors
440
+ * including extra property violations into {@link IValidation.errors} array.
441
+ *
442
+ * Return structure:
443
+ *
444
+ * - `success: true` → `data` contains validated input as `T`
445
+ * - `success: false` → `errors` array with `path`, `expected`, `value` for each
446
+ * mismatch
447
+ *
448
+ * Related functions:
449
+ *
450
+ * - {@link validate} — Allows extra properties
451
+ * - {@link assertEquals} — Throws on first error
452
+ * - {@link equals} — Simple boolean check
453
+ *
454
+ * @template T Target type for exact match
455
+ * @param input Value to validate
456
+ * @returns {@link IValidation} <T> containing either `data` or `errors`
457
+ */
458
+ export function validateEquals<T>(input: unknown): IValidation<T>;
459
+
460
+ /** @internal */
461
+ export function validateEquals(): never {
462
+ NoTransformConfigurationError("validateEquals");
463
+ }
464
+
465
+ /* -----------------------------------------------------------
466
+ RANDOM
467
+ ----------------------------------------------------------- */
468
+ /**
469
+ * Generates random data of type `T`.
470
+ *
471
+ * Creates random instance conforming to compile-time type `T`. Generates only
472
+ * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,
473
+ * generates its return type instead.
474
+ *
475
+ * @template T Type of data to generate
476
+ * @param generator Custom random generator implementing {@link IRandomGenerator}
477
+ * @returns Randomly generated data as `Resolved<T>`
478
+ * @danger You must configure the generic argument `T`
479
+ */
480
+ export function random(generator?: Partial<IRandomGenerator>): never;
481
+
482
+ /**
483
+ * Generates random data of type `T`.
484
+ *
485
+ * Creates random instance conforming to compile-time type `T`. Generates only
486
+ * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,
487
+ * generates its return type instead.
488
+ *
489
+ * @template T Type of data to generate
490
+ * @param generator Custom random generator implementing {@link IRandomGenerator}
491
+ * @returns Randomly generated data as `Resolved<T>`
492
+ */
493
+ export function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;
494
+
495
+ /** @internal */
496
+ export function random(): never {
497
+ NoTransformConfigurationError("random");
498
+ }
499
+
500
+ /* -----------------------------------------------------------
501
+ FACTORY FUNCTIONS
502
+ ----------------------------------------------------------- */
503
+ /**
504
+ * Creates reusable {@link assert} function.
505
+ *
506
+ * Returns a function that can be called multiple times without recompilation.
507
+ * Useful when the same type validation is needed repeatedly.
508
+ *
509
+ * @template T Target type to validate against
510
+ * @param errorFactory Custom error factory receiving
511
+ * {@link TypeGuardError.IProps}
512
+ * @returns Reusable assert function `(input: unknown) => T`
513
+ * @danger You must configure the generic argument `T`
514
+ */
515
+ export function createAssert(
516
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
517
+ ): never;
518
+
519
+ /**
520
+ * Creates reusable {@link assert} function.
521
+ *
522
+ * Returns a function that can be called multiple times without recompilation.
523
+ * Useful when the same type validation is needed repeatedly.
524
+ *
525
+ * @template T Target type to validate against
526
+ * @param errorFactory Custom error factory receiving
527
+ * {@link TypeGuardError.IProps}
528
+ * @returns Reusable assert function `(input: unknown) => T`
529
+ */
530
+ export function createAssert<T>(
531
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
532
+ ): (input: unknown) => T;
533
+
534
+ /** @internal */
535
+ export function createAssert<T>(): (input: unknown) => T {
536
+ NoTransformConfigurationError("createAssert");
537
+ }
538
+
539
+ /**
540
+ * Creates reusable {@link assertGuard} function.
541
+ *
542
+ * Returns a reusable type guard assertion function.
543
+ *
544
+ * TypeScript requirement: You must declare the variable type explicitly. `const
545
+ * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.
546
+ *
547
+ * @template T Target type to validate against
548
+ * @param errorFactory Custom error factory receiving
549
+ * {@link TypeGuardError.IProps}
550
+ * @returns Reusable assertion guard function
551
+ * @danger You must configure the generic argument `T`
552
+ */
553
+ export function createAssertGuard(
554
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
555
+ ): never;
556
+
557
+ /**
558
+ * Creates reusable {@link assertGuard} function.
559
+ *
560
+ * Returns a reusable type guard assertion function.
561
+ *
562
+ * TypeScript requirement: You must declare the variable type explicitly. `const
563
+ * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.
564
+ *
565
+ * @template T Target type to validate against
566
+ * @param errorFactory Custom error factory receiving
567
+ * {@link TypeGuardError.IProps}
568
+ * @returns Reusable assertion guard function
569
+ */
570
+ export function createAssertGuard<T>(
571
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
572
+ ): (input: unknown) => AssertionGuard<T>;
573
+
574
+ /** @internal */
575
+ export function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
576
+ NoTransformConfigurationError("createAssertGuard");
577
+ }
578
+
579
+ /**
580
+ * Creates reusable {@link is} function.
581
+ *
582
+ * Returns a type guard function that can be called multiple times without
583
+ * recompilation.
584
+ *
585
+ * @template T Target type to check
586
+ * @returns Reusable type guard function `(input: unknown) => input is T`
587
+ * @danger You must configure the generic argument `T`
588
+ */
589
+ export function createIs(): never;
590
+
591
+ /**
592
+ * Creates reusable {@link is} function.
593
+ *
594
+ * Returns a type guard function that can be called multiple times without
595
+ * recompilation.
596
+ *
597
+ * @template T Target type to check
598
+ * @returns Reusable type guard function `(input: unknown) => input is T`
599
+ */
600
+ export function createIs<T>(): (input: unknown) => input is T;
601
+
602
+ /** @internal */
603
+ export function createIs<T>(): (input: unknown) => input is T {
604
+ NoTransformConfigurationError("createIs");
605
+ }
606
+
607
+ /**
608
+ * Creates reusable {@link validate} function.
609
+ *
610
+ * Returns a validation function that can be called multiple times without
611
+ * recompilation. Also implements {@link StandardSchemaV1} interface for
612
+ * interoperability.
613
+ *
614
+ * @template T Target type to validate against
615
+ * @returns Reusable validate function `(input: unknown) => IValidation<T>`
616
+ * @danger You must configure the generic argument `T`
617
+ */
618
+ export function createValidate(): never;
619
+
620
+ /**
621
+ * Creates reusable {@link validate} function.
622
+ *
623
+ * Returns a validation function that can be called multiple times without
624
+ * recompilation. Also implements {@link StandardSchemaV1} interface for
625
+ * interoperability.
626
+ *
627
+ * @template T Target type to validate against
628
+ * @returns Reusable validate function `(input: unknown) => IValidation<T>`
629
+ */
630
+ export function createValidate<T>(): ((input: unknown) => IValidation<T>) &
631
+ StandardSchemaV1<T, T>;
632
+
633
+ /** @internal */
634
+ export function createValidate(): ((input: unknown) => IValidation) &
635
+ StandardSchemaV1<unknown, unknown> {
636
+ NoTransformConfigurationError("createValidate");
637
+ }
638
+
639
+ /**
640
+ * Creates reusable {@link assertEquals} function.
641
+ *
642
+ * Returns a strict assertion function that rejects superfluous properties. Can
643
+ * be called multiple times without recompilation.
644
+ *
645
+ * @template T Target type for exact match
646
+ * @param errorFactory Custom error factory receiving
647
+ * {@link TypeGuardError.IProps}
648
+ * @returns Reusable assertEquals function `(input: unknown) => T`
649
+ * @danger You must configure the generic argument `T`
650
+ */
651
+ export function createAssertEquals(
652
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
653
+ ): never;
654
+
655
+ /**
656
+ * Creates reusable {@link assertEquals} function.
657
+ *
658
+ * Returns a strict assertion function that rejects superfluous properties. Can
659
+ * be called multiple times without recompilation.
660
+ *
661
+ * @template T Target type for exact match
662
+ * @param errorFactory Custom error factory receiving
663
+ * {@link TypeGuardError.IProps}
664
+ * @returns Reusable assertEquals function `(input: unknown) => T`
665
+ */
666
+ export function createAssertEquals<T>(
667
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
668
+ ): (input: unknown) => T;
669
+
670
+ /** @internal */
671
+ export function createAssertEquals<T>(): (input: unknown) => T {
672
+ NoTransformConfigurationError("createAssertEquals");
673
+ }
674
+
675
+ /**
676
+ * Creates reusable {@link assertGuardEquals} function.
677
+ *
678
+ * Returns a strict assertion guard that rejects superfluous properties.
679
+ *
680
+ * TypeScript requirement: You must declare the variable type explicitly. `const
681
+ * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile
682
+ * error.
683
+ *
684
+ * @template T Target type for exact match
685
+ * @param errorFactory Custom error factory receiving
686
+ * {@link TypeGuardError.IProps}
687
+ * @returns Reusable assertion guard function
688
+ * @danger You must configure the generic argument `T`
689
+ */
690
+ export function createAssertGuardEquals(
691
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
692
+ ): never;
693
+
694
+ /**
695
+ * Creates reusable {@link assertGuardEquals} function.
696
+ *
697
+ * Returns a strict assertion guard that rejects superfluous properties.
698
+ *
699
+ * TypeScript requirement: You must declare the variable type explicitly. `const
700
+ * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile
701
+ * error.
702
+ *
703
+ * @template T Target type for exact match
704
+ * @param errorFactory Custom error factory receiving
705
+ * {@link TypeGuardError.IProps}
706
+ * @returns Reusable assertion guard function
707
+ */
708
+ export function createAssertGuardEquals<T>(
709
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
710
+ ): (input: unknown) => AssertionGuard<T>;
711
+
712
+ /** @internal */
713
+ export function createAssertGuardEquals<T>(): (
714
+ input: unknown,
715
+ ) => AssertionGuard<T> {
716
+ NoTransformConfigurationError("createAssertGuardEquals");
717
+ }
718
+
719
+ /**
720
+ * Creates reusable {@link equals} function.
721
+ *
722
+ * Returns a strict type guard that rejects superfluous properties. Can be
723
+ * called multiple times without recompilation.
724
+ *
725
+ * @template T Target type for exact match
726
+ * @returns Reusable type guard function `(input: unknown) => input is T`
727
+ * @danger You must configure the generic argument `T`
728
+ */
729
+ export function createEquals(): never;
730
+
731
+ /**
732
+ * Creates reusable {@link equals} function.
733
+ *
734
+ * Returns a strict type guard that rejects superfluous properties. Can be
735
+ * called multiple times without recompilation.
736
+ *
737
+ * @template T Target type for exact match
738
+ * @returns Reusable type guard function `(input: unknown) => input is T`
739
+ */
740
+ export function createEquals<T>(): (input: unknown) => input is T;
741
+
742
+ /** @internal */
743
+ export function createEquals<T>(): (input: unknown) => input is T {
744
+ NoTransformConfigurationError("createEquals");
745
+ }
746
+
747
+ /**
748
+ * Creates reusable {@link validateEquals} function.
749
+ *
750
+ * Returns a strict validation function that rejects superfluous properties.
751
+ * Also implements {@link StandardSchemaV1} interface for interoperability.
752
+ *
753
+ * @template T Target type for exact match
754
+ * @returns Reusable validateEquals function `(input: unknown) =>
755
+ * IValidation<T>`
756
+ * @danger You must configure the generic argument `T`
757
+ */
758
+ export function createValidateEquals(): never;
759
+
760
+ /**
761
+ * Creates reusable {@link validateEquals} function.
762
+ *
763
+ * Returns a strict validation function that rejects superfluous properties.
764
+ * Also implements {@link StandardSchemaV1} interface for interoperability.
765
+ *
766
+ * @template T Target type for exact match
767
+ * @returns Reusable validateEquals function `(input: unknown) =>
768
+ * IValidation<T>`
769
+ */
770
+ export function createValidateEquals<T>(): ((
771
+ input: unknown,
772
+ ) => IValidation<T>) &
773
+ StandardSchemaV1<T, T>;
774
+
775
+ /** @internal */
776
+ export function createValidateEquals(): ((input: unknown) => IValidation) &
777
+ StandardSchemaV1<unknown, unknown> {
778
+ NoTransformConfigurationError("createValidateEquals");
779
+ }
780
+
781
+ /**
782
+ * Creates reusable {@link random} function.
783
+ *
784
+ * Returns a random data generator that can be called multiple times without
785
+ * recompilation.
786
+ *
787
+ * @template T Type of data to generate
788
+ * @param generator Custom random generator implementing {@link IRandomGenerator}
789
+ * @returns Reusable random function `() => Resolved<T>`
790
+ * @danger You must configure the generic argument `T`
791
+ */
792
+ export function createRandom(generator?: Partial<IRandomGenerator>): never;
793
+
794
+ /**
795
+ * Creates reusable {@link random} function.
796
+ *
797
+ * Returns a random data generator that can be called multiple times without
798
+ * recompilation.
799
+ *
800
+ * @template T Type of data to generate
801
+ * @param generator Custom random generator implementing {@link IRandomGenerator}
802
+ * @returns Reusable random function `() => Resolved<T>`
803
+ */
804
+ export function createRandom<T>(
805
+ generator?: Partial<IRandomGenerator>,
806
+ ): () => Resolved<T>;
807
+
808
+ /** @internal */
809
+ export function createRandom(): never {
810
+ NoTransformConfigurationError("createRandom");
811
+ }