Skip to content

Commit 96a6d13

Browse files
committed
fix(document-exported): Ensure that document-exported does not document constructors separately
1 parent 355038d commit 96a6d13

File tree

5 files changed

+173
-101
lines changed

5 files changed

+173
-101
lines changed

lib/extractors/exported.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ function traverseExportedSubtree(path, data, addComments, overrideName) {
165165
path.skip();
166166
},
167167
Method(path) {
168-
addComments(data, path);
168+
// Don't explicitly document constructor methods: their
169+
// parameters are output as part of the class itself.
170+
if (path.node.kind !== 'constructor') {
171+
addComments(data, path);
172+
}
169173
path.skip();
170174
}
171175
});

test/fixture/document-exported.input.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Options: {"documentExported": true}
22

33
export class Class {
4+
constructor(a: string) {}
45
classMethod() {}
56
get classGetter() {}
67
set classSetter(v) {}

0 commit comments

Comments
 (0)