@sdk-it/core 0.22.0 → 0.22.1

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.
@@ -1,417 +1,388 @@
1
1
  import { describe, it } from "node:test";
2
- import ts from "typescript";
3
- describe("TypeDeriver Class", () => {
4
- describe("Initialization and Core Properties", () => {
5
- it.todo("instantiates with a TypeScript TypeChecker instance", () => {
6
- });
7
- it.todo("initializes the `collector` property as an empty object", () => {
8
- });
9
- it.todo(
10
- "exposes the `deriveSymbol` constant for marking serialized objects",
11
- () => {
12
- }
13
- );
14
- it.todo(
15
- "exposes the `$types` symbol constant for holding serialized type information",
16
- () => {
17
- }
18
- );
2
+ describe("serializeType: Basic Primitive and Special Types", () => {
3
+ it.todo("serializes `any` type to an empty type list", () => {
19
4
  });
20
- describe("serializeType: Basic Primitive and Special Types", () => {
21
- it.todo("serializes `any` type to an empty type list", () => {
22
- });
23
- it.todo("serializes `unknown` type to an empty type list", () => {
24
- });
25
- it.todo("serializes `string` type", () => {
26
- });
27
- it.todo("serializes `number` type", () => {
28
- });
29
- it.todo("serializes `boolean` type", () => {
30
- });
31
- it.todo("serializes `null` type as optional", () => {
32
- });
33
- it.todo(
34
- "serializes `void` type (likely falls back to Any/Unknown or unhandled)",
35
- () => {
36
- }
37
- );
38
- it.todo(
39
- "serializes `never` type (likely falls back to Any/Unknown or unhandled)",
40
- () => {
41
- }
42
- );
43
- it.todo(
44
- "serializes `undefined` type implicitly via union/intersection optional flag",
45
- () => {
46
- }
47
- );
5
+ it.todo("serializes `unknown` type to an empty type list", () => {
48
6
  });
49
- describe("serializeType: Literal Types", () => {
50
- it.todo("serializes string literal types with their value", () => {
51
- });
52
- it.todo("serializes numeric literal types with their value", () => {
53
- });
54
- it.todo("serializes boolean literal `true` type", () => {
55
- });
56
- it.todo("serializes boolean literal `false` type", () => {
57
- });
58
- it.todo("serializes template literal types as base `string`", () => {
59
- });
7
+ it.todo("serializes `string` type", () => {
60
8
  });
61
- describe("serializeType: Enum Types", () => {
62
- it.todo(
63
- "serializes an Enum type (e.g., `enum Color {}`) potentially via unhandled path",
64
- () => {
65
- }
66
- );
67
- it.todo(
68
- "serializes an EnumLiteral type (e.g., `Color.Red`) potentially via unhandled path or base type",
69
- () => {
70
- }
71
- );
9
+ it.todo("serializes `number` type", () => {
72
10
  });
73
- describe("serializeType: Union Types (`|`)", () => {
74
- it.todo(
75
- "serializes a union of primitive types (e.g., string | number)",
76
- () => {
77
- }
78
- );
79
- it.todo(
80
- "serializes a union type including `null` (e.g., string | null)",
81
- () => {
82
- }
83
- );
84
- it.todo(
85
- "serializes a union type including `undefined`, setting optional flag and filtering `undefined`",
86
- () => {
87
- }
88
- );
89
- it.todo(
90
- "serializes a union type including both `null` and `undefined`",
91
- () => {
92
- }
93
- );
94
- it.todo('serializes a union of literal types (e.g., "a" | "b" | 1)', () => {
95
- });
96
- it.todo(
97
- "serializes a union including complex types (e.g., string | MyInterface)",
98
- () => {
99
- }
100
- );
101
- it.todo("serializes a union containing only `undefined`", () => {
102
- });
103
- it.todo("serializes a union containing only `null`", () => {
104
- });
11
+ it.todo("serializes `boolean` type", () => {
105
12
  });
106
- describe("serializeType: Intersection Types (`&`)", () => {
107
- it.todo(
108
- "serializes an intersection of object/interface types (e.g., A & B)",
109
- () => {
110
- }
111
- );
112
- it.todo(
113
- "serializes an intersection type including `undefined`, setting optional flag and filtering `undefined`",
114
- () => {
115
- }
116
- );
117
- it.todo("serializes an intersection containing only `undefined`", () => {
118
- });
13
+ it.todo("serializes `null` type as optional", () => {
119
14
  });
120
- describe("serializeType: Array and Tuple Types", () => {
121
- it.todo("serializes a simple array type (e.g., string[])", () => {
122
- });
123
- it.todo("serializes readonly array types (e.g., readonly number[])", () => {
124
- });
125
- it.todo(
126
- "serializes an array type with object elements (e.g., MyInterface[])",
127
- () => {
128
- }
129
- );
130
- it.todo(
131
- "serializes an array type with union elements (e.g., (string | number)[])",
132
- () => {
133
- }
134
- );
135
- it.todo("serializes an array type where element type has no symbol", () => {
136
- });
137
- it.todo(
138
- "serializes an array type where element symbol has no value declaration but has declarations",
139
- () => {
140
- }
141
- );
142
- it.todo(
143
- "serializes an array type with a mapped type element (e.g., MappedType[])",
144
- () => {
145
- }
146
- );
147
- it.todo(
148
- "handles array-like types with missing type arguments gracefully (e.g., Array)",
149
- () => {
150
- }
151
- );
152
- it.todo(
153
- "serializes tuple types (e.g., [string, number]) potentially as array of union",
154
- () => {
155
- }
156
- );
15
+ it.todo(
16
+ "serializes `void` type (likely falls back to Any/Unknown or unhandled)",
17
+ () => {
18
+ }
19
+ );
20
+ it.todo(
21
+ "serializes `never` type (likely falls back to Any/Unknown or unhandled)",
22
+ () => {
23
+ }
24
+ );
25
+ it.todo(
26
+ "serializes `undefined` type implicitly via union/intersection optional flag",
27
+ () => {
28
+ }
29
+ );
30
+ });
31
+ describe("serializeType: Literal Types", () => {
32
+ it.todo("serializes string literal types with their value", () => {
33
+ });
34
+ it.todo("serializes numeric literal types with their value", () => {
35
+ });
36
+ it.todo("serializes boolean literal `true` type", () => {
157
37
  });
158
- describe("serializeType: Record/Index Types", () => {
159
- it.todo(
160
- "serializes a string index signature type (Record<string, number>)",
161
- () => {
162
- }
163
- );
164
- it.todo(
165
- "serializes a string index signature type with complex value (Record<string, MyInterface>)",
166
- () => {
167
- }
168
- );
169
- it.todo(
170
- "serializes a type with only a number index signature ([key: number]: boolean)",
171
- () => {
172
- }
173
- );
38
+ it.todo("serializes boolean literal `false` type", () => {
174
39
  });
175
- describe("serializeType: Object Types (Interfaces, Classes, Inline, Mapped)", () => {
176
- it.todo("serializes an inline object type literal (passed as type)", () => {
177
- });
178
- it.todo(
179
- "serializes a mapped type directly (e.g., type M = { [K in keyof T]: T[K] })",
180
- () => {
181
- }
182
- );
183
- it.todo(
184
- "serializes an object type using literal property assignments from declarations",
185
- () => {
186
- }
187
- );
188
- it.todo(
189
- "serializes an object type with mixed declared types (PropertySignature) and literal assignments (PropertyAssignment)",
190
- () => {
191
- }
192
- );
193
- it.todo(
194
- "serializes an empty object type `{}` potentially falling back to name or generic",
195
- () => {
196
- }
197
- );
198
- it.todo(
199
- "handles object types matching default overrides (e.g., DateConstructor -> string)",
200
- () => {
201
- }
202
- );
203
- it.todo(
204
- "handles known object types NOT in defaults (e.g., RegExp) by attempting standard object serialization",
205
- () => {
206
- }
207
- );
208
- it.todo(
209
- "serializes an interface type by deferring to serializeNode for reference/collection",
210
- () => {
211
- }
212
- );
213
- it.todo(
214
- "serializes a class type by deferring to serializeNode for reference/collection",
215
- () => {
216
- }
217
- );
218
- it.todo(
219
- "serializes an interface type using its name when its declaration cannot be found",
220
- () => {
221
- }
222
- );
223
- it.todo(
224
- "serializes a class type using its name when its declaration cannot be found",
225
- () => {
226
- }
227
- );
40
+ it.todo("serializes template literal types as base `string`", () => {
41
+ });
42
+ });
43
+ describe("serializeType: Enum Types", () => {
44
+ it.todo(
45
+ "serializes an Enum type (e.g., `enum Color {}`) potentially via unhandled path",
46
+ () => {
47
+ }
48
+ );
49
+ it.todo(
50
+ "serializes an EnumLiteral type (e.g., `Color.Red`) potentially via unhandled path or base type",
51
+ () => {
52
+ }
53
+ );
54
+ });
55
+ describe("serializeType: Union Types (`|`)", () => {
56
+ it.todo(
57
+ "serializes a union of primitive types (e.g., string | number)",
58
+ () => {
59
+ }
60
+ );
61
+ it.todo(
62
+ "serializes a union type including `null` (e.g., string | null)",
63
+ () => {
64
+ }
65
+ );
66
+ it.todo(
67
+ "serializes a union type including `undefined`, setting optional flag and filtering `undefined`",
68
+ () => {
69
+ }
70
+ );
71
+ it.todo(
72
+ "serializes a union type including both `null` and `undefined`",
73
+ () => {
74
+ }
75
+ );
76
+ it.todo('serializes a union of literal types (e.g., "a" | "b" | 1)', () => {
228
77
  });
229
- describe("serializeType: Unhandled Types", () => {
230
- it.todo(
231
- "handles an unhandled type flag by using checker.typeToString and warns",
232
- () => {
233
- }
234
- );
78
+ it.todo(
79
+ "serializes a union including complex types (e.g., string | MyInterface)",
80
+ () => {
81
+ }
82
+ );
83
+ it.todo("serializes a union containing only `undefined`", () => {
84
+ });
85
+ it.todo("serializes a union containing only `null`", () => {
86
+ });
87
+ });
88
+ describe("serializeType: Intersection Types (`&`)", () => {
89
+ it.todo(
90
+ "serializes an intersection of object/interface types (e.g., A & B)",
91
+ () => {
92
+ }
93
+ );
94
+ it.todo(
95
+ "serializes an intersection type including `undefined`, setting optional flag and filtering `undefined`",
96
+ () => {
97
+ }
98
+ );
99
+ it.todo("serializes an intersection containing only `undefined`", () => {
100
+ });
101
+ });
102
+ describe("serializeType: Array and Tuple Types", () => {
103
+ it.todo("serializes a simple array type (e.g., string[])", () => {
235
104
  });
236
- describe("serializeNode: Object Literal Expressions (`{ ... }`)", () => {
237
- it.todo(
238
- "serializes an object literal node with various primitive property types",
239
- () => {
240
- }
241
- );
242
- it.todo(
243
- "serializes an object literal node with nested object/array literals",
244
- () => {
245
- }
246
- );
247
- it.todo("serializes an empty object literal node `{}`", () => {
248
- });
105
+ it.todo("serializes readonly array types (e.g., readonly number[])", () => {
249
106
  });
250
- describe("serializeNode: Property Access/Signature/Declaration", () => {
251
- it.todo(
252
- "serializes a PropertyAccessExpression node (e.g., `obj.prop`) by resolving its type",
253
- () => {
254
- }
255
- );
256
- it.todo(
257
- "serializes a PropertySignature node (e.g., `prop: string;`) by resolving its type",
258
- () => {
259
- }
260
- );
261
- it.todo(
262
- "serializes a PropertyDeclaration node (e.g., `prop: number;`) by resolving its type",
263
- () => {
264
- }
265
- );
266
- it.todo(
267
- "handles property nodes where symbol cannot be found for the property name and warns",
268
- () => {
269
- }
270
- );
107
+ it.todo(
108
+ "serializes an array type with object elements (e.g., MyInterface[])",
109
+ () => {
110
+ }
111
+ );
112
+ it.todo(
113
+ "serializes an array type with union elements (e.g., (string | number)[])",
114
+ () => {
115
+ }
116
+ );
117
+ it.todo("serializes an array type where element type has no symbol", () => {
271
118
  });
272
- describe("serializeNode: Interface Declarations (`interface ...`) and Collector Interaction", () => {
273
- it.todo(
274
- "serializes a new interface declaration, adding its structure to the collector",
275
- () => {
276
- }
277
- );
278
- it.todo(
279
- "returns only a reference for an already serialized interface declaration (present in collector)",
280
- () => {
281
- }
282
- );
283
- it.todo(
284
- "handles interface declarations matching default overrides without adding to collector",
285
- () => {
286
- }
287
- );
288
- it.todo(
289
- "throws an error for an interface declaration without a name",
290
- () => {
291
- }
292
- );
293
- it.todo(
294
- "handles interfaces with no members correctly (adds empty object to collector)",
295
- () => {
296
- }
297
- );
298
- it.todo(
299
- "handles interfaces extending other interfaces (serialization includes only own properties)",
300
- () => {
301
- }
302
- );
119
+ it.todo(
120
+ "serializes an array type where element symbol has no value declaration but has declarations",
121
+ () => {
122
+ }
123
+ );
124
+ it.todo(
125
+ "serializes an array type with a mapped type element (e.g., MappedType[])",
126
+ () => {
127
+ }
128
+ );
129
+ it.todo(
130
+ "handles array-like types with missing type arguments gracefully (e.g., Array)",
131
+ () => {
132
+ }
133
+ );
134
+ it.todo(
135
+ "serializes tuple types (e.g., [string, number]) potentially as array of union",
136
+ () => {
137
+ }
138
+ );
139
+ });
140
+ describe("serializeType: Record/Index Types", () => {
141
+ it.todo(
142
+ "serializes a string index signature type (Record<string, number>)",
143
+ () => {
144
+ }
145
+ );
146
+ it.todo(
147
+ "serializes a string index signature type with complex value (Record<string, MyInterface>)",
148
+ () => {
149
+ }
150
+ );
151
+ it.todo(
152
+ "serializes a type with only a number index signature ([key: number]: boolean)",
153
+ () => {
154
+ }
155
+ );
156
+ });
157
+ describe("serializeType: Object Types (Interfaces, Classes, Inline, Mapped)", () => {
158
+ it.todo("serializes an inline object type literal (passed as type)", () => {
159
+ });
160
+ it.todo(
161
+ "serializes a mapped type directly (e.g., type M = { [K in keyof T]: T[K] })",
162
+ () => {
163
+ }
164
+ );
165
+ it.todo(
166
+ "serializes an object type using literal property assignments from declarations",
167
+ () => {
168
+ }
169
+ );
170
+ it.todo(
171
+ "serializes an object type with mixed declared types (PropertySignature) and literal assignments (PropertyAssignment)",
172
+ () => {
173
+ }
174
+ );
175
+ it.todo(
176
+ "serializes an empty object type `{}` potentially falling back to name or generic",
177
+ () => {
178
+ }
179
+ );
180
+ it.todo(
181
+ "handles object types matching default overrides (e.g., DateConstructor -> string)",
182
+ () => {
183
+ }
184
+ );
185
+ it.todo(
186
+ "handles known object types NOT in defaults (e.g., RegExp) by attempting standard object serialization",
187
+ () => {
188
+ }
189
+ );
190
+ it.todo(
191
+ "serializes an interface type by deferring to serializeNode for reference/collection",
192
+ () => {
193
+ }
194
+ );
195
+ it.todo(
196
+ "serializes a class type by deferring to serializeNode for reference/collection",
197
+ () => {
198
+ }
199
+ );
200
+ it.todo(
201
+ "serializes an interface type using its name when its declaration cannot be found",
202
+ () => {
203
+ }
204
+ );
205
+ it.todo(
206
+ "serializes a class type using its name when its declaration cannot be found",
207
+ () => {
208
+ }
209
+ );
210
+ });
211
+ describe("serializeType: Unhandled Types", () => {
212
+ it.todo(
213
+ "handles an unhandled type flag by using checker.typeToString and warns",
214
+ () => {
215
+ }
216
+ );
217
+ });
218
+ describe("serializeNode: Object Literal Expressions (`{ ... }`)", () => {
219
+ it.todo(
220
+ "serializes an object literal node with various primitive property types",
221
+ () => {
222
+ }
223
+ );
224
+ it.todo(
225
+ "serializes an object literal node with nested object/array literals",
226
+ () => {
227
+ }
228
+ );
229
+ it.todo("serializes an empty object literal node `{}`", () => {
230
+ });
231
+ });
232
+ describe("serializeNode: Property Access/Signature/Declaration", () => {
233
+ it.todo(
234
+ "serializes a PropertyAccessExpression node (e.g., `obj.prop`) by resolving its type",
235
+ () => {
236
+ }
237
+ );
238
+ it.todo(
239
+ "serializes a PropertySignature node (e.g., `prop: string;`) by resolving its type",
240
+ () => {
241
+ }
242
+ );
243
+ it.todo(
244
+ "serializes a PropertyDeclaration node (e.g., `prop: number;`) by resolving its type",
245
+ () => {
246
+ }
247
+ );
248
+ it.todo(
249
+ "handles property nodes where symbol cannot be found for the property name and warns",
250
+ () => {
251
+ }
252
+ );
253
+ });
254
+ describe("serializeNode: Interface Declarations (`interface ...`) and Collector Interaction", () => {
255
+ it.todo(
256
+ "serializes a new interface declaration, adding its structure to the collector",
257
+ () => {
258
+ }
259
+ );
260
+ it.todo(
261
+ "returns only a reference for an already serialized interface declaration (present in collector)",
262
+ () => {
263
+ }
264
+ );
265
+ it.todo(
266
+ "handles interface declarations matching default overrides without adding to collector",
267
+ () => {
268
+ }
269
+ );
270
+ it.todo(
271
+ "throws an error for an interface declaration without a name",
272
+ () => {
273
+ }
274
+ );
275
+ it.todo(
276
+ "handles interfaces with no members correctly (adds empty object to collector)",
277
+ () => {
278
+ }
279
+ );
280
+ it.todo(
281
+ "handles interfaces extending other interfaces (serialization includes only own properties)",
282
+ () => {
283
+ }
284
+ );
285
+ });
286
+ describe("serializeNode: Class Declarations (`class ...`) and Collector Interaction", () => {
287
+ it.todo(
288
+ "serializes a new class declaration, adding its property structure to the collector",
289
+ () => {
290
+ }
291
+ );
292
+ it.todo(
293
+ "returns only a reference for an already serialized class declaration (present in collector)",
294
+ () => {
295
+ }
296
+ );
297
+ it.todo(
298
+ "handles class declarations matching default overrides without adding to collector",
299
+ () => {
300
+ }
301
+ );
302
+ it.todo(
303
+ "throws an error for a class declaration without a name (e.g., anonymous default export)",
304
+ () => {
305
+ }
306
+ );
307
+ it.todo(
308
+ "handles classes with no property declarations (only methods/constructor) correctly (adds empty object to collector)",
309
+ () => {
310
+ }
311
+ );
312
+ it.todo(
313
+ "handles classes implementing interfaces (serialization includes only own properties)",
314
+ () => {
315
+ }
316
+ );
317
+ it.todo(
318
+ "handles classes extending other classes (serialization includes only own properties)",
319
+ () => {
320
+ }
321
+ );
322
+ });
323
+ describe("serializeNode: Other Node Types", () => {
324
+ it.todo(
325
+ "serializes a VariableDeclaration node with an explicit type annotation",
326
+ () => {
327
+ }
328
+ );
329
+ it.todo(
330
+ "handles VariableDeclaration node without a type annotation and warns",
331
+ () => {
332
+ }
333
+ );
334
+ it.todo(
335
+ "handles VariableDeclaration node where symbol cannot be found for the variable name and warns",
336
+ () => {
337
+ }
338
+ );
339
+ it.todo(
340
+ "serializes an Identifier node by resolving its type at that location",
341
+ () => {
342
+ }
343
+ );
344
+ it.todo(
345
+ "handles Identifier node where symbol cannot be found and warns",
346
+ () => {
347
+ }
348
+ );
349
+ it.todo(
350
+ "serializes an AwaitExpression node by resolving the awaited type",
351
+ () => {
352
+ }
353
+ );
354
+ it.todo(
355
+ "serializes a CallExpression node by resolving its return type",
356
+ () => {
357
+ }
358
+ );
359
+ it.todo(
360
+ "serializes an AsExpression node by resolving the asserted type",
361
+ () => {
362
+ }
363
+ );
364
+ it.todo(
365
+ "serializes a TypeLiteralNode (`{ ... }` used as a type) by resolving its properties",
366
+ () => {
367
+ }
368
+ );
369
+ it.todo("serializes NullKeyword node", () => {
303
370
  });
304
- describe("serializeNode: Class Declarations (`class ...`) and Collector Interaction", () => {
305
- it.todo(
306
- "serializes a new class declaration, adding its property structure to the collector",
307
- () => {
308
- }
309
- );
310
- it.todo(
311
- "returns only a reference for an already serialized class declaration (present in collector)",
312
- () => {
313
- }
314
- );
315
- it.todo(
316
- "handles class declarations matching default overrides without adding to collector",
317
- () => {
318
- }
319
- );
320
- it.todo(
321
- "throws an error for a class declaration without a name (e.g., anonymous default export)",
322
- () => {
323
- }
324
- );
325
- it.todo(
326
- "handles classes with no property declarations (only methods/constructor) correctly (adds empty object to collector)",
327
- () => {
328
- }
329
- );
330
- it.todo(
331
- "handles classes implementing interfaces (serialization includes only own properties)",
332
- () => {
333
- }
334
- );
335
- it.todo(
336
- "handles classes extending other classes (serialization includes only own properties)",
337
- () => {
338
- }
339
- );
371
+ it.todo("serializes BooleanKeyword node", () => {
340
372
  });
341
- describe("serializeNode: Other Node Types", () => {
342
- it.todo(
343
- "serializes a VariableDeclaration node with an explicit type annotation",
344
- () => {
345
- }
346
- );
347
- it.todo(
348
- "handles VariableDeclaration node without a type annotation and warns",
349
- () => {
350
- }
351
- );
352
- it.todo(
353
- "handles VariableDeclaration node where symbol cannot be found for the variable name and warns",
354
- () => {
355
- }
356
- );
357
- it.todo(
358
- "serializes an Identifier node by resolving its type at that location",
359
- () => {
360
- }
361
- );
362
- it.todo(
363
- "handles Identifier node where symbol cannot be found and warns",
364
- () => {
365
- }
366
- );
367
- it.todo(
368
- "serializes an AwaitExpression node by resolving the awaited type",
369
- () => {
370
- }
371
- );
372
- it.todo(
373
- "serializes a CallExpression node by resolving its return type",
374
- () => {
375
- }
376
- );
377
- it.todo(
378
- "serializes an AsExpression node by resolving the asserted type",
379
- () => {
380
- }
381
- );
382
- it.todo(
383
- "serializes a TypeLiteralNode (`{ ... }` used as a type) by resolving its properties",
384
- () => {
385
- }
386
- );
387
- it.todo("serializes NullKeyword node", () => {
388
- });
389
- it.todo("serializes BooleanKeyword node", () => {
390
- });
391
- it.todo("serializes TrueKeyword node as boolean literal", () => {
392
- });
393
- it.todo("serializes FalseKeyword node as boolean literal", () => {
394
- });
395
- it.todo(
396
- "serializes an ArrayLiteralExpression node by resolving its inferred type",
397
- () => {
398
- }
399
- );
400
- it.todo(
401
- "handles an unhandled node kind by returning `any` and warns",
402
- () => {
403
- }
404
- );
373
+ it.todo("serializes TrueKeyword node as boolean literal", () => {
405
374
  });
406
- describe("Helper Function: isInterfaceType", () => {
407
- it.todo("returns true for a type whose symbol is an Interface", () => {
408
- });
409
- it.todo("returns false for a type whose symbol is a Class", () => {
410
- });
411
- it.todo("returns false for a type that is not a class or interface", () => {
412
- });
413
- it.todo("returns false if the type has no symbol", () => {
414
- });
375
+ it.todo("serializes FalseKeyword node as boolean literal", () => {
415
376
  });
377
+ it.todo(
378
+ "serializes an ArrayLiteralExpression node by resolving its inferred type",
379
+ () => {
380
+ }
381
+ );
382
+ it.todo(
383
+ "handles an unhandled node kind by returning `any` and warns",
384
+ () => {
385
+ }
386
+ );
416
387
  });
417
388
  //# sourceMappingURL=deriver.test.js.map