fixUnusedIdentifier: Don't remove setter parameter (#22488)

This commit is contained in:
Andy
2018-03-12 16:07:20 -07:00
committed by GitHub
parent d3ede7b907
commit 83b438ffa6
2 changed files with 24 additions and 0 deletions

View File

@@ -142,6 +142,11 @@ namespace ts.codefix {
case SyntaxKind.Parameter:
const oldFunction = parent.parent;
if (isSetAccessor(oldFunction)) {
// Setter must have a parameter
break;
}
if (isArrowFunction(oldFunction) && oldFunction.parameters.length === 1) {
// Lambdas with exactly one parameter are special because, after removal, there
// must be an empty parameter list (i.e. `()`) and this won't necessarily be the