@@ -216,7 +216,9 @@ describe('getFlowType', () => {
216
216
} ) ;
217
217
218
218
it ( 'detects function signature type' , ( ) => {
219
- const typePath = expression ( 'x: (p1: number, p2: ?string) => boolean' )
219
+ const typePath = expression (
220
+ 'x: (p1: number, p2: ?string, ...rest: Array<string>) => boolean' ,
221
+ )
220
222
. get ( 'typeAnnotation' )
221
223
. get ( 'typeAnnotation' ) ;
222
224
expect ( getFlowType ( typePath ) ) . toEqual ( {
@@ -226,10 +228,19 @@ describe('getFlowType', () => {
226
228
arguments : [
227
229
{ name : 'p1' , type : { name : 'number' } } ,
228
230
{ name : 'p2' , type : { name : 'string' , nullable : true } } ,
231
+ {
232
+ name : 'rest' ,
233
+ rest : true ,
234
+ type : {
235
+ name : 'Array' ,
236
+ elements : [ { name : 'string' } ] ,
237
+ raw : 'Array<string>' ,
238
+ } ,
239
+ } ,
229
240
] ,
230
241
return : { name : 'boolean' } ,
231
242
} ,
232
- raw : '(p1: number, p2: ?string) => boolean' ,
243
+ raw : '(p1: number, p2: ?string, ...rest: Array<string> ) => boolean' ,
233
244
} ) ;
234
245
} ) ;
235
246
@@ -265,6 +276,7 @@ describe('getFlowType', () => {
265
276
raw : 'string => boolean' ,
266
277
} ) ;
267
278
} ) ;
279
+
268
280
it ( 'detects callable signature type' , ( ) => {
269
281
const typePath = expression ( 'x: { (str: string): string, token: string }' )
270
282
. get ( 'typeAnnotation' )
0 commit comments