Skip to content

Commit 74b7e92

Browse files
committed
refactor: check for isHidden later
1 parent 3126e3c commit 74b7e92

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/extract-class.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,8 @@ async function extractClassConstructors(
5656
// Calling `getConstructors()` returns all constructors in ambient modules
5757
// but only the implementation constructor in normal modules.
5858
// We get the first constructor and then find all others starting from it.
59-
const declaration = classDeclaration.getConstructors()[0];
60-
if (!declaration) {
61-
// No constructors.
62-
return [];
63-
}
59+
const declaration = classDeclaration.getConstructors().at(0);
60+
if (!declaration) return [];
6461
const implementation = declaration.getImplementation();
6562
const constructorDeclarations = [
6663
...(implementation ? [implementation] : []),
@@ -111,7 +108,6 @@ async function extractClassProperties(
111108
const properties = [];
112109
for (const declaration of propertiesDeclarations) {
113110
if (
114-
isHidden(declaration) ||
115111
!(
116112
Node.isParameterDeclaration(declaration) ||
117113
Node.isPropertyDeclaration(declaration) ||
@@ -120,6 +116,7 @@ async function extractClassProperties(
120116
) {
121117
continue;
122118
}
119+
if (isHidden(declaration)) continue;
123120
const name = declaration.getName();
124121
properties.push({
125122
kind: "class-property" as const,
@@ -164,12 +161,12 @@ async function extractClassMethods(
164161
const methods = [];
165162
const seenMethods = new Set<string>();
166163
for (const declaration of methodsDeclarations) {
167-
if (isHidden(declaration)) continue;
168164
const name = declaration.getName();
169-
if (seenMethods.has(name)) {
170-
// Skip overloaded methods.
171-
continue;
172-
}
165+
166+
// Skip overloaded methods.
167+
if (seenMethods.has(name)) continue;
168+
if (isHidden(declaration)) continue;
169+
173170
seenMethods.add(name);
174171
methods.push({
175172
kind: "class-method" as const,

src/extract-interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ async function extractInterfaceMethods(
8989
const methods = [];
9090
const seenMethods = new Set<string>();
9191
for (const declaration of interfaceDeclaration.getMethods()) {
92-
if (isHidden(declaration)) continue;
9392
const name = declaration.getName();
9493

9594
// Skip overloaded methods.
9695
if (seenMethods.has(name)) continue;
96+
if (isHidden(declaration)) continue;
9797

9898
seenMethods.add(name);
9999
methods.push({

0 commit comments

Comments
 (0)