Skip to content

Commit ca5d5e6

Browse files
committed
Fix excludeNotDocumented on arrow functions
Resolves #2156
1 parent f838e11 commit ca5d5e6

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
### Bug Fixes
1616

1717
- Entry points under `node_modules` will no longer be ignored, #2151.
18+
- Corrected behavior of `excludeNotDocumented` on arrow function-variables, #2156.
1819
- Added `package.json` to exports declaration.
1920

2021
### Thanks!

src/lib/converter/plugins/CommentPlugin.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,18 @@ export class CommentPlugin extends ConverterComponent {
464464
}
465465

466466
if (!comment) {
467+
// We haven't moved comments from the parent for signatures without a direct
468+
// comment, so don't exclude those due to not being documented.
469+
if (
470+
reflection.kindOf(
471+
ReflectionKind.CallSignature |
472+
ReflectionKind.ConstructorSignature
473+
) &&
474+
reflection.parent?.comment
475+
) {
476+
return false;
477+
}
478+
467479
if (this.excludeNotDocumented) {
468480
// Don't let excludeNotDocumented remove parameters.
469481
if (

src/test/converter2/issues/gh2156.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Is documented
3+
*/
4+
export const foo = (foo: string): boolean => {
5+
return true;
6+
};

src/test/issueTests.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function query(project: ProjectReflection, name: string) {
2929
}
3030

3131
export const issueTests: {
32-
[issue: `pre${string}`]: (app: Application) => void;
33-
[issue: `gh${string}`]: (
32+
[issue: `pre${bigint}${string}`]: (app: Application) => void;
33+
[issue: `gh${bigint}${string}`]: (
3434
project: ProjectReflection,
3535
logger: TestLogger
3636
) => void;
@@ -836,4 +836,16 @@ export const issueTests: {
836836
"One"
837837
);
838838
},
839+
840+
pre2156(app) {
841+
app.options.setValue("excludeNotDocumented", true);
842+
},
843+
gh2156(project) {
844+
const foo = query(project, "foo");
845+
equal(foo.signatures?.length, 1);
846+
equal(
847+
Comment.combineDisplayParts(foo.signatures[0].comment?.summary),
848+
"Is documented"
849+
);
850+
},
839851
};

0 commit comments

Comments
 (0)