File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ namespace ts {
8383 getSignaturesOfType,
8484 getIndexTypeOfType,
8585 getBaseTypes,
86-  getWidenedType ,
86+  getBaseTypeOfLiteralType ,
8787 getTypeFromTypeNode,
8888 getParameterType: getTypeAtPosition,
8989 getReturnTypeOfSignature,
Original file line number Diff line number Diff line change 23822382 getSignaturesOfType ( type : Type ,  kind : SignatureKind ) : Signature [ ] ; 
23832383 getIndexTypeOfType ( type : Type ,  kind : IndexKind ) : Type ; 
23842384 getBaseTypes ( type : InterfaceType ) : BaseType [ ] ; 
2385-  getWidenedType ( type : Type ) : Type ; 
2385+  getBaseTypeOfLiteralType ( type : Type ) : Type ; 
23862386 getReturnTypeOfSignature ( signature : Signature ) : Type ; 
23872387 /** 
23882388 * Gets the type of a parameter at a given position in a signature. 
Original file line number Diff line number Diff line change @@ -30,6 +30,22 @@ namespace ts.codefix {
3030
3131 // if function call, synthesize function declaration 
3232 if ( token . parent . parent . kind  ==  SyntaxKind . CallExpression )  { 
33+  const  callExpression  =  token . parent . parent  as  CallExpression ; 
34+  if ( callExpression . typeArguments )  { 
35+  /** 
36+  * We can't in general know which arguments should use the type of the expression 
37+  * or the type of the type argument in the declaration. Consider 
38+  * ``` 
39+  * class A { 
40+  * constructor(a: number){ 
41+  * this.foo<number>(a,1,true); 
42+  * } 
43+  * } 
44+  * ``` 
45+  */ 
46+  return  undefined ; 
47+  } 
48+ 
3349
3450 } 
3551
@@ -41,8 +57,8 @@ namespace ts.codefix {
4157 binaryExpression . operatorToken ; 
4258
4359 const  checker  =  context . program . getTypeChecker ( ) ; 
44-  const  type  =  checker . getWidenedType ( checker . getTypeAtLocation ( binaryExpression . right ) ) ; 
45-  typeString  =  checker . typeToString ( type ) ; 
60+  const  widenedType  =  checker . getBaseTypeOfLiteralType ( checker . getTypeAtLocation ( binaryExpression . right ) ) ; 
61+  typeString  =  checker . typeToString ( widenedType ) ; 
4662 } 
4763
4864 return  [ { 
Original file line number Diff line number Diff line change 7878 " formatting/smartIndenter.ts"  ,
7979 " formatting/tokenRange.ts"  ,
8080 " codeFixProvider.ts"  ,
81+  " codefixes/fixAddMissingMember.ts"  ,
8182 " codefixes/fixExtendsInterfaceBecomesImplements.ts"  ,
8283 " codefixes/fixClassIncorrectlyImplementsInterface.ts"  ,
8384 " codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"  ,
                                 You can’t perform that action at this time. 
               
                  
0 commit comments