Skip to content

Commit 05c5279

Browse files
Shannon Pooletmcw
authored andcommitted
feat: add support for class param declarations at the constructor (#1013)
1 parent 647fdf4 commit 05c5279

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/infer/params.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ function inferParams(comment: Comment) {
5252

5353
function inferAndCombineParams(params, comment) {
5454
const inferredParams = params.map((param, i) => paramToDoc(param, '', i));
55-
const mergedParamsAndErrors = mergeTrees(inferredParams, comment.params);
55+
const paramsToMerge = comment.params;
56+
if (comment.constructorComment) {
57+
paramsToMerge.push.apply(paramsToMerge, comment.constructorComment.params);
58+
}
59+
const mergedParamsAndErrors = mergeTrees(inferredParams, paramsToMerge);
5660

5761
// Then merge the trees. This is the hard part.
5862
return Object.assign(comment, {

src/parsers/javascript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function _addComment(
103103

104104
if (t.isClassMethod(path) && path.node.kind === 'constructor') {
105105
// #689
106-
if (!comment.hideconstructor) {
106+
if (comment.tags.some(tag => tag.title !== 'param' && tag.title !== 'hideconstructor')) {
107107
debuglog(
108108
'A constructor was documented explicitly: document along with the class instead'
109109
);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy