typia 12.0.0-dev.20260307-2 → 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.
- package/lib/executable/setup/PluginConfigurator.js +3 -3
- package/lib/executable/setup/PluginConfigurator.mjs +3 -3
- package/lib/executable/setup/PluginConfigurator.mjs.map +1 -1
- package/lib/executable/typia.js +15 -15
- package/lib/executable/typia.mjs +15 -15
- package/lib/internal/_coerceLlmArguments.d.ts +2 -0
- package/lib/internal/_coerceLlmArguments.js +7 -0
- package/lib/internal/_coerceLlmArguments.js.map +1 -0
- package/lib/internal/_coerceLlmArguments.mjs +6 -0
- package/lib/internal/_coerceLlmArguments.mjs.map +1 -0
- package/lib/internal/_llmApplicationFinalize.js +1 -1
- package/lib/internal/_llmApplicationFinalize.js.map +1 -1
- package/lib/internal/_llmApplicationFinalize.mjs +1 -0
- package/lib/internal/_llmApplicationFinalize.mjs.map +1 -1
- package/lib/internal/_parseLlmArguments.d.ts +2 -0
- package/lib/internal/_parseLlmArguments.js +7 -0
- package/lib/internal/_parseLlmArguments.js.map +1 -0
- package/lib/internal/_parseLlmArguments.mjs +6 -0
- package/lib/internal/_parseLlmArguments.mjs.map +1 -0
- package/lib/llm.d.ts +154 -1
- package/lib/llm.js +20 -0
- package/lib/llm.js.map +1 -1
- package/lib/llm.mjs +17 -1
- package/lib/llm.mjs.map +1 -1
- package/lib/re-exports.d.ts +1 -1
- package/lib/re-exports.js.map +1 -1
- package/package.json +5 -5
- package/src/TypeGuardError.ts +145 -145
- package/src/executable/TypiaGenerateWizard.ts +82 -82
- package/src/executable/TypiaPatchWizard.ts +45 -45
- package/src/executable/TypiaSetupWizard.ts +171 -171
- package/src/executable/setup/ArgumentParser.ts +42 -42
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/FileRetriever.ts +19 -19
- package/src/executable/setup/PackageManager.ts +87 -87
- package/src/executable/setup/PluginConfigurator.ts +74 -74
- package/src/executable/typia.ts +55 -55
- package/src/functional.ts +600 -600
- package/src/http.ts +843 -843
- package/src/index.ts +4 -4
- package/src/internal/_IProtobufWriter.ts +18 -18
- package/src/internal/_ProtobufReader.ts +187 -187
- package/src/internal/_ProtobufSizer.ts +137 -137
- package/src/internal/_ProtobufWriter.ts +135 -135
- package/src/internal/_accessExpressionAsString.ts +46 -46
- package/src/internal/_assertGuard.ts +13 -13
- package/src/internal/_coerceLlmArguments.ts +7 -0
- package/src/internal/_createStandardSchema.ts +133 -133
- package/src/internal/_functionalTypeGuardErrorFactory.ts +4 -4
- package/src/internal/_httpFormDataReadArray.ts +4 -4
- package/src/internal/_httpFormDataReadBigint.ts +18 -18
- package/src/internal/_httpFormDataReadBlob.ts +10 -10
- package/src/internal/_httpFormDataReadBoolean.ts +16 -16
- package/src/internal/_httpFormDataReadFile.ts +10 -10
- package/src/internal/_httpFormDataReadNumber.ts +15 -15
- package/src/internal/_httpFormDataReadString.ts +10 -10
- package/src/internal/_httpHeaderReadBigint.ts +10 -10
- package/src/internal/_httpHeaderReadBoolean.ts +8 -8
- package/src/internal/_httpHeaderReadNumber.ts +7 -7
- package/src/internal/_httpParameterReadBigint.ts +10 -10
- package/src/internal/_httpParameterReadBoolean.ts +8 -8
- package/src/internal/_httpParameterReadNumber.ts +7 -7
- package/src/internal/_httpParameterReadString.ts +2 -2
- package/src/internal/_httpQueryParseURLSearchParams.ts +12 -12
- package/src/internal/_httpQueryReadArray.ts +4 -4
- package/src/internal/_httpQueryReadBigint.ts +12 -12
- package/src/internal/_httpQueryReadBoolean.ts +14 -14
- package/src/internal/_httpQueryReadNumber.ts +9 -9
- package/src/internal/_httpQueryReadString.ts +4 -4
- package/src/internal/_isBetween.ts +2 -2
- package/src/internal/_isBigintString.ts +8 -8
- package/src/internal/_isFormatByte.ts +7 -7
- package/src/internal/_isFormatDate.ts +3 -3
- package/src/internal/_isFormatDateTime.ts +4 -4
- package/src/internal/_isFormatDuration.ts +4 -4
- package/src/internal/_isFormatEmail.ts +4 -4
- package/src/internal/_isFormatHostname.ts +4 -4
- package/src/internal/_isFormatIdnEmail.ts +4 -4
- package/src/internal/_isFormatIdnHostname.ts +4 -4
- package/src/internal/_isFormatIpv4.ts +4 -4
- package/src/internal/_isFormatIpv6.ts +4 -4
- package/src/internal/_isFormatIri.ts +3 -3
- package/src/internal/_isFormatIriReference.ts +4 -4
- package/src/internal/_isFormatJsonPointer.ts +3 -3
- package/src/internal/_isFormatPassword.ts +1 -1
- package/src/internal/_isFormatRegex.ts +8 -8
- package/src/internal/_isFormatRelativeJsonPointer.ts +4 -4
- package/src/internal/_isFormatTime.ts +4 -4
- package/src/internal/_isFormatUri.ts +6 -6
- package/src/internal/_isFormatUriReference.ts +5 -5
- package/src/internal/_isFormatUriTemplate.ts +4 -4
- package/src/internal/_isFormatUrl.ts +4 -4
- package/src/internal/_isFormatUuid.ts +3 -3
- package/src/internal/_isTypeFloat.ts +5 -5
- package/src/internal/_isTypeInt32.ts +5 -5
- package/src/internal/_isTypeInt64.ts +5 -5
- package/src/internal/_isTypeUint32.ts +5 -5
- package/src/internal/_isTypeUint64.ts +5 -5
- package/src/internal/_isUniqueItems.ts +159 -159
- package/src/internal/_jsonStringifyNumber.ts +12 -12
- package/src/internal/_jsonStringifyRest.ts +3 -3
- package/src/internal/_jsonStringifyString.ts +42 -42
- package/src/internal/_jsonStringifyTail.ts +2 -2
- package/src/internal/_llmApplicationFinalize.ts +24 -23
- package/src/internal/_miscCloneAny.ts +46 -46
- package/src/internal/_notationAny.ts +37 -37
- package/src/internal/_notationCamel.ts +13 -13
- package/src/internal/_notationPascal.ts +8 -8
- package/src/internal/_notationSnake.ts +43 -43
- package/src/internal/_parseLlmArguments.ts +7 -0
- package/src/internal/_randomArray.ts +21 -21
- package/src/internal/_randomBigint.ts +6 -6
- package/src/internal/_randomBoolean.ts +1 -1
- package/src/internal/_randomFormatByte.ts +3 -3
- package/src/internal/_randomFormatDate.ts +18 -18
- package/src/internal/_randomFormatDatetime.ts +16 -16
- package/src/internal/_randomFormatDuration.ts +27 -27
- package/src/internal/_randomFormatEmail.ts +11 -11
- package/src/internal/_randomFormatHostname.ts +6 -6
- package/src/internal/_randomFormatIdnEmail.ts +3 -3
- package/src/internal/_randomFormatIdnHostname.ts +3 -3
- package/src/internal/_randomFormatIpv4.ts +11 -11
- package/src/internal/_randomFormatIpv6.ts +11 -11
- package/src/internal/_randomFormatIri.ts +3 -3
- package/src/internal/_randomFormatIriReference.ts +3 -3
- package/src/internal/_randomFormatJsonPointer.ts +7 -7
- package/src/internal/_randomFormatPassword.ts +8 -8
- package/src/internal/_randomFormatRegex.ts +4 -4
- package/src/internal/_randomFormatRelativeJsonPointer.ts +8 -8
- package/src/internal/_randomFormatTime.ts +14 -14
- package/src/internal/_randomFormatUri.ts +3 -3
- package/src/internal/_randomFormatUriReference.ts +3 -3
- package/src/internal/_randomFormatUriTemplate.ts +3 -3
- package/src/internal/_randomFormatUrl.ts +11 -11
- package/src/internal/_randomFormatUuid.ts +6 -6
- package/src/internal/_randomInteger.ts +53 -53
- package/src/internal/_randomNumber.ts +80 -80
- package/src/internal/_randomPattern.ts +10 -10
- package/src/internal/_randomPick.ts +9 -9
- package/src/internal/_randomString.ts +24 -24
- package/src/internal/_throwTypeGuardError.ts +5 -5
- package/src/internal/_validateReport.ts +21 -21
- package/src/internal/private/__notationCapitalize.ts +2 -2
- package/src/internal/private/__notationUnsnake.ts +24 -24
- package/src/json.ts +553 -553
- package/src/llm.ts +408 -211
- package/src/misc.ts +448 -448
- package/src/module.ts +811 -811
- package/src/notations.ts +624 -624
- package/src/programmers/TypiaProgrammer.ts +8 -8
- package/src/protobuf.ts +499 -499
- package/src/re-exports.ts +33 -32
- package/src/reflect.ts +75 -75
- package/src/transform.ts +5 -5
- package/src/transformers/NoTransformConfigurationError.ts +16 -16
package/src/misc.ts
CHANGED
|
@@ -1,448 +1,448 @@
|
|
|
1
|
-
/* ===========================================================
|
|
2
|
-
MISCELLANEOUS
|
|
3
|
-
- LITERALS
|
|
4
|
-
- CLONE
|
|
5
|
-
- PRUNE
|
|
6
|
-
- FACTORY FUNCTIONS
|
|
7
|
-
==============================================================
|
|
8
|
-
LITERALS
|
|
9
|
-
----------------------------------------------------------- */
|
|
10
|
-
import { Atomic, IValidation, Resolved } from "@typia/interface";
|
|
11
|
-
|
|
12
|
-
import { TypeGuardError } from "./TypeGuardError";
|
|
13
|
-
import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Converts union literal type to array.
|
|
17
|
-
*
|
|
18
|
-
* @danger You must configure the generic argument `T`
|
|
19
|
-
*/
|
|
20
|
-
export function literals(): never;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Converts union literal type to array.
|
|
24
|
-
*
|
|
25
|
-
* Extracts all members of a union literal type `T` into an array at runtime.
|
|
26
|
-
*
|
|
27
|
-
* @template T Union literal type (e.g., `"A" | "B" | 1`)
|
|
28
|
-
* @returns Array containing all union members
|
|
29
|
-
*/
|
|
30
|
-
export function literals<T extends Atomic.Type | null>(): T[];
|
|
31
|
-
|
|
32
|
-
/** @internal */
|
|
33
|
-
export function literals(): never {
|
|
34
|
-
NoTransformConfigurationError("misc.literals");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* -----------------------------------------------------------
|
|
38
|
-
CLONE
|
|
39
|
-
----------------------------------------------------------- */
|
|
40
|
-
/**
|
|
41
|
-
* Deep clones value of type `T`.
|
|
42
|
-
*
|
|
43
|
-
* Creates a deep copy of the input value. Class instances with methods are
|
|
44
|
-
* cloned as plain objects (methods are not copied).
|
|
45
|
-
*
|
|
46
|
-
* Does not validate the input. For validation, use:
|
|
47
|
-
*
|
|
48
|
-
* - {@link assertClone} — Throws on type mismatch
|
|
49
|
-
* - {@link isClone} — Returns `null` on type mismatch
|
|
50
|
-
* - {@link validateClone} — Returns detailed validation errors
|
|
51
|
-
*
|
|
52
|
-
* @template T Type of input value
|
|
53
|
-
* @param input Value to clone
|
|
54
|
-
* @returns Deep cloned value
|
|
55
|
-
*/
|
|
56
|
-
export function clone<T>(input: T): Resolved<T>;
|
|
57
|
-
|
|
58
|
-
/** @internal */
|
|
59
|
-
export function clone(): never {
|
|
60
|
-
NoTransformConfigurationError("misc.clone");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Deep clones value with assertion.
|
|
65
|
-
*
|
|
66
|
-
* Creates a deep copy with {@link assert} validation. Throws
|
|
67
|
-
* {@link TypeGuardError} on type mismatch. Class instances with methods are
|
|
68
|
-
* cloned as plain objects.
|
|
69
|
-
*
|
|
70
|
-
* Related functions:
|
|
71
|
-
*
|
|
72
|
-
* - {@link clone} — No validation
|
|
73
|
-
* - {@link isClone} — Returns `null` instead of throwing
|
|
74
|
-
* - {@link validateClone} — Returns detailed validation errors
|
|
75
|
-
*
|
|
76
|
-
* @template T Type of input value
|
|
77
|
-
* @param input Value to clone
|
|
78
|
-
* @param errorFactory Custom error factory receiving
|
|
79
|
-
* {@link TypeGuardError.IProps}
|
|
80
|
-
* @returns Deep cloned value
|
|
81
|
-
* @throws {TypeGuardError} When input doesn't conform to type `T`
|
|
82
|
-
*/
|
|
83
|
-
export function assertClone<T>(
|
|
84
|
-
input: T,
|
|
85
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
86
|
-
): Resolved<T>;
|
|
87
|
-
|
|
88
|
-
/** @internal */
|
|
89
|
-
export function assertClone<T>(
|
|
90
|
-
input: unknown,
|
|
91
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
92
|
-
): Resolved<T>;
|
|
93
|
-
|
|
94
|
-
/** @internal */
|
|
95
|
-
export function assertClone(): never {
|
|
96
|
-
NoTransformConfigurationError("misc.assertClone");
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Deep clones value with type checking.
|
|
101
|
-
*
|
|
102
|
-
* Creates a deep copy with {@link is} validation. Returns `null` on type
|
|
103
|
-
* mismatch. Class instances with methods are cloned as plain objects.
|
|
104
|
-
*
|
|
105
|
-
* Related functions:
|
|
106
|
-
*
|
|
107
|
-
* - {@link clone} — No validation
|
|
108
|
-
* - {@link assertClone} — Throws instead of returning `null`
|
|
109
|
-
* - {@link validateClone} — Returns detailed validation errors
|
|
110
|
-
*
|
|
111
|
-
* @template T Type of input value
|
|
112
|
-
* @param input Value to clone
|
|
113
|
-
* @returns Deep cloned value, or `null` if invalid
|
|
114
|
-
*/
|
|
115
|
-
export function isClone<T>(input: T): Resolved<T> | null;
|
|
116
|
-
|
|
117
|
-
/** @internal */
|
|
118
|
-
export function isClone<T>(input: unknown): Resolved<T> | null;
|
|
119
|
-
|
|
120
|
-
/** @internal */
|
|
121
|
-
export function isClone(): never {
|
|
122
|
-
NoTransformConfigurationError("misc.isClone");
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Deep clones value with validation.
|
|
127
|
-
*
|
|
128
|
-
* Creates a deep copy with {@link validate} validation. Returns
|
|
129
|
-
* {@link IValidation.IFailure} with all errors on mismatch, or
|
|
130
|
-
* {@link IValidation.ISuccess} with cloned value. Class instances with methods
|
|
131
|
-
* are cloned as plain objects.
|
|
132
|
-
*
|
|
133
|
-
* Related functions:
|
|
134
|
-
*
|
|
135
|
-
* - {@link clone} — No validation
|
|
136
|
-
* - {@link assertClone} — Throws on first error
|
|
137
|
-
* - {@link isClone} — Returns `null` instead of error details
|
|
138
|
-
*
|
|
139
|
-
* @template T Type of input value
|
|
140
|
-
* @param input Value to clone
|
|
141
|
-
* @returns Validation result containing cloned value or errors
|
|
142
|
-
*/
|
|
143
|
-
export function validateClone<T>(input: T): IValidation<Resolved<T>>;
|
|
144
|
-
|
|
145
|
-
/** @internal */
|
|
146
|
-
export function validateClone<T>(input: unknown): IValidation<Resolved<T>>;
|
|
147
|
-
|
|
148
|
-
/** @internal */
|
|
149
|
-
export function validateClone(): never {
|
|
150
|
-
NoTransformConfigurationError("misc.validateClone");
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/* -----------------------------------------------------------
|
|
154
|
-
PRUNE
|
|
155
|
-
----------------------------------------------------------- */
|
|
156
|
-
/**
|
|
157
|
-
* Removes superfluous properties from object.
|
|
158
|
-
*
|
|
159
|
-
* Deletes all properties not defined in type `T`, including in nested objects.
|
|
160
|
-
* Mutates the input directly—removed properties cannot be recovered.
|
|
161
|
-
*
|
|
162
|
-
* Does not validate the input. For validation, use:
|
|
163
|
-
*
|
|
164
|
-
* - {@link assertPrune} — Throws on type mismatch
|
|
165
|
-
* - {@link isPrune} — Returns `false` on type mismatch
|
|
166
|
-
* - {@link validatePrune} — Returns detailed validation errors
|
|
167
|
-
*
|
|
168
|
-
* @template T Type of input value
|
|
169
|
-
* @param input Object to prune
|
|
170
|
-
*/
|
|
171
|
-
export function prune<T extends object>(input: T): void;
|
|
172
|
-
|
|
173
|
-
/** @internal */
|
|
174
|
-
export function prune(): never {
|
|
175
|
-
NoTransformConfigurationError("misc.prune");
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Removes superfluous properties with assertion.
|
|
180
|
-
*
|
|
181
|
-
* Combines {@link assert} with {@link prune}. Throws {@link TypeGuardError} on
|
|
182
|
-
* type mismatch. Mutates the input directly—removed properties cannot be
|
|
183
|
-
* recovered.
|
|
184
|
-
*
|
|
185
|
-
* Related functions:
|
|
186
|
-
*
|
|
187
|
-
* - {@link prune} — No validation
|
|
188
|
-
* - {@link isPrune} — Returns `false` instead of throwing
|
|
189
|
-
* - {@link validatePrune} — Returns detailed validation errors
|
|
190
|
-
*
|
|
191
|
-
* @template T Type of input value
|
|
192
|
-
* @param input Object to assert and prune
|
|
193
|
-
* @param errorFactory Custom error factory receiving
|
|
194
|
-
* {@link TypeGuardError.IProps}
|
|
195
|
-
* @returns The pruned input
|
|
196
|
-
* @throws {TypeGuardError} When input doesn't conform to type `T`
|
|
197
|
-
*/
|
|
198
|
-
export function assertPrune<T>(
|
|
199
|
-
input: T,
|
|
200
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
201
|
-
): T;
|
|
202
|
-
|
|
203
|
-
/** @internal */
|
|
204
|
-
export function assertPrune<T>(
|
|
205
|
-
input: unknown,
|
|
206
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
207
|
-
): T;
|
|
208
|
-
|
|
209
|
-
/** @internal */
|
|
210
|
-
export function assertPrune(): unknown {
|
|
211
|
-
NoTransformConfigurationError("misc.assertPrune");
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Removes superfluous properties with type checking.
|
|
216
|
-
*
|
|
217
|
-
* Combines {@link is} with {@link prune}. Returns `false` on type mismatch (no
|
|
218
|
-
* pruning occurs). Returns `true` after successful pruning. Mutates the input
|
|
219
|
-
* directly.
|
|
220
|
-
*
|
|
221
|
-
* Related functions:
|
|
222
|
-
*
|
|
223
|
-
* - {@link prune} — No validation
|
|
224
|
-
* - {@link assertPrune} — Throws instead of returning `false`
|
|
225
|
-
* - {@link validatePrune} — Returns detailed validation errors
|
|
226
|
-
*
|
|
227
|
-
* @template T Type of input value
|
|
228
|
-
* @param input Object to check and prune
|
|
229
|
-
* @returns `true` if valid and pruned, `false` if type mismatch
|
|
230
|
-
*/
|
|
231
|
-
export function isPrune<T>(input: T): input is T;
|
|
232
|
-
|
|
233
|
-
/** @internal */
|
|
234
|
-
export function isPrune<T>(input: unknown): input is T;
|
|
235
|
-
|
|
236
|
-
/** @internal */
|
|
237
|
-
export function isPrune(): never {
|
|
238
|
-
NoTransformConfigurationError("misc.isPrune");
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Removes superfluous properties with validation.
|
|
243
|
-
*
|
|
244
|
-
* Combines {@link validate} with {@link prune}. Returns
|
|
245
|
-
* {@link IValidation.IFailure} with all errors on mismatch (no pruning occurs),
|
|
246
|
-
* or {@link IValidation.ISuccess} after successful pruning. Mutates the input
|
|
247
|
-
* directly.
|
|
248
|
-
*
|
|
249
|
-
* Related functions:
|
|
250
|
-
*
|
|
251
|
-
* - {@link prune} — No validation
|
|
252
|
-
* - {@link assertPrune} — Throws on first error
|
|
253
|
-
* - {@link isPrune} — Returns `false` instead of error details
|
|
254
|
-
*
|
|
255
|
-
* @template T Type of input value
|
|
256
|
-
* @param input Object to validate and prune
|
|
257
|
-
* @returns Validation result
|
|
258
|
-
*/
|
|
259
|
-
export function validatePrune<T>(input: T): IValidation<T>;
|
|
260
|
-
|
|
261
|
-
/** @internal */
|
|
262
|
-
export function validatePrune<T>(input: unknown): IValidation<T>;
|
|
263
|
-
|
|
264
|
-
/** @internal */
|
|
265
|
-
export function validatePrune<T>(): IValidation<T> {
|
|
266
|
-
NoTransformConfigurationError("misc.validatePrune");
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/* -----------------------------------------------------------
|
|
270
|
-
FACTORY FUNCTIONS
|
|
271
|
-
----------------------------------------------------------- */
|
|
272
|
-
/**
|
|
273
|
-
* Creates reusable {@link clone} function.
|
|
274
|
-
*
|
|
275
|
-
* @danger You must configure the generic argument `T`
|
|
276
|
-
*/
|
|
277
|
-
export function createClone(): never;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Creates reusable {@link clone} function.
|
|
281
|
-
*
|
|
282
|
-
* @template T Type of input value
|
|
283
|
-
* @returns Reusable clone function
|
|
284
|
-
*/
|
|
285
|
-
export function createClone<T>(): (input: T) => Resolved<T>;
|
|
286
|
-
|
|
287
|
-
/** @internal */
|
|
288
|
-
export function createClone(): never {
|
|
289
|
-
NoTransformConfigurationError("misc.createClone");
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Creates reusable {@link assertClone} function.
|
|
294
|
-
*
|
|
295
|
-
* @danger You must configure the generic argument `T`
|
|
296
|
-
*/
|
|
297
|
-
export function createAssertClone(
|
|
298
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
299
|
-
): never;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Creates reusable {@link assertClone} function.
|
|
303
|
-
*
|
|
304
|
-
* @template T Type of input value
|
|
305
|
-
* @param errorFactory Custom error factory receiving
|
|
306
|
-
* {@link TypeGuardError.IProps}
|
|
307
|
-
* @returns Reusable clone function
|
|
308
|
-
*/
|
|
309
|
-
export function createAssertClone<T>(
|
|
310
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
311
|
-
): (input: unknown) => Resolved<T>;
|
|
312
|
-
|
|
313
|
-
/** @internal */
|
|
314
|
-
export function createAssertClone(): never {
|
|
315
|
-
NoTransformConfigurationError("misc.createAssertClone");
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Creates reusable {@link isClone} function.
|
|
320
|
-
*
|
|
321
|
-
* @danger You must configure the generic argument `T`
|
|
322
|
-
*/
|
|
323
|
-
export function createIsClone(): never;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Creates reusable {@link isClone} function.
|
|
327
|
-
*
|
|
328
|
-
* @template T Type of input value
|
|
329
|
-
* @returns Reusable clone function
|
|
330
|
-
*/
|
|
331
|
-
export function createIsClone<T>(): (input: unknown) => Resolved<T> | null;
|
|
332
|
-
|
|
333
|
-
/** @internal */
|
|
334
|
-
export function createIsClone(): never {
|
|
335
|
-
NoTransformConfigurationError("misc.createIsClone");
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Creates reusable {@link validateClone} function.
|
|
340
|
-
*
|
|
341
|
-
* @danger You must configure the generic argument `T`
|
|
342
|
-
*/
|
|
343
|
-
export function createValidateClone(): never;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Creates reusable {@link validateClone} function.
|
|
347
|
-
*
|
|
348
|
-
* @template T Type of input value
|
|
349
|
-
* @returns Reusable clone function
|
|
350
|
-
*/
|
|
351
|
-
export function createValidateClone<T>(): (
|
|
352
|
-
input: unknown,
|
|
353
|
-
) => IValidation<Resolved<T>>;
|
|
354
|
-
|
|
355
|
-
/** @internal */
|
|
356
|
-
export function createValidateClone(): never {
|
|
357
|
-
NoTransformConfigurationError("misc.createValidateClone");
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Creates reusable {@link prune} function.
|
|
362
|
-
*
|
|
363
|
-
* @danger You must configure the generic argument `T`
|
|
364
|
-
*/
|
|
365
|
-
export function createPrune(): never;
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Creates reusable {@link prune} function.
|
|
369
|
-
*
|
|
370
|
-
* @template T Type of input value
|
|
371
|
-
* @returns Reusable prune function
|
|
372
|
-
*/
|
|
373
|
-
export function createPrune<T extends object>(): (input: T) => void;
|
|
374
|
-
|
|
375
|
-
/** @internal */
|
|
376
|
-
export function createPrune(): never {
|
|
377
|
-
NoTransformConfigurationError("misc.createPrune");
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Creates reusable {@link assertPrune} function.
|
|
382
|
-
*
|
|
383
|
-
* @danger You must configure the generic argument `T`
|
|
384
|
-
*/
|
|
385
|
-
export function createAssertPrune(
|
|
386
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
387
|
-
): never;
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Creates reusable {@link assertPrune} function.
|
|
391
|
-
*
|
|
392
|
-
* @template T Type of input value
|
|
393
|
-
* @param errorFactory Custom error factory receiving
|
|
394
|
-
* {@link TypeGuardError.IProps}
|
|
395
|
-
* @returns Reusable prune function
|
|
396
|
-
*/
|
|
397
|
-
export function createAssertPrune<T extends object>(
|
|
398
|
-
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
399
|
-
): (input: unknown) => T;
|
|
400
|
-
|
|
401
|
-
/** @internal */
|
|
402
|
-
export function createAssertPrune(): never {
|
|
403
|
-
NoTransformConfigurationError("misc.createAssertPrune");
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Creates reusable {@link isPrune} function.
|
|
408
|
-
*
|
|
409
|
-
* @danger You must configure the generic argument `T`
|
|
410
|
-
*/
|
|
411
|
-
export function createIsPrune(): never;
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Creates reusable {@link isPrune} function.
|
|
415
|
-
*
|
|
416
|
-
* @template T Type of input value
|
|
417
|
-
* @returns Reusable prune function
|
|
418
|
-
*/
|
|
419
|
-
export function createIsPrune<T extends object>(): (
|
|
420
|
-
input: unknown,
|
|
421
|
-
) => input is T;
|
|
422
|
-
|
|
423
|
-
/** @internal */
|
|
424
|
-
export function createIsPrune(): never {
|
|
425
|
-
NoTransformConfigurationError("misc.createIsPrune");
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Creates reusable {@link validatePrune} function.
|
|
430
|
-
*
|
|
431
|
-
* @danger You must configure the generic argument `T`
|
|
432
|
-
*/
|
|
433
|
-
export function createValidatePrune(): never;
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Creates reusable {@link validatePrune} function.
|
|
437
|
-
*
|
|
438
|
-
* @template T Type of input value
|
|
439
|
-
* @returns Reusable prune function
|
|
440
|
-
*/
|
|
441
|
-
export function createValidatePrune<T extends object>(): (
|
|
442
|
-
input: unknown,
|
|
443
|
-
) => IValidation<T>;
|
|
444
|
-
|
|
445
|
-
/** @internal */
|
|
446
|
-
export function createValidatePrune(): never {
|
|
447
|
-
NoTransformConfigurationError("misc.createValidatePrune");
|
|
448
|
-
}
|
|
1
|
+
/* ===========================================================
|
|
2
|
+
MISCELLANEOUS
|
|
3
|
+
- LITERALS
|
|
4
|
+
- CLONE
|
|
5
|
+
- PRUNE
|
|
6
|
+
- FACTORY FUNCTIONS
|
|
7
|
+
==============================================================
|
|
8
|
+
LITERALS
|
|
9
|
+
----------------------------------------------------------- */
|
|
10
|
+
import { Atomic, IValidation, Resolved } from "@typia/interface";
|
|
11
|
+
|
|
12
|
+
import { TypeGuardError } from "./TypeGuardError";
|
|
13
|
+
import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Converts union literal type to array.
|
|
17
|
+
*
|
|
18
|
+
* @danger You must configure the generic argument `T`
|
|
19
|
+
*/
|
|
20
|
+
export function literals(): never;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Converts union literal type to array.
|
|
24
|
+
*
|
|
25
|
+
* Extracts all members of a union literal type `T` into an array at runtime.
|
|
26
|
+
*
|
|
27
|
+
* @template T Union literal type (e.g., `"A" | "B" | 1`)
|
|
28
|
+
* @returns Array containing all union members
|
|
29
|
+
*/
|
|
30
|
+
export function literals<T extends Atomic.Type | null>(): T[];
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export function literals(): never {
|
|
34
|
+
NoTransformConfigurationError("misc.literals");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* -----------------------------------------------------------
|
|
38
|
+
CLONE
|
|
39
|
+
----------------------------------------------------------- */
|
|
40
|
+
/**
|
|
41
|
+
* Deep clones value of type `T`.
|
|
42
|
+
*
|
|
43
|
+
* Creates a deep copy of the input value. Class instances with methods are
|
|
44
|
+
* cloned as plain objects (methods are not copied).
|
|
45
|
+
*
|
|
46
|
+
* Does not validate the input. For validation, use:
|
|
47
|
+
*
|
|
48
|
+
* - {@link assertClone} — Throws on type mismatch
|
|
49
|
+
* - {@link isClone} — Returns `null` on type mismatch
|
|
50
|
+
* - {@link validateClone} — Returns detailed validation errors
|
|
51
|
+
*
|
|
52
|
+
* @template T Type of input value
|
|
53
|
+
* @param input Value to clone
|
|
54
|
+
* @returns Deep cloned value
|
|
55
|
+
*/
|
|
56
|
+
export function clone<T>(input: T): Resolved<T>;
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export function clone(): never {
|
|
60
|
+
NoTransformConfigurationError("misc.clone");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Deep clones value with assertion.
|
|
65
|
+
*
|
|
66
|
+
* Creates a deep copy with {@link assert} validation. Throws
|
|
67
|
+
* {@link TypeGuardError} on type mismatch. Class instances with methods are
|
|
68
|
+
* cloned as plain objects.
|
|
69
|
+
*
|
|
70
|
+
* Related functions:
|
|
71
|
+
*
|
|
72
|
+
* - {@link clone} — No validation
|
|
73
|
+
* - {@link isClone} — Returns `null` instead of throwing
|
|
74
|
+
* - {@link validateClone} — Returns detailed validation errors
|
|
75
|
+
*
|
|
76
|
+
* @template T Type of input value
|
|
77
|
+
* @param input Value to clone
|
|
78
|
+
* @param errorFactory Custom error factory receiving
|
|
79
|
+
* {@link TypeGuardError.IProps}
|
|
80
|
+
* @returns Deep cloned value
|
|
81
|
+
* @throws {TypeGuardError} When input doesn't conform to type `T`
|
|
82
|
+
*/
|
|
83
|
+
export function assertClone<T>(
|
|
84
|
+
input: T,
|
|
85
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
86
|
+
): Resolved<T>;
|
|
87
|
+
|
|
88
|
+
/** @internal */
|
|
89
|
+
export function assertClone<T>(
|
|
90
|
+
input: unknown,
|
|
91
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
92
|
+
): Resolved<T>;
|
|
93
|
+
|
|
94
|
+
/** @internal */
|
|
95
|
+
export function assertClone(): never {
|
|
96
|
+
NoTransformConfigurationError("misc.assertClone");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Deep clones value with type checking.
|
|
101
|
+
*
|
|
102
|
+
* Creates a deep copy with {@link is} validation. Returns `null` on type
|
|
103
|
+
* mismatch. Class instances with methods are cloned as plain objects.
|
|
104
|
+
*
|
|
105
|
+
* Related functions:
|
|
106
|
+
*
|
|
107
|
+
* - {@link clone} — No validation
|
|
108
|
+
* - {@link assertClone} — Throws instead of returning `null`
|
|
109
|
+
* - {@link validateClone} — Returns detailed validation errors
|
|
110
|
+
*
|
|
111
|
+
* @template T Type of input value
|
|
112
|
+
* @param input Value to clone
|
|
113
|
+
* @returns Deep cloned value, or `null` if invalid
|
|
114
|
+
*/
|
|
115
|
+
export function isClone<T>(input: T): Resolved<T> | null;
|
|
116
|
+
|
|
117
|
+
/** @internal */
|
|
118
|
+
export function isClone<T>(input: unknown): Resolved<T> | null;
|
|
119
|
+
|
|
120
|
+
/** @internal */
|
|
121
|
+
export function isClone(): never {
|
|
122
|
+
NoTransformConfigurationError("misc.isClone");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Deep clones value with validation.
|
|
127
|
+
*
|
|
128
|
+
* Creates a deep copy with {@link validate} validation. Returns
|
|
129
|
+
* {@link IValidation.IFailure} with all errors on mismatch, or
|
|
130
|
+
* {@link IValidation.ISuccess} with cloned value. Class instances with methods
|
|
131
|
+
* are cloned as plain objects.
|
|
132
|
+
*
|
|
133
|
+
* Related functions:
|
|
134
|
+
*
|
|
135
|
+
* - {@link clone} — No validation
|
|
136
|
+
* - {@link assertClone} — Throws on first error
|
|
137
|
+
* - {@link isClone} — Returns `null` instead of error details
|
|
138
|
+
*
|
|
139
|
+
* @template T Type of input value
|
|
140
|
+
* @param input Value to clone
|
|
141
|
+
* @returns Validation result containing cloned value or errors
|
|
142
|
+
*/
|
|
143
|
+
export function validateClone<T>(input: T): IValidation<Resolved<T>>;
|
|
144
|
+
|
|
145
|
+
/** @internal */
|
|
146
|
+
export function validateClone<T>(input: unknown): IValidation<Resolved<T>>;
|
|
147
|
+
|
|
148
|
+
/** @internal */
|
|
149
|
+
export function validateClone(): never {
|
|
150
|
+
NoTransformConfigurationError("misc.validateClone");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* -----------------------------------------------------------
|
|
154
|
+
PRUNE
|
|
155
|
+
----------------------------------------------------------- */
|
|
156
|
+
/**
|
|
157
|
+
* Removes superfluous properties from object.
|
|
158
|
+
*
|
|
159
|
+
* Deletes all properties not defined in type `T`, including in nested objects.
|
|
160
|
+
* Mutates the input directly—removed properties cannot be recovered.
|
|
161
|
+
*
|
|
162
|
+
* Does not validate the input. For validation, use:
|
|
163
|
+
*
|
|
164
|
+
* - {@link assertPrune} — Throws on type mismatch
|
|
165
|
+
* - {@link isPrune} — Returns `false` on type mismatch
|
|
166
|
+
* - {@link validatePrune} — Returns detailed validation errors
|
|
167
|
+
*
|
|
168
|
+
* @template T Type of input value
|
|
169
|
+
* @param input Object to prune
|
|
170
|
+
*/
|
|
171
|
+
export function prune<T extends object>(input: T): void;
|
|
172
|
+
|
|
173
|
+
/** @internal */
|
|
174
|
+
export function prune(): never {
|
|
175
|
+
NoTransformConfigurationError("misc.prune");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Removes superfluous properties with assertion.
|
|
180
|
+
*
|
|
181
|
+
* Combines {@link assert} with {@link prune}. Throws {@link TypeGuardError} on
|
|
182
|
+
* type mismatch. Mutates the input directly—removed properties cannot be
|
|
183
|
+
* recovered.
|
|
184
|
+
*
|
|
185
|
+
* Related functions:
|
|
186
|
+
*
|
|
187
|
+
* - {@link prune} — No validation
|
|
188
|
+
* - {@link isPrune} — Returns `false` instead of throwing
|
|
189
|
+
* - {@link validatePrune} — Returns detailed validation errors
|
|
190
|
+
*
|
|
191
|
+
* @template T Type of input value
|
|
192
|
+
* @param input Object to assert and prune
|
|
193
|
+
* @param errorFactory Custom error factory receiving
|
|
194
|
+
* {@link TypeGuardError.IProps}
|
|
195
|
+
* @returns The pruned input
|
|
196
|
+
* @throws {TypeGuardError} When input doesn't conform to type `T`
|
|
197
|
+
*/
|
|
198
|
+
export function assertPrune<T>(
|
|
199
|
+
input: T,
|
|
200
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
201
|
+
): T;
|
|
202
|
+
|
|
203
|
+
/** @internal */
|
|
204
|
+
export function assertPrune<T>(
|
|
205
|
+
input: unknown,
|
|
206
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
207
|
+
): T;
|
|
208
|
+
|
|
209
|
+
/** @internal */
|
|
210
|
+
export function assertPrune(): unknown {
|
|
211
|
+
NoTransformConfigurationError("misc.assertPrune");
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Removes superfluous properties with type checking.
|
|
216
|
+
*
|
|
217
|
+
* Combines {@link is} with {@link prune}. Returns `false` on type mismatch (no
|
|
218
|
+
* pruning occurs). Returns `true` after successful pruning. Mutates the input
|
|
219
|
+
* directly.
|
|
220
|
+
*
|
|
221
|
+
* Related functions:
|
|
222
|
+
*
|
|
223
|
+
* - {@link prune} — No validation
|
|
224
|
+
* - {@link assertPrune} — Throws instead of returning `false`
|
|
225
|
+
* - {@link validatePrune} — Returns detailed validation errors
|
|
226
|
+
*
|
|
227
|
+
* @template T Type of input value
|
|
228
|
+
* @param input Object to check and prune
|
|
229
|
+
* @returns `true` if valid and pruned, `false` if type mismatch
|
|
230
|
+
*/
|
|
231
|
+
export function isPrune<T>(input: T): input is T;
|
|
232
|
+
|
|
233
|
+
/** @internal */
|
|
234
|
+
export function isPrune<T>(input: unknown): input is T;
|
|
235
|
+
|
|
236
|
+
/** @internal */
|
|
237
|
+
export function isPrune(): never {
|
|
238
|
+
NoTransformConfigurationError("misc.isPrune");
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Removes superfluous properties with validation.
|
|
243
|
+
*
|
|
244
|
+
* Combines {@link validate} with {@link prune}. Returns
|
|
245
|
+
* {@link IValidation.IFailure} with all errors on mismatch (no pruning occurs),
|
|
246
|
+
* or {@link IValidation.ISuccess} after successful pruning. Mutates the input
|
|
247
|
+
* directly.
|
|
248
|
+
*
|
|
249
|
+
* Related functions:
|
|
250
|
+
*
|
|
251
|
+
* - {@link prune} — No validation
|
|
252
|
+
* - {@link assertPrune} — Throws on first error
|
|
253
|
+
* - {@link isPrune} — Returns `false` instead of error details
|
|
254
|
+
*
|
|
255
|
+
* @template T Type of input value
|
|
256
|
+
* @param input Object to validate and prune
|
|
257
|
+
* @returns Validation result
|
|
258
|
+
*/
|
|
259
|
+
export function validatePrune<T>(input: T): IValidation<T>;
|
|
260
|
+
|
|
261
|
+
/** @internal */
|
|
262
|
+
export function validatePrune<T>(input: unknown): IValidation<T>;
|
|
263
|
+
|
|
264
|
+
/** @internal */
|
|
265
|
+
export function validatePrune<T>(): IValidation<T> {
|
|
266
|
+
NoTransformConfigurationError("misc.validatePrune");
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* -----------------------------------------------------------
|
|
270
|
+
FACTORY FUNCTIONS
|
|
271
|
+
----------------------------------------------------------- */
|
|
272
|
+
/**
|
|
273
|
+
* Creates reusable {@link clone} function.
|
|
274
|
+
*
|
|
275
|
+
* @danger You must configure the generic argument `T`
|
|
276
|
+
*/
|
|
277
|
+
export function createClone(): never;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Creates reusable {@link clone} function.
|
|
281
|
+
*
|
|
282
|
+
* @template T Type of input value
|
|
283
|
+
* @returns Reusable clone function
|
|
284
|
+
*/
|
|
285
|
+
export function createClone<T>(): (input: T) => Resolved<T>;
|
|
286
|
+
|
|
287
|
+
/** @internal */
|
|
288
|
+
export function createClone(): never {
|
|
289
|
+
NoTransformConfigurationError("misc.createClone");
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Creates reusable {@link assertClone} function.
|
|
294
|
+
*
|
|
295
|
+
* @danger You must configure the generic argument `T`
|
|
296
|
+
*/
|
|
297
|
+
export function createAssertClone(
|
|
298
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
299
|
+
): never;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Creates reusable {@link assertClone} function.
|
|
303
|
+
*
|
|
304
|
+
* @template T Type of input value
|
|
305
|
+
* @param errorFactory Custom error factory receiving
|
|
306
|
+
* {@link TypeGuardError.IProps}
|
|
307
|
+
* @returns Reusable clone function
|
|
308
|
+
*/
|
|
309
|
+
export function createAssertClone<T>(
|
|
310
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
311
|
+
): (input: unknown) => Resolved<T>;
|
|
312
|
+
|
|
313
|
+
/** @internal */
|
|
314
|
+
export function createAssertClone(): never {
|
|
315
|
+
NoTransformConfigurationError("misc.createAssertClone");
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Creates reusable {@link isClone} function.
|
|
320
|
+
*
|
|
321
|
+
* @danger You must configure the generic argument `T`
|
|
322
|
+
*/
|
|
323
|
+
export function createIsClone(): never;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Creates reusable {@link isClone} function.
|
|
327
|
+
*
|
|
328
|
+
* @template T Type of input value
|
|
329
|
+
* @returns Reusable clone function
|
|
330
|
+
*/
|
|
331
|
+
export function createIsClone<T>(): (input: unknown) => Resolved<T> | null;
|
|
332
|
+
|
|
333
|
+
/** @internal */
|
|
334
|
+
export function createIsClone(): never {
|
|
335
|
+
NoTransformConfigurationError("misc.createIsClone");
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Creates reusable {@link validateClone} function.
|
|
340
|
+
*
|
|
341
|
+
* @danger You must configure the generic argument `T`
|
|
342
|
+
*/
|
|
343
|
+
export function createValidateClone(): never;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Creates reusable {@link validateClone} function.
|
|
347
|
+
*
|
|
348
|
+
* @template T Type of input value
|
|
349
|
+
* @returns Reusable clone function
|
|
350
|
+
*/
|
|
351
|
+
export function createValidateClone<T>(): (
|
|
352
|
+
input: unknown,
|
|
353
|
+
) => IValidation<Resolved<T>>;
|
|
354
|
+
|
|
355
|
+
/** @internal */
|
|
356
|
+
export function createValidateClone(): never {
|
|
357
|
+
NoTransformConfigurationError("misc.createValidateClone");
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Creates reusable {@link prune} function.
|
|
362
|
+
*
|
|
363
|
+
* @danger You must configure the generic argument `T`
|
|
364
|
+
*/
|
|
365
|
+
export function createPrune(): never;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Creates reusable {@link prune} function.
|
|
369
|
+
*
|
|
370
|
+
* @template T Type of input value
|
|
371
|
+
* @returns Reusable prune function
|
|
372
|
+
*/
|
|
373
|
+
export function createPrune<T extends object>(): (input: T) => void;
|
|
374
|
+
|
|
375
|
+
/** @internal */
|
|
376
|
+
export function createPrune(): never {
|
|
377
|
+
NoTransformConfigurationError("misc.createPrune");
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Creates reusable {@link assertPrune} function.
|
|
382
|
+
*
|
|
383
|
+
* @danger You must configure the generic argument `T`
|
|
384
|
+
*/
|
|
385
|
+
export function createAssertPrune(
|
|
386
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
387
|
+
): never;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Creates reusable {@link assertPrune} function.
|
|
391
|
+
*
|
|
392
|
+
* @template T Type of input value
|
|
393
|
+
* @param errorFactory Custom error factory receiving
|
|
394
|
+
* {@link TypeGuardError.IProps}
|
|
395
|
+
* @returns Reusable prune function
|
|
396
|
+
*/
|
|
397
|
+
export function createAssertPrune<T extends object>(
|
|
398
|
+
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
|
|
399
|
+
): (input: unknown) => T;
|
|
400
|
+
|
|
401
|
+
/** @internal */
|
|
402
|
+
export function createAssertPrune(): never {
|
|
403
|
+
NoTransformConfigurationError("misc.createAssertPrune");
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Creates reusable {@link isPrune} function.
|
|
408
|
+
*
|
|
409
|
+
* @danger You must configure the generic argument `T`
|
|
410
|
+
*/
|
|
411
|
+
export function createIsPrune(): never;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Creates reusable {@link isPrune} function.
|
|
415
|
+
*
|
|
416
|
+
* @template T Type of input value
|
|
417
|
+
* @returns Reusable prune function
|
|
418
|
+
*/
|
|
419
|
+
export function createIsPrune<T extends object>(): (
|
|
420
|
+
input: unknown,
|
|
421
|
+
) => input is T;
|
|
422
|
+
|
|
423
|
+
/** @internal */
|
|
424
|
+
export function createIsPrune(): never {
|
|
425
|
+
NoTransformConfigurationError("misc.createIsPrune");
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Creates reusable {@link validatePrune} function.
|
|
430
|
+
*
|
|
431
|
+
* @danger You must configure the generic argument `T`
|
|
432
|
+
*/
|
|
433
|
+
export function createValidatePrune(): never;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Creates reusable {@link validatePrune} function.
|
|
437
|
+
*
|
|
438
|
+
* @template T Type of input value
|
|
439
|
+
* @returns Reusable prune function
|
|
440
|
+
*/
|
|
441
|
+
export function createValidatePrune<T extends object>(): (
|
|
442
|
+
input: unknown,
|
|
443
|
+
) => IValidation<T>;
|
|
444
|
+
|
|
445
|
+
/** @internal */
|
|
446
|
+
export function createValidatePrune(): never {
|
|
447
|
+
NoTransformConfigurationError("misc.createValidatePrune");
|
|
448
|
+
}
|