@@ -286,7 +286,8 @@ function generateDeclarationFile(items, organizedData) {
286
286
params : ( entry . params || [ ] ) . map ( param => ( {
287
287
name : param . name ,
288
288
type : generateTypeFromTag ( param ) ,
289
- optional : param . type ?. type === 'OptionalType'
289
+ optional : param . type ?. type === 'OptionalType' ,
290
+ rest : param . type ?. type === 'RestType'
290
291
} ) ) ,
291
292
module,
292
293
submodule,
@@ -307,9 +308,14 @@ function generateDeclarationFile(items, organizedData) {
307
308
params : ( entry . params || [ ] ) . map ( param => ( {
308
309
name : param . name ,
309
310
type : generateTypeFromTag ( param ) ,
310
- optional : param . type ?. type === 'OptionalType'
311
+ optional : param . type ?. type === 'OptionalType' ,
312
+ rest : param . type ?. type === 'RestType'
311
313
} ) ) ,
312
- returnType : entry . returns ?. [ 0 ] ? generateTypeFromTag ( entry . returns [ 0 ] ) : 'void' ,
314
+ returnType : entry . tags ?. find ( tag => tag . title === "chainable" )
315
+ ? "this"
316
+ : entry . returns ?. [ 0 ]
317
+ ? generateTypeFromTag ( entry . returns [ 0 ] )
318
+ : 'void' ,
313
319
module,
314
320
submodule,
315
321
class : className ,
@@ -423,7 +429,7 @@ export function generateTypeFromTag(param) {
423
429
424
430
let type = param . type ;
425
431
let prefix = '' ;
426
- const isOptional = param . type ?. type === 'OptionalType' ;
432
+ const isOptional = param . optional || param . type ?. type === 'OptionalType' ;
427
433
if ( typeof type === 'string' ) {
428
434
type = normalizeTypeName ( type ) ;
429
435
} else if ( param . type ?. type ) {
@@ -432,7 +438,7 @@ export function generateTypeFromTag(param) {
432
438
type = 'any' ;
433
439
}
434
440
435
- if ( param . type ?. type === 'RestType' ) {
441
+ if ( param . rest || param . type ?. type === 'RestType' ) {
436
442
prefix = '...' ;
437
443
}
438
444
0 commit comments