@@ -240,7 +240,7 @@ namespace ts.codefix {
240240 }
241241
242242 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 ;
244244 const numberOfAssignmentsOriginal = 0 ;
245245 const identifier = numVarsSameName === 0 ? name : createIdentifier ( name . text + "_" + numVarsSameName ) ;
246246 return { identifier, types : [ ] , numberOfAssignmentsOriginal } ;
@@ -426,7 +426,7 @@ namespace ts.codefix {
426426
427427 if ( hasPrevArgName && ! shouldReturn ) {
428428 const type = transformer . checker . getTypeAtLocation ( func ) ;
429- const returnType = getLastCallSignature ( type , transformer . checker ) . getReturnType ( ) ;
429+ const returnType = getLastCallSignature ( type , transformer . checker ) ! . getReturnType ( ) ;
430430 const varDeclOrAssignment = createVariableDeclarationOrAssignment ( prevArgName ! , getSynthesizedDeepClone ( funcBody ) as Expression , transformer ) ;
431431 prevArgName ! . types . push ( returnType ) ;
432432 return varDeclOrAssignment ;
@@ -440,7 +440,7 @@ namespace ts.codefix {
440440 return createNodeArray ( [ ] ) ;
441441 }
442442
443- function getLastCallSignature ( type : Type , checker : TypeChecker ) : Signature {
443+ function getLastCallSignature ( type : Type , checker : TypeChecker ) : Signature | undefined {
444444 const callSignatures = type && checker . getSignaturesOfType ( type , SignatureKind . Call ) ;
445445 return callSignatures && callSignatures [ callSignatures . length - 1 ] ;
446446 }
0 commit comments