typia 3.7.1 → 3.7.2

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 (53) hide show
  1. package/README.md +3 -1
  2. package/lib/module.d.ts +33 -0
  3. package/lib/module.js +5 -1
  4. package/lib/module.js.map +1 -1
  5. package/lib/programmers/LiteralsProgrammer.d.ts +5 -0
  6. package/lib/programmers/LiteralsProgrammer.js +75 -0
  7. package/lib/programmers/LiteralsProgrammer.js.map +1 -0
  8. package/lib/transformers/CallExpressionTransformer.js +2 -0
  9. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  10. package/lib/transformers/ImportTransformer.js +8 -1
  11. package/lib/transformers/ImportTransformer.js.map +1 -1
  12. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js +6 -3
  13. package/lib/transformers/features/miscellaneous/ApplicationTransformer.js.map +1 -1
  14. package/lib/transformers/features/miscellaneous/CreateRandomTransformer.js +4 -2
  15. package/lib/transformers/features/miscellaneous/CreateRandomTransformer.js.map +1 -1
  16. package/lib/transformers/features/miscellaneous/LiteralsTransformer.d.ts +5 -0
  17. package/lib/transformers/features/miscellaneous/LiteralsTransformer.js +21 -0
  18. package/lib/transformers/features/miscellaneous/LiteralsTransformer.js.map +1 -0
  19. package/lib/transformers/features/miscellaneous/MetadataTransformer.js +4 -2
  20. package/lib/transformers/features/miscellaneous/MetadataTransformer.js.map +1 -1
  21. package/lib/transformers/features/miscellaneous/RandomTransformer.js +4 -2
  22. package/lib/transformers/features/miscellaneous/RandomTransformer.js.map +1 -1
  23. package/package.json +2 -2
  24. package/src/IRandomGenerator.ts +33 -33
  25. package/src/factories/IdentifierFactory.ts +81 -81
  26. package/src/factories/MetadataTagFactory.ts +302 -302
  27. package/src/metadata/ICommentTag.ts +4 -4
  28. package/src/module.ts +43 -0
  29. package/src/programmers/LiteralsProgrammer.ts +65 -0
  30. package/src/programmers/RandomProgrammer.ts +413 -413
  31. package/src/programmers/helpers/RandomJoiner.ts +161 -161
  32. package/src/programmers/helpers/RandomRanger.ts +216 -216
  33. package/src/programmers/internal/application_native.ts +32 -32
  34. package/src/programmers/internal/check_array.ts +30 -30
  35. package/src/programmers/internal/check_array_length.ts +35 -35
  36. package/src/programmers/internal/check_custom.ts +33 -33
  37. package/src/programmers/internal/check_number.ts +177 -177
  38. package/src/programmers/internal/check_object.ts +55 -55
  39. package/src/programmers/internal/check_union_array_like.ts +272 -272
  40. package/src/programmers/internal/feature_object_entries.ts +63 -63
  41. package/src/programmers/internal/get_comment_tags.ts +23 -23
  42. package/src/programmers/internal/metadata_to_pattern.ts +34 -34
  43. package/src/programmers/internal/random_custom.ts +30 -30
  44. package/src/programmers/internal/stringify_dynamic_properties.ts +168 -168
  45. package/src/programmers/internal/stringify_regular_properties.ts +84 -84
  46. package/src/transformers/CallExpressionTransformer.ts +174 -172
  47. package/src/transformers/ImportTransformer.ts +9 -3
  48. package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +8 -9
  49. package/src/transformers/features/miscellaneous/CreateRandomTransformer.ts +41 -43
  50. package/src/transformers/features/miscellaneous/LiteralsTransformer.ts +30 -0
  51. package/src/transformers/features/miscellaneous/MetadataTransformer.ts +5 -6
  52. package/src/transformers/features/miscellaneous/RandomTransformer.ts +6 -8
  53. package/src/typings/Customizable.ts +5 -5
