Skip to content

Commit

Permalink
fix(js): Pick up doc comments for properties declared within a class'…
Browse files Browse the repository at this point in the history
…s constructor

Resolves #1255
  • Loading branch information
Gerrit0 committed Jun 1, 2021
1 parent e125484 commit 700d413
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/converter/converter.ts
Expand Up @@ -205,6 +205,7 @@ export class Converter extends ChildableComponent<
ts.SyntaxKind.PropertyDeclaration,
ts.SyntaxKind.PropertySignature,
ts.SyntaxKind.JSDocPropertyTag,
ts.SyntaxKind.BinaryExpression,
],
[ReflectionKind.Method]: [
ts.SyntaxKind.MethodDeclaration,
Expand Down
7 changes: 6 additions & 1 deletion src/test/converter2.test.ts
Expand Up @@ -56,6 +56,11 @@ const issueTests: Record<string, (project: ProjectReflection) => void> = {
equal(refl.signatures?.[0]?.comment?.returns, "Test description.\n");
},

gh1255(project) {
const foo = query(project, "C.foo");
equal(foo.comment?.shortText, "Docs!");
},

gh1330(project) {
const example = query(project, "ExampleParam");
equal(example?.type?.type, "reference");
Expand Down Expand Up @@ -220,7 +225,7 @@ describe("Converter2", () => {
});

let program: ts.Program;
it("Compiles", () => {
before("Compiles", () => {
program = ts.createProgram(
app.options.getFileNames(),
app.options.getCompilerOptions()
Expand Down
9 changes: 9 additions & 0 deletions src/test/converter2/issues/gh1255.js
@@ -0,0 +1,9 @@
export class C {
constructor() {
/**
* Docs!
* @type {number}
*/
this.foo = 123;
}
}

0 comments on commit 700d413

Please sign in to comment.