File tree 6 files changed +432
-0
lines changed
ast-spec/src/type/TSTypeQuery
shared-fixtures/fixtures/typescript/types
snapshots/typescript/types
6 files changed +432
-0
lines changed Original file line number Diff line number Diff line change 1
1
import type { AST_NODE_TYPES } from '../../ast-node-types' ;
2
2
import type { BaseNode } from '../../base/BaseNode' ;
3
+ import type { TSTypeParameterInstantiation } from '../../special/spec' ;
3
4
import type { EntityName } from '../../unions/EntityName' ;
4
5
5
6
export interface TSTypeQuery extends BaseNode {
6
7
type : AST_NODE_TYPES . TSTypeQuery ;
7
8
exprName : EntityName ;
9
+ typeParameters ?: TSTypeParameterInstantiation ;
8
10
}
Original file line number Diff line number Diff line change
1
+ let x : typeof y . z < w > ;
Original file line number Diff line number Diff line change @@ -2429,6 +2429,9 @@ export class Converter {
2429
2429
return this . createNode < TSESTree . TSTypeQuery > ( node , {
2430
2430
type : AST_NODE_TYPES . TSTypeQuery ,
2431
2431
exprName : this . convertType ( node . exprName ) ,
2432
+ typeParameters :
2433
+ node . typeArguments &&
2434
+ this . convertTypeArgumentsToTypeParameters ( node . typeArguments , node ) ,
2432
2435
} ) ;
2433
2436
}
2434
2437
Original file line number Diff line number Diff line change @@ -2786,6 +2786,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e
2786
2786
2787
2787
exports [` Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/typeof.src 1` ] = ` "TEST OUTPUT: No semantic or syntactic issues found"` ;
2788
2788
2789
+ exports [` Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/typeof-with-type-parameters.src 1` ] = ` "TEST OUTPUT: No semantic or syntactic issues found"` ;
2790
+
2789
2791
exports [` Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/union-intersection.src 1` ] = ` "TEST OUTPUT: No semantic or syntactic issues found"` ;
2790
2792
2791
2793
exports [` Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/union-type.src 1` ] = ` "TEST OUTPUT: No semantic or syntactic issues found"` ;
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports [` typescript types typeof-with-type-parameters.src 1` ] = `
4
+ Object {
5
+ " body" : Array [
6
+ Object {
7
+ " declarations" : Array [
8
+ Object {
9
+ " id" : Object {
10
+ " loc" : Object {
11
+ " end" : Object {
12
+ " column" : 20 ,
13
+ " line" : 1 ,
14
+ },
15
+ " start" : Object {
16
+ " column" : 4 ,
17
+ " line" : 1 ,
18
+ },
19
+ },
20
+ " name" : " x" ,
21
+ " range" : Array [
22
+ 4 ,
23
+ 20 ,
24
+ ],
25
+ " type" : " Identifier" ,
26
+ " typeAnnotation" : Object {
27
+ " loc" : Object {
28
+ " end" : Object {
29
+ " column" : 20 ,
30
+ " line" : 1 ,
31
+ },
32
+ " start" : Object {
33
+ " column" : 5 ,
34
+ " line" : 1 ,
35
+ },
36
+ },
37
+ " range" : Array [
38
+ 5 ,
39
+ 20 ,
40
+ ],
41
+ " type" : " TSTypeAnnotation" ,
42
+ " typeAnnotation" : Object {
43
+ " exprName" : Object {
44
+ " left" : Object {
45
+ " loc" : Object {
46
+ " end" : Object {
47
+ " column" : 15 ,
48
+ " line" : 1 ,
49
+ },
50
+ " start" : Object {
51
+ " column" : 14 ,
52
+ " line" : 1 ,
53
+ },
54
+ },
55
+ " name" : " y" ,
56
+ " range" : Array [
57
+ 14 ,
58
+ 15 ,
59
+ ],
60
+ " type" : " Identifier" ,
61
+ },
62
+ " loc" : Object {
63
+ " end" : Object {
64
+ " column" : 17 ,
65
+ " line" : 1 ,
66
+ },
67
+ " start" : Object {
68
+ " column" : 14 ,
69
+ " line" : 1 ,
70
+ },
71
+ },
72
+ " range" : Array [
73
+ 14 ,
74
+ 17 ,
75
+ ],
76
+ " right" : Object {
77
+ " loc" : Object {
78
+ " end" : Object {
79
+ " column" : 17 ,
80
+ " line" : 1 ,
81
+ },
82
+ " start" : Object {
83
+ " column" : 16 ,
84
+ " line" : 1 ,
85
+ },
86
+ },
87
+ " name" : " z" ,
88
+ " range" : Array [
89
+ 16 ,
90
+ 17 ,
91
+ ],
92
+ " type" : " Identifier" ,
93
+ },
94
+ " type" : " TSQualifiedName" ,
95
+ },
96
+ " loc" : Object {
97
+ " end" : Object {
98
+ " column" : 20 ,
99
+ " line" : 1 ,
100
+ },
101
+ " start" : Object {
102
+ " column" : 7 ,
103
+ " line" : 1 ,
104
+ },
105
+ },
106
+ " range" : Array [
107
+ 7 ,
108
+ 20 ,
109
+ ],
110
+ " type" : " TSTypeQuery" ,
111
+ " typeParameters" : Object {
112
+ " loc" : Object {
113
+ " end" : Object {
114
+ " column" : 20 ,
115
+ " line" : 1 ,
116
+ },
117
+ " start" : Object {
118
+ " column" : 17 ,
119
+ " line" : 1 ,
120
+ },
121
+ },
122
+ " params" : Array [
123
+ Object {
124
+ " loc" : Object {
125
+ " end" : Object {
126
+ " column" : 19 ,
127
+ " line" : 1 ,
128
+ },
129
+ " start" : Object {
130
+ " column" : 18 ,
131
+ " line" : 1 ,
132
+ },
133
+ },
134
+ " range" : Array [
135
+ 18 ,
136
+ 19 ,
137
+ ],
138
+ " type" : " TSTypeReference" ,
139
+ " typeName" : Object {
140
+ " loc" : Object {
141
+ " end" : Object {
142
+ " column" : 19 ,
143
+ " line" : 1 ,
144
+ },
145
+ " start" : Object {
146
+ " column" : 18 ,
147
+ " line" : 1 ,
148
+ },
149
+ },
150
+ " name" : " w" ,
151
+ " range" : Array [
152
+ 18 ,
153
+ 19 ,
154
+ ],
155
+ " type" : " Identifier" ,
156
+ },
157
+ " typeParameters" : undefined ,
158
+ },
159
+ ],
160
+ " range" : Array [
161
+ 17 ,
162
+ 20 ,
163
+ ],
164
+ " type" : " TSTypeParameterInstantiation" ,
165
+ },
166
+ },
167
+ },
168
+ },
169
+ " init" : null ,
170
+ " loc" : Object {
171
+ " end" : Object {
172
+ " column" : 20 ,
173
+ " line" : 1 ,
174
+ },
175
+ " start" : Object {
176
+ " column" : 4 ,
177
+ " line" : 1 ,
178
+ },
179
+ },
180
+ " range" : Array [
181
+ 4 ,
182
+ 20 ,
183
+ ],
184
+ " type" : " VariableDeclarator" ,
185
+ },
186
+ ],
187
+ " kind" : " let" ,
188
+ " loc" : Object {
189
+ " end" : Object {
190
+ " column" : 21 ,
191
+ " line" : 1 ,
192
+ },
193
+ " start" : Object {
194
+ " column" : 0 ,
195
+ " line" : 1 ,
196
+ },
197
+ },
198
+ " range" : Array [
199
+ 0 ,
200
+ 21 ,
201
+ ],
202
+ " type" : " VariableDeclaration" ,
203
+ },
204
+ ],
205
+ " comments" : Array [],
206
+ " loc" : Object {
207
+ " end" : Object {
208
+ " column" : 0 ,
209
+ " line" : 2 ,
210
+ },
211
+ " start" : Object {
212
+ " column" : 0 ,
213
+ " line" : 1 ,
214
+ },
215
+ },
216
+ " range" : Array [
217
+ 0 ,
218
+ 22 ,
219
+ ],
220
+ " sourceType" : " script" ,
221
+ " tokens" : Array [
222
+ Object {
223
+ " loc" : Object {
224
+ " end" : Object {
225
+ " column" : 3 ,
226
+ " line" : 1 ,
227
+ },
228
+ " start" : Object {
229
+ " column" : 0 ,
230
+ " line" : 1 ,
231
+ },
232
+ },
233
+ " range" : Array [
234
+ 0 ,
235
+ 3 ,
236
+ ],
237
+ " type" : " Keyword" ,
238
+ " value" : " let" ,
239
+ },
240
+ Object {
241
+ " loc" : Object {
242
+ " end" : Object {
243
+ " column" : 5 ,
244
+ " line" : 1 ,
245
+ },
246
+ " start" : Object {
247
+ " column" : 4 ,
248
+ " line" : 1 ,
249
+ },
250
+ },
251
+ " range" : Array [
252
+ 4 ,
253
+ 5 ,
254
+ ],
255
+ " type" : " Identifier" ,
256
+ " value" : " x" ,
257
+ },
258
+ Object {
259
+ " loc" : Object {
260
+ " end" : Object {
261
+ " column" : 6 ,
262
+ " line" : 1 ,
263
+ },
264
+ " start" : Object {
265
+ " column" : 5 ,
266
+ " line" : 1 ,
267
+ },
268
+ },
269
+ " range" : Array [
270
+ 5 ,
271
+ 6 ,
272
+ ],
273
+ " type" : " Punctuator" ,
274
+ " value" : " :" ,
275
+ },
276
+ Object {
277
+ " loc" : Object {
278
+ " end" : Object {
279
+ " column" : 13 ,
280
+ " line" : 1 ,
281
+ },
282
+ " start" : Object {
283
+ " column" : 7 ,
284
+ " line" : 1 ,
285
+ },
286
+ },
287
+ " range" : Array [
288
+ 7 ,
289
+ 13 ,
290
+ ],
291
+ " type" : " Keyword" ,
292
+ " value" : " typeof" ,
293
+ },
294
+ Object {
295
+ " loc" : Object {
296
+ " end" : Object {
297
+ " column" : 15 ,
298
+ " line" : 1 ,
299
+ },
300
+ " start" : Object {
301
+ " column" : 14 ,
302
+ " line" : 1 ,
303
+ },
304
+ },
305
+ " range" : Array [
306
+ 14 ,
307
+ 15 ,
308
+ ],
309
+ " type" : " Identifier" ,
310
+ " value" : " y" ,
311
+ },
312
+ Object {
313
+ " loc" : Object {
314
+ " end" : Object {
315
+ " column" : 16 ,
316
+ " line" : 1 ,
317
+ },
318
+ " start" : Object {
319
+ " column" : 15 ,
320
+ " line" : 1 ,
321
+ },
322
+ },
323
+ " range" : Array [
324
+ 15 ,
325
+ 16 ,
326
+ ],
327
+ " type" : " Punctuator" ,
328
+ " value" : " ." ,
329
+ },
330
+ Object {
331
+ " loc" : Object {
332
+ " end" : Object {
333
+ " column" : 17 ,
334
+ " line" : 1 ,
335
+ },
336
+ " start" : Object {
337
+ " column" : 16 ,
338
+ " line" : 1 ,
339
+ },
340
+ },
341
+ " range" : Array [
342
+ 16 ,
343
+ 17 ,
344
+ ],
345
+ " type" : " Identifier" ,
346
+ " value" : " z" ,
347
+ },
348
+ Object {
349
+ " loc" : Object {
350
+ " end" : Object {
351
+ " column" : 18 ,
352
+ " line" : 1 ,
353
+ },
354
+ " start" : Object {
355
+ " column" : 17 ,
356
+ " line" : 1 ,
357
+ },
358
+ },
359
+ " range" : Array [
360
+ 17 ,
361
+ 18 ,
362
+ ],
363
+ " type" : " Punctuator" ,
364
+ " value" : " <" ,
365
+ },
366
+ Object {
367
+ " loc" : Object {
368
+ " end" : Object {
369
+ " column" : 19 ,
370
+ " line" : 1 ,
371
+ },
372
+ " start" : Object {
373
+ " column" : 18 ,
374
+ " line" : 1 ,
375
+ },
376
+ },
377
+ " range" : Array [
378
+ 18 ,
379
+ 19 ,
380
+ ],
381
+ " type" : " Identifier" ,
382
+ " value" : " w" ,
383
+ },
384
+ Object {
385
+ " loc" : Object {
386
+ " end" : Object {
387
+ " column" : 20 ,
388
+ " line" : 1 ,
389
+ },
390
+ " start" : Object {
391
+ " column" : 19 ,
392
+ " line" : 1 ,
393
+ },
394
+ },
395
+ " range" : Array [
396
+ 19 ,
397
+ 20 ,
398
+ ],
399
+ " type" : " Punctuator" ,
400
+ " value" : " >" ,
401
+ },
402
+ Object {
403
+ " loc" : Object {
404
+ " end" : Object {
405
+ " column" : 21 ,
406
+ " line" : 1 ,
407
+ },
408
+ " start" : Object {
409
+ " column" : 20 ,
410
+ " line" : 1 ,
411
+ },
412
+ },
413
+ " range" : Array [
414
+ 20 ,
415
+ 21 ,
416
+ ],
417
+ " type" : " Punctuator" ,
418
+ " value" : " ;" ,
419
+ },
420
+ ],
421
+ " type" : " Program" ,
422
+ }
423
+ ` ;
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ Object {
108
108
17 ,
109
109
],
110
110
" type" : " TSTypeQuery" ,
111
+ " typeParameters" : undefined ,
111
112
},
112
113
},
113
114
},
You can’t perform that action at this time.
0 commit comments