Skip to content

Commit

Permalink
Find comments on index signatures
Browse files Browse the repository at this point in the history
Resolves #2414
  • Loading branch information
Gerrit0 committed Oct 21, 2023
1 parent 22fe25c commit 9fbeeab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/converter/factories/index-signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function convertIndexSignature(context: Context, symbol: ts.Symbol) {
ReflectionKind.IndexSignature,
context.scope,
);
index.comment = context.getComment(indexSymbol, index.kind);
index.parameters = [
new ParameterReflection(
param.name.getText(),
Expand Down
4 changes: 4 additions & 0 deletions src/test/converter2/issues/gh2414.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ObjectWithIndexSignature {
/** Index comment. */
[x: string]: any;
}
11 changes: 11 additions & 0 deletions src/test/issues.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1185,4 +1185,15 @@ describe("Issue Tests", () => {
"Comment for module",
);
});

it("Includes index signature comments #2414", () => {
const project = convert();
equal(
Comment.combineDisplayParts(
query(project, "ObjectWithIndexSignature").indexSignature
?.comment?.summary,
),
"Index comment.",
);
});
});

0 comments on commit 9fbeeab

Please sign in to comment.