@@ -1,302 +1,302 @@
1
- import ts from "typescript";
2
-
3
- import { IMetadataTag } from "../metadata/IMetadataTag";
4
- import { Metadata } from "../metadata/Metadata";
5
-
6
- export namespace MetadataTagFactory {
7
- export function generate(
8
- identifier: () => string,
9
- metadata: Metadata,
10
- tagList: ts.JSDocTagInfo[],
11
- ): IMetadataTag[] {
12
- const output: IMetadataTag[] = [];
13
- for (const tag of tagList) {
14
- const elem: IMetadataTag | null = parse(
15
- identifier,
16
- metadata,
17
- tag,
18
- output,
19
- );
20
- if (elem !== null) output.push(elem);
21
- }
22
- return output;
23
- }
24
-
25
- function parse(
26
- identifier: () => string,
27
- metadata: Metadata,
28
- tag: ts.JSDocTagInfo,
29
- output: IMetadataTag[],
30
- ): IMetadataTag | null {
31
- const closure = _PARSER[tag.name];
32
- if (closure === undefined) return null;
33
-
34
- const text = (tag.text || [])[0]?.text;
35
- if (text === undefined)
36
- throw new Error(`${LABEL}: no tag value on ${identifier()}`);
37
-
38
- return closure(identifier, metadata, text, output);
39
- }
40
-
41
- /**
42
- * @internal
43
- */
44
- export const _PARSER: Record<
45
- string,
46
- (
47
- identifier: () => string,
48
- metadata: Metadata,
49
- text: string,
50
- output: IMetadataTag[],
51
- ) => IMetadataTag | null
52
- > = {
53
- /* -----------------------------------------------------------
54
- ARRAY
55
- ----------------------------------------------------------- */
56
- items: (identifier, metadata, text, output) => {
57
- validate(identifier, metadata, output, "items", "array", [
58
- "minItems",
59
- ]);
60
- return {
61
- kind: "items",
62
- value: parse_number(identifier, text),
63
- };
64
- },
65
- minItems: (identifier, metadata, text, output) => {
66
- validate(identifier, metadata, output, "minItems", "array", [
67
- "items",
68
- ]);
69
- return {
70
- kind: "minItems",
71
- value: parse_number(identifier, text),
72
- };
73
- },
74
- maxItems: (identifier, metadata, text, output) => {
75
- validate(identifier, metadata, output, "maxItems", "array", [
76
- "items",
77
- ]);
78
- return {
79
- kind: "maxItems",
80
- value: parse_number(identifier, text),
81
- };
82
- },
83
-
84
- /* -----------------------------------------------------------
85
- NUMBER
86
- ----------------------------------------------------------- */
87
- type: (identifier, metadata, text, output) => {
88
- validate(identifier, metadata, output, "type", "number", []);
89
- if (text !== "int" && text !== "uint")
90
- throw new Error(
91
- `${LABEL}: invalid type tag on "${identifier()}".`,
92
- );
93
- return { kind: "type", value: text };
94
- },
95
- minimum: (identifier, metadata, text, output) => {
96
- validate(identifier, metadata, output, "minimum", "number", [
97
- "exclusiveMinimum",
98
- ]);
99
- return {
100
- kind: "minimum",
101
- value: parse_number(identifier, text),
102
- };
103
- },
104
- maximum: (identifier, metadata, text, output) => {
105
- validate(identifier, metadata, output, "maximum", "number", [
106
- "exclusiveMaximum",
107
- ]);
108
- return {
109
- kind: "maximum",
110
- value: parse_number(identifier, text),
111
- };
112
- },
113
- exclusiveMinimum: (identifier, metadata, text, output) => {
114
- validate(
115
- identifier,
116
- metadata,
117
- output,
118
- "exclusiveMinimum",
119
- "number",
120
- ["minimum"],
121
- );
122
- return {
123
- kind: "exclusiveMinimum",
124
- value: parse_number(identifier, text),
125
- };
126
- },
127
- exclusiveMaximum: (identifier, metadata, text, output) => {
128
- validate(
129
- identifier,
130
- metadata,
131
- output,
132
- "exclusiveMaximum",
133
- "number",
134
- ["maximum"],
135
- );
136
- return {
137
- kind: "exclusiveMaximum",
138
- value: parse_number(identifier, text),
139
- };
140
- },
141
- multipleOf: (identifier, metadata, text, output) => {
142
- validate(identifier, metadata, output, "multipleOf", "number", [
143
- "step",
144
- ]);
145
- return {
146
- kind: "multipleOf",
147
- value: parse_number(identifier, text),
148
- };
149
- },
150
- step: (identifier, metadata, text, output) => {
151
- validate(identifier, metadata, output, "step", "number", [
152
- "multipleOf",
153
- ]);
154
-
155
- const minimum: boolean = output.some(
156
- (tag) =>
157
- tag.kind === "minimum" || tag.kind === "exclusiveMinimum",
158
- );
159
- if (minimum === undefined)
160
- throw new Error(
161
- `${LABEL}: step requires minimum or exclusiveMinimum tag on "${identifier()}".`,
162
- );
163
-
164
- return {
165
- kind: "step",
166
- value: parse_number(identifier, text),
167
- };
168
- },
169
-
170
- /* -----------------------------------------------------------
171
- STRING
172
- ----------------------------------------------------------- */
173
- format: (identifier, metadata, str, output) => {
174
- validate(identifier, metadata, output, "format", "string", [
175
- "pattern",
176
- ]);
177
-
178
- // Ignore arbitrary @format values in the internal metadata,
179
- // these are currently only supported on the typia.application() API.
180
- const value: IMetadataTag.IFormat["value"] | undefined =
181
- FORMATS.get(str);
182
- if (value === undefined) return null;
183
- return {
184
- kind: "format",
185
- value,
186
- };
187
- },
188
- pattern: (identifier, metadata, value, output) => {
189
- validate(identifier, metadata, output, "pattern", "string", [
190
- "format",
191
- ]);
192
- return {
193
- kind: "pattern",
194
- value,
195
- };
196
- },
197
- length: (identifier, metadata, text, output) => {
198
- validate(identifier, metadata, output, "length", "string", [
199
- "minLength",
200
- "maxLength",
201
- ]);
202
- return {
203
- kind: "length",
204
- value: parse_number(identifier, text),
205
- };
206
- },
207
- minLength: (identifier, metadata, text, output) => {
208
- validate(identifier, metadata, output, "minLength", "string", [
209
- "length",
210
- ]);
211
- return {
212
- kind: "minLength",
213
- value: parse_number(identifier, text),
214
- };
215
- },
216
- maxLength: (identifier, metadata, text, output) => {
217
- validate(identifier, metadata, output, "maxLength", "string", [
218
- "length",
219
- ]);
220
- return {
221
- kind: "maxLength",
222
- value: parse_number(identifier, text),
223
- };
224
- },
225
- };
226
- }
227
-
228
- function parse_number(identifier: () => string, str: string): number {
229
- const value: number = Number(str);
230
- if (isNaN(value) === true)
231
- throw new Error(`${LABEL}: invalid number on "${identifier()}".`);
232
- return value;
233
- }
234
-
235
- const LABEL = "Error on typia.MetadataTagFactory.generate()";
236
- const FORMATS: Map<string, IMetadataTag.IFormat["value"]> = new Map([
237
- ["uuid", "uuid"],
238
- ["email", "email"],
239
- ["url", "url"],
240
- ["ipv4", "ipv4"],
241
- ["ipv6", "ipv6"],
242
- ["date", "date"],
243
- ["datetime", "datetime"],
244
- ["date-time", "datetime"],
245
- ["dateTime", "datetime"],
246
- ]);
247
-
248
- const WRONG_TYPE = (
249
- tag: string,
250
- type: "string" | "number" | "array",
251
- identifier: () => string,
252
- ) => `${LABEL}: ${tag} requires ${type} type, but no "${identifier()}".`;
253
-
254
- function validate(
255
- identifier: () => string,
256
- metadata: Metadata,
257
- output: IMetadataTag[],
258
- kind: IMetadataTag["kind"],
259
- type: "array" | "string" | "number",
260
- neighbors: IMetadataTag["kind"][],
261
- ): void {
262
- // TYPE CHECKING
263
- if (type === "array") {
264
- if (has_array(metadata) === false)
265
- throw new Error(WRONG_TYPE(kind, "array", identifier));
266
- } else if (has_atomic(metadata, type) === false)
267
- throw new Error(WRONG_TYPE(kind, type, identifier));
268
-
269
- // DUPLICATED TAG
270
- if (output.some((tag) => tag.kind === kind))
271
- throw new Error(
272
- `${LABEL}: duplicated ${kind} tags on "${identifier()}".`,
273
- );
274
-
275
- // NEIGHBOR TAG
276
- for (const name of neighbors)
277
- if (output.some((tag) => tag.kind === name))
278
- throw new Error(
279
- `${LABEL}: ${kind} and ${name} tags on "${identifier()}".`,
280
- );
281
- }
282
-
283
- function has_atomic(metadata: Metadata, type: "string" | "number"): boolean {
284
- const valid =
285
- type === "number"
286
- ? (atom: string) => atom === type || atom === "bigint"
287
- : (atom: string) => atom === type;
288
- return (
289
- metadata.atomics.find((atom) => valid(atom)) !== undefined ||
290
- metadata.arrays.some((child) => has_atomic(child, type)) ||
291
- metadata.tuples.some((tuple) =>
292
- tuple.some((child) => has_atomic(child, type)),
293
- )
294
- );
295
- }
296
-
297
- function has_array(metadata: Metadata): boolean {
298
- return (
299
- metadata.arrays.length !== 0 ||
300
- metadata.tuples.some((tuple) => tuple.some((child) => has_array(child)))
301
- );
302
- }
1
+ import ts from "typescript";
2
+
3
+ import { IMetadataTag } from "../metadata/IMetadataTag";
4
+ import { Metadata } from "../metadata/Metadata";
5
+
6
+ export namespace MetadataTagFactory {
7
+ export function generate(
8
+ identifier: () => string,
9
+ metadata: Metadata,
10
+ tagList: ts.JSDocTagInfo[],
11
+ ): IMetadataTag[] {
12
+ const output: IMetadataTag[] = [];
13
+ for (const tag of tagList) {
14
+ const elem: IMetadataTag | null = parse(
15
+ identifier,
16
+ metadata,
17
+ tag,
18
+ output,
19
+ );
20
+ if (elem !== null) output.push(elem);
21
+ }
22
+ return output;
23
+ }
24
+
25
+ function parse(
26
+ identifier: () => string,
27
+ metadata: Metadata,
28
+ tag: ts.JSDocTagInfo,
29
+ output: IMetadataTag[],
30
+ ): IMetadataTag | null {
31
+ const closure = _PARSER[tag.name];
32
+ if (closure === undefined) return null;
33
+
34
+ const text = (tag.text || [])[0]?.text;
35
+ if (text === undefined)
36
+ throw new Error(`${LABEL}: no tag value on ${identifier()}`);
37
+
38
+ return closure(identifier, metadata, text, output);
39
+ }
40
+
41
+ /**
42
+ * @internal
43
+ */
44
+ export const _PARSER: Record<
45
+ string,
46
+ (
47
+ identifier: () => string,
48
+ metadata: Metadata,
49
+ text: string,
50
+ output: IMetadataTag[],
51
+ ) => IMetadataTag | null
52
+ > = {
53
+ /* -----------------------------------------------------------
54
+ ARRAY
55
+ ----------------------------------------------------------- */
56
+ items: (identifier, metadata, text, output) => {
57
+ validate(identifier, metadata, output, "items", "array", [
58
+ "minItems",
59
+ ]);
60
+ return {
61
+ kind: "items",
62
+ value: parse_number(identifier, text),
63
+ };
64
+ },
65
+ minItems: (identifier, metadata, text, output) => {
66
+ validate(identifier, metadata, output, "minItems", "array", [
67
+ "items",
68
+ ]);
69
+ return {
70
+ kind: "minItems",
71
+ value: parse_number(identifier, text),
72
+ };
73
+ },
74
+ maxItems: (identifier, metadata, text, output) => {
75
+ validate(identifier, metadata, output, "maxItems", "array", [
76
+ "items",
77
+ ]);
78
+ return {
79
+ kind: "maxItems",
80
+ value: parse_number(identifier, text),
81
+ };
82
+ },
83
+
84
+ /* -----------------------------------------------------------
85
+ NUMBER
86
+ ----------------------------------------------------------- */
87
+ type: (identifier, metadata, text, output) => {
88
+ validate(identifier, metadata, output, "type", "number", []);
89
+ if (text !== "int" && text !== "uint")
90
+ throw new Error(
91
+ `${LABEL}: invalid type tag on "${identifier()}".`,
92
+ );
93
+ return { kind: "type", value: text };
94
+ },
95
+ minimum: (identifier, metadata, text, output) => {
96
+ validate(identifier, metadata, output, "minimum", "number", [
97
+ "exclusiveMinimum",
98
+ ]);
99
+ return {
100
+ kind: "minimum",
101
+ value: parse_number(identifier, text),
102
+ };
103
+ },
104
+ maximum: (identifier, metadata, text, output) => {
105
+ validate(identifier, metadata, output, "maximum", "number", [
106
+ "exclusiveMaximum",
107
+ ]);
108
+ return {
109
+ kind: "maximum",
110
+ value: parse_number(identifier, text),
111
+ };
112
+ },
113
+ exclusiveMinimum: (identifier, metadata, text, output) => {
114
+ validate(
115
+ identifier,
116
+ metadata,
117
+ output,
118
+ "exclusiveMinimum",
119
+ "number",
120
+ ["minimum"],
121
+ );
122
+ return {
123
+ kind: "exclusiveMinimum",
124
+ value: parse_number(identifier, text),
125
+ };
126
+ },
127
+ exclusiveMaximum: (identifier, metadata, text, output) => {
128
+ validate(
129
+ identifier,
130
+ metadata,
131
+ output,
132
+ "exclusiveMaximum",
133
+ "number",
134
+ ["maximum"],
135
+ );
136
+ return {
137
+ kind: "exclusiveMaximum",
138
+ value: parse_number(identifier, text),
139
+ };
140
+ },
141
+ multipleOf: (identifier, metadata, text, output) => {
142
+ validate(identifier, metadata, output, "multipleOf", "number", [
143
+ "step",
144
+ ]);
145
+ return {
146
+ kind: "multipleOf",
147
+ value: parse_number(identifier, text),
148
+ };
149
+ },
150
+ step: (identifier, metadata, text, output) => {
151
+ validate(identifier, metadata, output, "step", "number", [
152
+ "multipleOf",
153
+ ]);
154
+
155
+ const minimum: boolean = output.some(
156
+ (tag) =>
157
+ tag.kind === "minimum" || tag.kind === "exclusiveMinimum",
158
+ );
159
+ if (minimum === undefined)
160
+ throw new Error(
161
+ `${LABEL}: step requires minimum or exclusiveMinimum tag on "${identifier()}".`,
162
+ );
163
+
164
+ return {
165
+ kind: "step",
166
+ value: parse_number(identifier, text),
167
+ };
168
+ },
169
+
170
+ /* -----------------------------------------------------------
171
+ STRING
172
+ ----------------------------------------------------------- */
173
+ format: (identifier, metadata, str, output) => {
174
+ validate(identifier, metadata, output, "format", "string", [
175
+ "pattern",
176
+ ]);
177
+
178
+ // Ignore arbitrary @format values in the internal metadata,
179
+ // these are currently only supported on the typia.application() API.
180
+ const value: IMetadataTag.IFormat["value"] | undefined =
181
+ FORMATS.get(str);
182
+ if (value === undefined) return null;
183
+ return {
184
+ kind: "format",
185
+ value,
186
+ };
187
+ },
188
+ pattern: (identifier, metadata, value, output) => {
189
+ validate(identifier, metadata, output, "pattern", "string", [
190
+ "format",
191
+ ]);
192
+ return {
193
+ kind: "pattern",
194
+ value,
195
+ };
196
+ },
197
+ length: (identifier, metadata, text, output) => {
198
+ validate(identifier, metadata, output, "length", "string", [
199
+ "minLength",
200
+ "maxLength",
201
+ ]);
202
+ return {
203
+ kind: "length",
204
+ value: parse_number(identifier, text),
205
+ };
206
+ },
207
+ minLength: (identifier, metadata, text, output) => {
208
+ validate(identifier, metadata, output, "minLength", "string", [
209
+ "length",
210
+ ]);
211
+ return {
212
+ kind: "minLength",
213
+ value: parse_number(identifier, text),
214
+ };
215
+ },
216
+ maxLength: (identifier, metadata, text, output) => {
217
+ validate(identifier, metadata, output, "maxLength", "string", [
218
+ "length",
219
+ ]);
220
+ return {
221
+ kind: "maxLength",
222
+ value: parse_number(identifier, text),
223
+ };
224
+ },
225
+ };
226
+ }
227
+
228
+ function parse_number(identifier: () => string, str: string): number {
229
+ const value: number = Number(str);
230
+ if (isNaN(value) === true)
231
+ throw new Error(`${LABEL}: invalid number on "${identifier()}".`);
232
+ return value;
233
+ }
234
+
235
+ const LABEL = "Error on typia.MetadataTagFactory.generate()";
236
+ const FORMATS: Map<string, IMetadataTag.IFormat["value"]> = new Map([
237
+ ["uuid", "uuid"],
238
+ ["email", "email"],
239
+ ["url", "url"],
240
+ ["ipv4", "ipv4"],
241
+ ["ipv6", "ipv6"],
242
+ ["date", "date"],
243
+ ["datetime", "datetime"],
244
+ ["date-time", "datetime"],
245
+ ["dateTime", "datetime"],
246
+ ]);
247
+
248
+ const WRONG_TYPE = (
249
+ tag: string,
250
+ type: "string" | "number" | "array",
251
+ identifier: () => string,
252
+ ) => `${LABEL}: ${tag} requires ${type} type, but no "${identifier()}".`;
253
+
254
+ function validate(
255
+ identifier: () => string,
256
+ metadata: Metadata,
257
+ output: IMetadataTag[],
258
+ kind: IMetadataTag["kind"],
259
+ type: "array" | "string" | "number",
260
+ neighbors: IMetadataTag["kind"][],
261
+ ): void {
262
+ // TYPE CHECKING
263
+ if (type === "array") {
264
+ if (has_array(metadata) === false)
265
+ throw new Error(WRONG_TYPE(kind, "array", identifier));
266
+ } else if (has_atomic(metadata, type) === false)
267
+ throw new Error(WRONG_TYPE(kind, type, identifier));
268
+
269
+ // DUPLICATED TAG
270
+ if (output.some((tag) => tag.kind === kind))
271
+ throw new Error(
272
+ `${LABEL}: duplicated ${kind} tags on "${identifier()}".`,
273
+ );
274
+
275
+ // NEIGHBOR TAG
276
+ for (const name of neighbors)
277
+ if (output.some((tag) => tag.kind === name))
278
+ throw new Error(
279
+ `${LABEL}: ${kind} and ${name} tags on "${identifier()}".`,
280
+ );
281
+ }
282
+
283
+ function has_atomic(metadata: Metadata, type: "string" | "number"): boolean {
284
+ const valid =
285
+ type === "number"
286
+ ? (atom: string) => atom === type || atom === "bigint"
287
+ : (atom: string) => atom === type;
288
+ return (
289
+ metadata.atomics.find((atom) => valid(atom)) !== undefined ||
290
+ metadata.arrays.some((child) => has_atomic(child, type)) ||
291
+ metadata.tuples.some((tuple) =>
292
+ tuple.some((child) => has_atomic(child, type)),
293
+ )
294
+ );
295
+ }
296
+
297
+ function has_array(metadata: Metadata): boolean {
298
+ return (
299
+ metadata.arrays.length !== 0 ||
300
+ metadata.tuples.some((tuple) => tuple.some((child) => has_array(child)))
301
+ );
302
+ }
@@ -1,4 +1,4 @@
1
- export interface ICommentTag {
2
- name: string;
3
- value?: string;
4
- }
1
+ export interface ICommentTag {
2
+ name: string;
3
+ value?: string;
4
+ }
package/src/module.ts CHANGED
@@ -4,6 +4,8 @@ import { Namespace } from "./functional/Namespace";
4
4
  import { IMetadataApplication } from "./metadata/IMetadataApplication";
