mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-30 04:16:48 -05:00
don't apply refactor when parameter has decorators
This commit is contained in:
@@ -142,7 +142,7 @@ namespace ts.refactor.convertToNamedParameters {
|
||||
}
|
||||
|
||||
function isValidParameterDeclaration(paramDeclaration: ParameterDeclaration): paramDeclaration is ValidParameterDeclaration {
|
||||
return !paramDeclaration.modifiers && isIdentifier(paramDeclaration.name);
|
||||
return !paramDeclaration.modifiers && !paramDeclaration.decorators && isIdentifier(paramDeclaration.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,5 +361,6 @@ namespace ts.refactor.convertToNamedParameters {
|
||||
interface ValidParameterDeclaration extends ParameterDeclaration {
|
||||
name: Identifier;
|
||||
modifiers: undefined;
|
||||
decorators: undefined;
|
||||
}
|
||||
}
|
||||
11
tests/cases/fourslash/refactorConvertToNamedParameters30.ts
Normal file
11
tests/cases/fourslash/refactorConvertToNamedParameters30.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////declare function required(target: Object, propertyKey: string | symbol, parameterIndex: number)
|
||||
////class C {
|
||||
//// /*a*/bar/*b*/(@required a: number, b: number) {
|
||||
////
|
||||
//// }
|
||||
////}
|
||||
|
||||
goTo.select("a", "b");
|
||||
verify.not.refactorAvailable("Convert to named parameters");
|
||||
Reference in New Issue
Block a user