Skip to content

Commit 6e0661c

Browse files
ericzhangjxGerrit0
authored andcommitted
chore: add & rebuild tests for type operators
1 parent a1ac23c commit 6e0661c

File tree

2 files changed

+177
-23
lines changed

2 files changed

+177
-23
lines changed

src/test/converter/types/specs.json

Lines changed: 170 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,152 @@
6666
},
6767
{
6868
"id": 4,
69+
"name": "\"type-operator\"",
70+
"kind": 1,
71+
"kindString": "Module",
72+
"flags": {
73+
"isExported": true
74+
},
75+
"originalName": "%BASE%/types/type-operator.ts",
76+
"children": [
77+
{
78+
"id": 6,
79+
"name": "B",
80+
"kind": 4194304,
81+
"kindString": "Type alias",
82+
"flags": {
83+
"isExported": true
84+
},
85+
"type": {
86+
"type": "typeOperator",
87+
"operator": "readonly",
88+
"target": {
89+
"type": "array",
90+
"elementType": {
91+
"type": "intrinsic",
92+
"name": "number"
93+
}
94+
}
95+
}
96+
},
97+
{
98+
"id": 7,
99+
"name": "C",
100+
"kind": 4194304,
101+
"kindString": "Type alias",
102+
"flags": {
103+
"isExported": true
104+
},
105+
"type": {
106+
"type": "reflection",
107+
"declaration": {
108+
"id": 8,
109+
"name": "__type",
110+
"kind": 65536,
111+
"kindString": "Type literal",
112+
"flags": {
113+
"isExported": true
114+
},
115+
"children": [
116+
{
117+
"id": 9,
118+
"name": "prop1",
119+
"kind": 32,
120+
"kindString": "Variable",
121+
"flags": {
122+
"isExported": true
123+
},
124+
"type": {
125+
"type": "intrinsic",
126+
"name": "string"
127+
}
128+
},
129+
{
130+
"id": 10,
131+
"name": "prop2",
132+
"kind": 32,
133+
"kindString": "Variable",
134+
"flags": {
135+
"isExported": true
136+
},
137+
"type": {
138+
"type": "intrinsic",
139+
"name": "number"
140+
}
141+
}
142+
],
143+
"groups": [
144+
{
145+
"title": "Variables",
146+
"kind": 32,
147+
"children": [
148+
9,
149+
10
150+
]
151+
}
152+
]
153+
}
154+
}
155+
},
156+
{
157+
"id": 11,
158+
"name": "D",
159+
"kind": 4194304,
160+
"kindString": "Type alias",
161+
"flags": {
162+
"isExported": true
163+
},
164+
"type": {
165+
"type": "typeOperator",
166+
"operator": "keyof",
167+
"target": {
168+
"type": "reference",
169+
"id": 7,
170+
"name": "C"
171+
}
172+
}
173+
},
174+
{
175+
"id": 5,
176+
"name": "a",
177+
"kind": 32,
178+
"kindString": "Variable",
179+
"flags": {
180+
"isExported": true,
181+
"isConst": true
182+
},
183+
"type": {
184+
"type": "typeOperator",
185+
"operator": "unique",
186+
"target": {
187+
"type": "intrinsic",
188+
"name": "symbol"
189+
}
190+
},
191+
"defaultValue": "Symbol()"
192+
}
193+
],
194+
"groups": [
195+
{
196+
"title": "Type aliases",
197+
"kind": 4194304,
198+
"children": [
199+
6,
200+
7,
201+
11
202+
]
203+
},
204+
{
205+
"title": "Variables",
206+
"kind": 32,
207+
"children": [
208+
5
209+
]
210+
}
211+
]
212+
},
213+
{
214+
"id": 12,
69215
"name": "\"union-or-intersection\"",
70216
"kind": 1,
71217
"kindString": "Module",
@@ -75,7 +221,7 @@
75221
"originalName": "%BASE%/types/union-or-intersection.ts",
76222
"children": [
77223
{
78-
"id": 5,
224+
"id": 13,
79225
"name": "FirstType",
80226
"kind": 256,
81227
"kindString": "Interface",
@@ -87,7 +233,7 @@
87233
},
88234
"children": [
89235
{
90-
"id": 6,
236+
"id": 14,
91237
"name": "firstProperty",
92238
"kind": 1024,
93239
"kindString": "Property",
@@ -108,13 +254,13 @@
108254
"title": "Properties",
109255
"kind": 1024,
110256
"children": [
111-
6
257+
14
112258
]
113259
}
114260
]
115261
},
116262
{
117-
"id": 7,
263+
"id": 15,
118264
"name": "SecondType",
119265
"kind": 256,
120266
"kindString": "Interface",
@@ -126,7 +272,7 @@
126272
},
127273
"children": [
128274
{
129-
"id": 8,
275+
"id": 16,
130276
"name": "secondProperty",
131277
"kind": 1024,
132278
"kindString": "Property",
@@ -147,13 +293,13 @@
147293
"title": "Properties",
148294
"kind": 1024,
149295
"children": [
150-
8
296+
16
151297
]
152298
}
153299
]
154300
},
155301
{
156-
"id": 9,
302+
"id": 17,
157303
"name": "ThirdType",
158304
"kind": 256,
159305
"kindString": "Interface",
@@ -165,7 +311,7 @@
165311
},
166312
"children": [
167313
{
168-
"id": 12,
314+
"id": 20,
169315
"name": "thirdComplexProperty",
170316
"kind": 1024,
171317
"kindString": "Property",
@@ -191,12 +337,12 @@
191337
"types": [
192338
{
193339
"type": "reference",
194-
"id": 5,
340+
"id": 13,
195341
"name": "FirstType"
196342
},
197343
{
198344
"type": "reference",
199-
"id": 7,
345+
"id": 15,
200346
"name": "SecondType"
201347
}
202348
]
@@ -207,7 +353,7 @@
207353
}
208354
},
209355
{
210-
"id": 11,
356+
"id": 19,
211357
"name": "thirdIntersectionProperty",
212358
"kind": 1024,
213359
"kindString": "Property",
@@ -222,19 +368,19 @@
222368
"types": [
223369
{
224370
"type": "reference",
225-
"id": 5,
371+
"id": 13,
226372
"name": "FirstType"
227373
},
228374
{
229375
"type": "reference",
230-
"id": 9,
376+
"id": 17,
231377
"name": "ThirdType"
232378
}
233379
]
234380
}
235381
},
236382
{
237-
"id": 10,
383+
"id": 18,
238384
"name": "thirdUnionProperty",
239385
"kind": 1024,
240386
"kindString": "Property",
@@ -249,12 +395,12 @@
249395
"types": [
250396
{
251397
"type": "reference",
252-
"id": 5,
398+
"id": 13,
253399
"name": "FirstType"
254400
},
255401
{
256402
"type": "reference",
257-
"id": 7,
403+
"id": 15,
258404
"name": "SecondType"
259405
}
260406
]
@@ -266,9 +412,9 @@
266412
"title": "Properties",
267413
"kind": 1024,
268414
"children": [
269-
12,
270-
11,
271-
10
415+
20,
416+
19,
417+
18
272418
]
273419
}
274420
]
@@ -279,9 +425,9 @@
279425
"title": "Interfaces",
280426
"kind": 256,
281427
"children": [
282-
5,
283-
7,
284-
9
428+
13,
429+
15,
430+
17
285431
]
286432
}
287433
]
@@ -293,7 +439,8 @@
293439
"kind": 1,
294440
"children": [
295441
1,
296-
4
442+
4,
443+
12
297444
]
298445
}
299446
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const a: unique symbol = Symbol();
2+
export type B = readonly number[];
3+
export type C = {
4+
prop1: string;
5+
prop2: number;
6+
};
7+
export type D = keyof C;

0 commit comments

Comments
 (0)