File tree 4 files changed +21
-4
lines changed 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ namespace ts {
83
83
getSignaturesOfType,
84
84
getIndexTypeOfType,
85
85
getBaseTypes,
86
- getWidenedType ,
86
+ getBaseTypeOfLiteralType ,
87
87
getTypeFromTypeNode,
88
88
getParameterType: getTypeAtPosition,
89
89
getReturnTypeOfSignature,
Original file line number Diff line number Diff line change 2382
2382
getSignaturesOfType ( type : Type , kind : SignatureKind ) : Signature [ ] ;
2383
2383
getIndexTypeOfType ( type : Type , kind : IndexKind ) : Type ;
2384
2384
getBaseTypes ( type : InterfaceType ) : BaseType [ ] ;
2385
- getWidenedType ( type : Type ) : Type ;
2385
+ getBaseTypeOfLiteralType ( type : Type ) : Type ;
2386
2386
getReturnTypeOfSignature ( signature : Signature ) : Type ;
2387
2387
/**
2388
2388
* 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 {
30
30
31
31
// if function call, synthesize function declaration
32
32
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
+
33
49
34
50
}
35
51
@@ -41,8 +57,8 @@ namespace ts.codefix {
41
57
binaryExpression . operatorToken ;
42
58
43
59
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 ) ;
46
62
}
47
63
48
64
return [ {
Original file line number Diff line number Diff line change 78
78
" formatting/smartIndenter.ts" ,
79
79
" formatting/tokenRange.ts" ,
80
80
" codeFixProvider.ts" ,
81
+ " codefixes/fixAddMissingMember.ts" ,
81
82
" codefixes/fixExtendsInterfaceBecomesImplements.ts" ,
82
83
" codefixes/fixClassIncorrectlyImplementsInterface.ts" ,
83
84
" codefixes/fixClassDoesntImplementInheritedAbstractMember.ts" ,
You can’t perform that action at this time.
0 commit comments