fix(47787): show QF to delete parameter in getter (#47797)

This commit is contained in:
Oleksandr T
2022-02-08 13:39:54 -08:00
committed by GitHub
parent c5b1011e94
commit c06849ad16
3 changed files with 23 additions and 0 deletions
@@ -316,6 +316,10 @@ namespace ts.codefix {
// Setter must have a parameter
return false;
case SyntaxKind.GetAccessor:
// Getter cannot have parameters
return true;
default:
return Debug.failBadSyntaxKind(parent);
}
+2
View File
@@ -432,6 +432,8 @@ namespace ts.formatting {
case SyntaxKind.ConstructorType:
case SyntaxKind.ConstructSignature:
return getList((node as SignatureDeclaration).typeParameters) || getList((node as SignatureDeclaration).parameters);
case SyntaxKind.GetAccessor:
return getList((node as GetAccessorDeclaration).parameters);
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.InterfaceDeclaration:
@@ -0,0 +1,17 @@
/// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
////let foo = {
//// get x(/**/param) {}
////}
verify.codeFix({
description: "Remove unused declaration for: 'param'",
index: 0,
newFileContent:
`let foo = {
get x() {}
}`
})