@@ -11,7 +11,7 @@ namespace ts.codefix {
11
11
}
12
12
13
13
const changes = changeTracker . getChanges ( ) ;
14
- if ( ! ( changes && changes . length > 0 ) ) {
14
+ if ( ! some ( changes ) ) {
15
15
return changes ;
16
16
}
17
17
@@ -93,7 +93,7 @@ namespace ts.codefix {
93
93
// (eg: an abstract method or interface declaration), there is a 1-1
94
94
// correspondence of declarations and signatures.
95
95
const signatures = checker . getSignaturesOfType ( type , SignatureKind . Call ) ;
96
- if ( ! ( signatures && signatures . length > 0 ) ) {
96
+ if ( ! some ( signatures ) ) {
97
97
return undefined ;
98
98
}
99
99
@@ -103,7 +103,7 @@ namespace ts.codefix {
103
103
return signatureToMethodDeclaration ( signature , enclosingDeclaration , createStubbedMethodBody ( ) ) ;
104
104
}
105
105
106
- const signatureDeclarations = [ ] ;
106
+ const signatureDeclarations : MethodDeclaration [ ] = [ ] ;
107
107
for ( let i = 0 ; i < signatures . length ; i ++ ) {
108
108
const signature = signatures [ i ] ;
109
109
const methodDeclaration = signatureToMethodDeclaration ( signature , enclosingDeclaration ) ;
@@ -132,6 +132,7 @@ namespace ts.codefix {
132
132
function signatureToMethodDeclaration ( signature : Signature , enclosingDeclaration : Node , body ?: Block ) {
133
133
const signatureDeclaration = < MethodDeclaration > checker . signatureToSignatureDeclaration ( signature , SyntaxKind . MethodDeclaration , enclosingDeclaration ) ;
134
134
if ( signatureDeclaration ) {
135
+ signatureDeclaration . decorators = undefined ;
135
136
signatureDeclaration . modifiers = modifiers ;
136
137
signatureDeclaration . name = name ;
137
138
signatureDeclaration . questionToken = optional ? createToken ( SyntaxKind . QuestionToken ) : undefined ;
@@ -142,8 +143,6 @@ namespace ts.codefix {
142
143
}
143
144
144
145
function createMethodImplementingSignatures ( signatures : Signature [ ] , name : PropertyName , optional : boolean , modifiers : Modifier [ ] | undefined ) : MethodDeclaration {
145
- Debug . assert ( signatures && signatures . length > 0 ) ;
146
-
147
146
/** This is *a* signature with the maximal number of arguments,
148
147
* such that if there is a "maximal" signature without rest arguments,
149
148
* this is one of them.
@@ -154,7 +153,9 @@ namespace ts.codefix {
154
153
for ( let i = 0 ; i < signatures . length ; i ++ ) {
155
154
const sig = signatures [ i ] ;
156
155
minArgumentCount = Math . min ( sig . minArgumentCount , minArgumentCount ) ;
157
- someSigHasRestParameter = someSigHasRestParameter || sig . hasRestParameter ;
156
+ if ( sig . hasRestParameter ) {
157
+ someSigHasRestParameter = true ;
158
+ }
158
159
if ( sig . parameters . length >= maxArgsSignature . parameters . length && ( ! sig . hasRestParameter || maxArgsSignature . hasRestParameter ) ) {
159
160
maxArgsSignature = sig ;
160
161
}
0 commit comments