@@ -93,15 +93,15 @@ namespace ts.codefix {
93
93
// TODO: get parameters working.
94
94
// TODO: add support for type parameters.
95
95
const signature = signatures [ 0 ] ;
96
- const signatureParts = getSignatureParts ( signature ) ;
96
+ const signatureParts = checker . createSignatureParts ( signature ) ;
97
97
return createStubbedMethod ( modifiers , name , optional , signatureParts . typeParameters , signatureParts . parameters , signatureParts . type ) ;
98
98
}
99
99
100
100
let signatureDeclarations = [ ] ;
101
101
for ( let i = 0 ; i < signatures . length ; i ++ ) {
102
102
// TODO: make signatures instead of methods
103
103
const signature = signatures [ i ] ;
104
- const signatureParts = getSignatureParts ( signature ) ;
104
+ const signatureParts = checker . createSignatureParts ( signature ) ;
105
105
signatureDeclarations . push ( createMethod (
106
106
/*decorators*/ undefined
107
107
, modifiers
@@ -116,7 +116,7 @@ namespace ts.codefix {
116
116
117
117
if ( declarations . length > signatures . length ) {
118
118
let signature = checker . getSignatureFromDeclaration ( declarations [ declarations . length - 1 ] as SignatureDeclaration ) ;
119
- const signatureParts = getSignatureParts ( signature ) ;
119
+ const signatureParts = checker . createSignatureParts ( signature ) ;
120
120
signatureDeclarations . push ( createStubbedMethod ( modifiers , name , optional , signatureParts . typeParameters , signatureParts . parameters , signatureParts . type ) ) ;
121
121
}
122
122
else {
@@ -128,20 +128,6 @@ namespace ts.codefix {
128
128
default :
129
129
return undefined ;
130
130
}
131
-
132
- type SignatureParts = {
133
- typeParameters : TypeParameterDeclaration [ ] ;
134
- parameters : ParameterDeclaration [ ] ;
135
- type : TypeNode ;
136
- }
137
-
138
- function getSignatureParts ( signature : Signature ) : SignatureParts {
139
- return {
140
- typeParameters : signature . typeParameters && signature . typeParameters . map ( checker . createTypeParameterDeclarationFromType ) ,
141
- parameters : signature . getParameters ( ) . map ( symbol => checker . createParameterDeclarationFromSymbol ( symbol ) ) ,
142
- type : createTypeNodeExceptAny ( checker . getReturnTypeOfSignature ( signature ) , checker )
143
- }
144
- }
145
131
}
146
132
147
133
function createMethodImplementingSignatures ( signatures : Signature [ ] , name : PropertyName , optional : boolean , modifiers : Modifier [ ] | undefined ) : MethodDeclaration {
@@ -234,9 +220,4 @@ namespace ts.codefix {
234
220
}
235
221
return undefined ;
236
222
}
237
-
238
- function createTypeNodeExceptAny ( type : Type , checker : TypeChecker ) {
239
- const typeNode = checker . createTypeNode ( type ) ;
240
- return typeNode && typeNode . kind !== SyntaxKind . AnyKeyword ? typeNode : undefined ;
241
- }
242
223
}
0 commit comments