Fixed "Delete all unused declarations" to delete self-referential functions (#60888)

This commit is contained in:
Mateusz Burzyński
2025-01-18 07:11:41 +01:00
committed by GitHub
parent 0745e6a0e0
commit 8da951cbb6
2 changed files with 21 additions and 0 deletions

View File

@@ -200,6 +200,9 @@ registerCodeFix({
else if (canDeleteEntireVariableStatement(sourceFile, token)) {
deleteEntireVariableStatement(changes, sourceFile, token.parent as VariableDeclarationList);
}
else if (isIdentifier(token) && isFunctionDeclaration(token.parent)) {
deleteFunctionLikeDeclaration(changes, sourceFile, token.parent as FunctionLikeDeclaration);
}
else {
tryDeleteDeclaration(sourceFile, token, changes, checker, sourceFiles, program, cancellationToken, /*isFixAll*/ true);
}