mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(47787): show QF to delete parameter in getter (#47797)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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() {}
|
||||
}`
|
||||
})
|
||||
Reference in New Issue
Block a user