5
5
  import { IJsonApplication } from "./schemas/IJsonApplication";
6
6
 
7
+ import { Atomic } from "./typings/Atomic";
8
+
7
9
  import { MapUtil } from "./utils/MapUtil";
8
10
 
9
11
  import { CustomValidatorMap } from "./CustomValidatorMap";
@@ -942,6 +944,47 @@ export function random(): never {
942
944
  }
943
945
  Object.assign(random, Namespace.random());
944
946
 
947
+ /**
948
+ * > You must configure the generic argument `T`.
949
+ *
950
+ * Union literal type to array.
951
+ *
952
+ * Converts a union literal type to an array of its members.
953
+ *
954
+ * ```typescript
955
+ * literals<"A" | "B" | 1>; // [1, 2, 3] as const
956
+ * ```
957
+ *
958
+ * @template T Union literal type
959
+ * @return Array of union literal type's members
960
+ *
961
+ * @author Jeongho Nam - https://github.com/samchon
962
+ */
963
+ export function literals(): never;
964
+
965
+ /**
966
+ * Union literal type to array.
967
+ *
968
+ * Converts a union literal type to an array of its members.
969
+ *
970
+ * ```typescript
971
+ * literals<"A" | "B" | 1>; // [1, 2, 3] as const
972
+ * ```
973
+ *
974
+ * @template T Union literal type
975
+ * @return Array of union literal type's members
976
+ *
977
+ * @author Jeongho Nam - https://github.com/samchon
978
+ */
979
+ export function literals<T extends Atomic.Type>(): T[];
980
+
981
+ /**
982
+ * @internal
983
+ */
984
+ export function literals(): never {
985
+ halt("literals");
986
+ }
987
+
945
988
  /**
946
989
  * Clone a data.
947
990
  *