@@ -47,20 +47,14 @@ export const renameParameterToNameFromType = {
47
47
tryToApply ( sourceFile , position , range , node , formatOptions , languageService ) {
48
48
if ( ! node || ! position ) return
49
49
const functionSignature = node . parent . parent
50
- if (
51
- ! ts . isIdentifier ( node ) ||
52
- ! ts . isParameter ( node . parent ) ||
53
- ! ts . isFunctionLike ( functionSignature ) ||
54
- ! ts . isVariableDeclaration ( functionSignature . parent )
55
- )
56
- return
50
+ if ( ! ts . isIdentifier ( node ) || ! ts . isParameter ( node . parent ) || ! ts . isFunctionLike ( functionSignature ) ) return
57
51
const { parent : functionDecl , parameters : functionParameters } = functionSignature
58
52
59
53
const parameterIndex = functionParameters . indexOf ( node . parent )
60
54
const parameterName = functionParameters [ parameterIndex ] ! . name . getText ( )
61
55
const typeParamName = getTypeParamName ( parameterName , functionParameters . indexOf ( node . parent ) , functionDecl , languageService )
62
56
if ( ! typeParamName ) return
63
- this . name = `Rename Parameter to Name from Type '${ functionDecl . type ! . getText ( ) } ' `
57
+ this . name = `Rename Parameter to Name from Type ( '${ typeParamName } ') `
64
58
if ( ! formatOptions ) return true
65
59
66
60
const edits = compact ( getEdits ( sourceFile . fileName , position , typeParamName , languageService ) )
@@ -95,7 +89,8 @@ export const renameAllParametersToNameFromType = {
95
89
96
90
if ( paramsToRename . length < 2 ) return
97
91
98
- this . name = `Rename All Parameters to Name from Type '${ functionDecl . type ! . getText ( ) } '`
92
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
93
+ this . name = `Rename All Parameters to Name from Type '${ functionDecl . type ?. getText ( ) } '`
99
94
if ( ! formatOptions ) return true
100
95
101
96
const edits = compact (
0 commit comments