File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -172,9 +172,9 @@ namespace ts.codefix {
172
172
173
173
// if the identifier refers to a function we want to add the new synthesized variable for the declaration (ex. blob in let blob = res(arg))
174
174
// Note - the choice of the last call signature is arbitrary
175
- if ( lastCallSignature && lastCallSignature . parameters . length && ! synthNamesMap . has ( symbolIdString ) ) {
176
- const firstParameter = lastCallSignature . parameters [ 0 ] ;
177
- const ident = isParameter ( firstParameter . valueDeclaration ) && tryCast ( firstParameter . valueDeclaration . name , isIdentifier ) || createOptimisticUniqueName ( "result" ) ;
175
+ if ( lastCallSignature && ! synthNamesMap . has ( symbolIdString ) ) {
176
+ const firstParameter = firstOrUndefined ( lastCallSignature . parameters ) ;
177
+ const ident = firstParameter && isParameter ( firstParameter . valueDeclaration ) && tryCast ( firstParameter . valueDeclaration . name , isIdentifier ) || createOptimisticUniqueName ( "result" ) ;
178
178
const synthName = getNewNameIfConflict ( ident , collidingSymbolMap ) ;
179
179
synthNamesMap . set ( symbolIdString , synthName ) ;
180
180
allVarNames . push ( { identifier : synthName . identifier , symbol } ) ;
You can’t perform that action at this time.
0 commit comments