Skip to content

Commit ded1b97

Browse files
committed
PR feedback
1 parent 79dddad commit ded1b97

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

apps/api-extractor/src/generators/packageTypings/AstSymbolTable.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export class AstSymbolTable {
283283

284284
// Is there a parent AstSymbol?
285285
const arbitaryParent: ts.Node | undefined
286-
= this._findFirstParentDeclaration(followedSymbol.declarations[0]);
286+
= this._tryFindFirstAstDeclarationParent(followedSymbol.declarations[0]);
287287

288288
let parentAstSymbol: AstSymbol | undefined = undefined;
289289

@@ -294,13 +294,12 @@ export class AstSymbolTable {
294294
}
295295

296296
// Okay, now while creating the declarations we will wire them up to the
297-
// their corresopnding parent declarations
297+
// their corresponding parent declarations
298298
for (const declaration of followedSymbol.declarations || []) {
299299

300300
let parentAstDeclaration: AstDeclaration | undefined = undefined;
301301
if (parentAstSymbol) {
302-
const parentDeclaration: ts.Node | undefined
303-
= this._findFirstParentDeclaration(declaration);
302+
const parentDeclaration: ts.Node | undefined = this._tryFindFirstAstDeclarationParent(declaration);
304303

305304
if (!parentDeclaration) {
306305
throw new Error('Program bug: Missing parent declaration');
@@ -326,7 +325,7 @@ export class AstSymbolTable {
326325
/**
327326
* Returns the first parent satisfying isAstDeclaration(), or undefined if none is found.
328327
*/
329-
private _findFirstParentDeclaration(node: ts.Node): ts.Node | undefined {
328+
private _tryFindFirstAstDeclarationParent(node: ts.Node): ts.Node | undefined {
330329
let currentNode: ts.Node | undefined = node.parent;
331330
while (currentNode) {
332331
if (this.isAstDeclaration(currentNode)) {

apps/api-extractor/src/generators/packageTypings/PackageTypingsGenerator.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export class PackageTypingsGenerator {
7676
}
7777

7878
// Build the entry point
79-
this._astEntryPoint = this._astSymbolTable.fetchEntryPoint(this._context.package.getDeclaration().getSourceFile());
79+
const sourceFile: ts.SourceFile = this._context.package.getDeclaration().getSourceFile();
80+
this._astEntryPoint = this._astSymbolTable.fetchEntryPoint(sourceFile);
8081

8182
const exportedAstSymbols: AstSymbol[] = [];
8283

@@ -199,7 +200,7 @@ export class PackageTypingsGenerator {
199200
dtsEntry.nameForEmit = dtsEntry.originalName;
200201

201202
while (usedNames.has(dtsEntry.nameForEmit)) {
202-
dtsEntry.nameForEmit = dtsEntry.originalName + '_' + ++suffix;
203+
dtsEntry.nameForEmit = `${dtsEntry.originalName}_${++suffix}`;
203204
}
204205

205206
usedNames.add(dtsEntry.nameForEmit);

0 commit comments

Comments
 (0)