Skip to content

Commit

Permalink
Remove unused `convertPropertiesForEnclosingClass" (#8618)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarocque authored Nov 5, 2024
1 parent caf3090 commit 274e9a5
Showing 1 changed file with 0 additions and 55 deletions.
55 changes: 0 additions & 55 deletions repo-scripts/prune-dts/prune-dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,61 +268,6 @@ function prunePrivateImports<
}
}

/**
* Iterates over the provided symbols and returns named declarations for these
* symbols if they are missing from `currentClass`. This allows us to merge
* class hierarchies for classes whose inherited types are not part of the
* public API.
*
* This method relies on a private API in TypeScript's `codefix` package.
*/
function convertPropertiesForEnclosingClass(
program: ts.Program,
host: ts.CompilerHost,
sourceFile: ts.SourceFile,
parentClassSymbols: ts.Symbol[],
currentClass: ts.ClassDeclaration
): ts.ClassElement[] {
const newMembers: ts.ClassElement[] = [];
// The `codefix` package is not public but it does exactly what we want. It's
// the same package that is used by VSCode to fill in missing members, which
// is what we are using it for in this script. `codefix` handles missing
// properties, methods and correctly deduces generics.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(ts as any).codefix.createMissingMemberNodes(
currentClass,
parentClassSymbols,
sourceFile,
{ program, host },
/* userPreferences= */ {},
/* importAdder= */ undefined,
(missingMember: ts.ClassElement) => {
const originalSymbol = parentClassSymbols.find(
symbol =>
symbol.escapedName ==
(missingMember.name as ts.Identifier).escapedText
);
if (originalSymbol) {
const jsDocComment = extractJSDocComment(originalSymbol, newMembers);
if (jsDocComment) {
ts.setSyntheticLeadingComments(missingMember, [
{
kind: ts.SyntaxKind.MultiLineCommentTrivia,
text: `*\n${jsDocComment}\n`,
hasTrailingNewLine: true,
pos: -1,
end: -1
}
]);
}

newMembers.push(missingMember);
}
}
);
return newMembers;
}

/**
* Iterates over the provided symbols and returns named declarations for these
* symbols if they are missing from `currentInterface`. This allows us to merge
Expand Down

0 comments on commit 274e9a5

Please sign in to comment.