@@ -15,29 +15,24 @@ export function parseTSFile({
15
15
16
16
//? Loop over all the export declarations
17
17
for ( const [ name , declarations ] of file . getExportedDeclarations ( ) ) {
18
- // todo handle this
19
- if ( declarations . length > 1 ) {
20
- throw new Error (
21
- `Multiple declarations are not handled yet, please file issue " ${ file_name } "` ,
22
- )
23
- }
24
-
25
- const [ declaration ] = declarations
18
+ for ( const declaration of declarations ) {
19
+ const tsdoc_node_parent = declaration . getFirstChildIfKind ( ts . SyntaxKind . JSDoc )
20
+ ? //? Check whether the declaration has a comment
21
+ declaration
22
+ : //? Find the comment by traversing up the parent, this should be safe here
23
+ declaration
24
+ . getAncestors ( )
25
+ . find ( ( ancestor ) => ! ! ancestor . getFirstChildIfKind ( ts . SyntaxKind . JSDoc ) )
26
26
27
- const tsdoc_node_parent = declaration . getFirstChildIfKind ( ts . SyntaxKind . JSDoc )
28
- ? //? Check whether the declaration has a comment
29
- declaration
30
- : //? Find the comment by traversing up the parent, this should be safe here
31
- declaration
32
- . getAncestors ( )
33
- . find ( ( ancestor ) => ! ! ancestor . getFirstChildIfKind ( ts . SyntaxKind . JSDoc ) )
34
-
35
- export_bits . push ( {
36
- name,
37
- type : getType ( declaration ) ,
38
- isDefaultExport : name == 'default' ,
39
- comment : tsdoc_node_parent ? parseCommentFromNode ( tsdoc_node_parent , tsdoc ) : undefined ,
40
- } )
27
+ export_bits . push ( {
28
+ name,
29
+ type : getType ( declaration ) ,
30
+ isDefaultExport : name == 'default' ,
31
+ comment : tsdoc_node_parent
32
+ ? parseCommentFromNode ( tsdoc_node_parent , tsdoc )
33
+ : undefined ,
34
+ } )
35
+ }
41
36
}
42
37
43
38
return {
0 commit comments