@@ -767,8 +767,8 @@ namespace ts.codefix {
767767 return inferences . filter ( i => toRemove . every ( f => ! f ( i ) ) ) ;
768768 }
769769
770- function unifyTypes ( inferences : ReadonlyArray < Type > , fallback = checker . getAnyType ( ) ) : Type {
771- if ( ! inferences . length ) return fallback ;
770+ function unifyTypes ( inferences : ReadonlyArray < Type > ) : Type {
771+ if ( ! inferences . length ) return checker . getAnyType ( ) ;
772772
773773 // 1. string or number individually override string | number
774774 // 2. non-any, non-void overrides any or void
@@ -874,11 +874,11 @@ namespace ts.codefix {
874874 }
875875
876876 if ( usage . calls ) {
877- callSignatures . push ( getSignatureFromCalls ( usage . calls , checker . getAnyType ( ) ) ) ;
877+ callSignatures . push ( getSignatureFromCalls ( usage . calls ) ) ;
878878 }
879879
880880 if ( usage . constructs ) {
881- constructSignatures . push ( getSignatureFromCalls ( usage . constructs , checker . getAnyType ( ) ) ) ;
881+ constructSignatures . push ( getSignatureFromCalls ( usage . constructs ) ) ;
882882 }
883883
884884 if ( usage . stringIndex ) {
@@ -1047,10 +1047,10 @@ namespace ts.codefix {
10471047 }
10481048
10491049 function getFunctionFromCalls ( calls : CallUsage [ ] ) {
1050- return checker . createAnonymousType ( undefined ! , createSymbolTable ( ) , [ getSignatureFromCalls ( calls , checker . getAnyType ( ) ) ] , emptyArray , undefined , undefined ) ;
1050+ return checker . createAnonymousType ( undefined ! , createSymbolTable ( ) , [ getSignatureFromCalls ( calls ) ] , emptyArray , undefined , undefined ) ;
10511051 }
10521052
1053- function getSignatureFromCalls ( calls : CallUsage [ ] , fallbackReturn : Type ) : Signature {
1053+ function getSignatureFromCalls ( calls : CallUsage [ ] ) : Signature {
10541054 const parameters : Symbol [ ] = [ ] ;
10551055 const length = Math . max ( ...calls . map ( c => c . argumentTypes . length ) ) ;
10561056 for ( let i = 0 ; i < length ; i ++ ) {
@@ -1061,7 +1061,7 @@ namespace ts.codefix {
10611061 }
10621062 parameters . push ( symbol ) ;
10631063 }
1064- const returnType = unifyTypes ( inferFromUsage ( combineUsages ( calls . map ( call => call . return_ ) ) ) , fallbackReturn ) ;
1064+ const returnType = unifyTypes ( inferFromUsage ( combineUsages ( calls . map ( call => call . return_ ) ) ) ) ;
10651065 // TODO: GH#18217
10661066 return checker . createSignature ( /*declaration*/ undefined ! , /*typeParameters*/ undefined , /*thisParameter*/ undefined , parameters , returnType , /*typePredicate*/ undefined , length , /*hasRestParameter*/ false , /*hasLiteralTypes*/ false ) ;
10671067 }
0 commit comments