@@ -70,11 +70,6 @@ namespace ts.codefix {
70
70
return undefined ;
71
71
}
72
72
73
- const containingFunction = getContainingFunction ( token ) ;
74
- if ( containingFunction === undefined ) {
75
- // Possible in certain syntax error cases
76
- return undefined ;
77
- }
78
73
switch ( errorCode ) {
79
74
// Variable and Property declarations
80
75
case Diagnostics . Member_0_implicitly_has_an_1_type . code :
@@ -85,6 +80,13 @@ namespace ts.codefix {
85
80
const symbol = program . getTypeChecker ( ) . getSymbolAtLocation ( token ) ;
86
81
return symbol && symbol . valueDeclaration && getCodeActionForVariableDeclaration ( < VariableDeclaration > symbol . valueDeclaration , sourceFile , program , cancellationToken ) ;
87
82
}
83
+ }
84
+
85
+ const containingFunction = getContainingFunction ( token ) ;
86
+ if ( containingFunction === undefined ) {
87
+ return undefined ;
88
+ }
89
+ switch ( errorCode ) {
88
90
89
91
// Parameter declarations
90
92
case Diagnostics . Parameter_0_implicitly_has_an_1_type . code :
@@ -156,7 +158,7 @@ namespace ts.codefix {
156
158
if ( containingFunction . parameters . length !== types . length ) {
157
159
return undefined ;
158
160
}
159
-
161
+
160
162
const textChanges = arrayFrom ( mapDefinedIterator ( zipToIterator ( containingFunction . parameters , types ) , ( [ parameter , type ] ) =>
161
163
type && ! parameter . type && ! parameter . initializer ? makeChange ( containingFunction , parameter . end , type , program ) : undefined ) ) ;
162
164
return textChanges . length ? { declaration : parameterDeclaration , textChanges } : undefined ;
0 commit comments