Skip to content

Commit 4fca9a4

Browse files
committed
docs: update comments
1 parent 812bfa8 commit 4fca9a4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/docs.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { Node, SyntaxKind } from "ts-morph";
22
import { parseDocComment } from "./parse-doc-comment.ts";
33

4+
/** `docs` returns a list of unique JSDoc comments that are closest to the node. */
45
export function docs(node: Node): string[] {
5-
return [
6-
// List of unique JSDoc comments that are closest to the node.
7-
...new Set(nodesWithDocs(node).flatMap((node) => lastDoc(node) ?? [])),
8-
];
6+
return [...new Set(nodesWithDocs(node).flatMap((node) => lastDoc(node) ?? []))];
97
}
108

119
function nodesWithDocs(node: Node): Node[] {

src/export-equals-declarations.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ export function exportEqualsDeclarations(
1111
): FoundDeclaration[] {
1212
// Shorthand ambient modules have no body and thus no declarations.
1313
if (isShorthandAmbientModule(container)) return [];
14+
15+
// Get the identifier from the export equals assignment (e.g., `export = foo`).
1416
const exportIdentifier = container
1517
.getExportAssignment((assignment) => assignment.isExportEquals())
1618
?.getLastChildByKind(SyntaxKind.Identifier);
1719
if (!exportIdentifier) return [];
20+
21+
// Get the declarations linked to the exported identifier.
1822
const exportName = exportIdentifier.getText();
1923
const exportEqualsDeclarations = [];
2024
for (const declaration of exportIdentifier.getDefinitionNodes()) {

0 commit comments

Comments
 (0)