@@ -240,7 +240,7 @@ namespace ts.codefix {
240
240
}
241
241
242
242
function getNewNameIfConflict ( name : Identifier , allVarNames : SymbolAndIdentifier [ ] ) : SynthIdentifier {
243
- const numVarsSameName = allVarNames . filter ( elem => elem . identifier . text === name . text ) . length ;
243
+ const numVarsSameName = allVarNames . filter ( elem => elem . symbol . name === name . text ) . length ;
244
244
const numberOfAssignmentsOriginal = 0 ;
245
245
const identifier = numVarsSameName === 0 ? name : createIdentifier ( name . text + "_" + numVarsSameName ) ;
246
246
return { identifier, types : [ ] , numberOfAssignmentsOriginal } ;
@@ -426,7 +426,7 @@ namespace ts.codefix {
426
426
427
427
if ( hasPrevArgName && ! shouldReturn ) {
428
428
const type = transformer . checker . getTypeAtLocation ( func ) ;
429
- const returnType = getLastCallSignature ( type , transformer . checker ) . getReturnType ( ) ;
429
+ const returnType = getLastCallSignature ( type , transformer . checker ) ! . getReturnType ( ) ;
430
430
const varDeclOrAssignment = createVariableDeclarationOrAssignment ( prevArgName ! , getSynthesizedDeepClone ( funcBody ) as Expression , transformer ) ;
431
431
prevArgName ! . types . push ( returnType ) ;
432
432
return varDeclOrAssignment ;
@@ -440,7 +440,7 @@ namespace ts.codefix {
440
440
return createNodeArray ( [ ] ) ;
441
441
}
442
442
443
- function getLastCallSignature ( type : Type , checker : TypeChecker ) : Signature {
443
+ function getLastCallSignature ( type : Type , checker : TypeChecker ) : Signature | undefined {
444
444
const callSignatures = type && checker . getSignaturesOfType ( type , SignatureKind . Call ) ;
445
445
return callSignatures && callSignatures [ callSignatures . length - 1 ] ;
446
446
}
0 commit comments