(param, options = {}, allParams = [])
| 554 | } |
| 555 | |
| 556 | function generateParamDeclaration(param, options = {}, allParams = []) { |
| 557 | if (!param) return ''; |
| 558 | |
| 559 | const name = normalizeIdentifier(param.name); |
| 560 | |
| 561 | // Check if this is an object parameter that we can generate a better interface for |
| 562 | const objectInterface = generateObjectInterface(param, allParams, options); |
| 563 | |
| 564 | // Convert the type - should always be an object |
| 565 | let type = 'any'; |
| 566 | if (objectInterface) { |
| 567 | type = objectInterface; |
| 568 | } else if (param.type) { |
| 569 | type = convertTypeToTypeScript(param.type, options); |
| 570 | } |
| 571 | |
| 572 | const isOptional = param.optional; |
| 573 | |
| 574 | let prefix = ''; |
| 575 | if (param.rest) { |
| 576 | prefix = '...'; |
| 577 | } |
| 578 | |
| 579 | return `${prefix}${name}${isOptional ? '?' : ''}: ${type}`; |
| 580 | } |
| 581 | |
| 582 | function generateMethodDeclaration(method, options = {}) { |
| 583 | let output = ''; |
no test coverage detected