Skip to content

Commit ee3d89e

Browse files
blicklysandersn
andauthored
Update src/services/codefixes/helpers.ts
Simplify loop Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
1 parent a603aa2 commit ee3d89e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/services/codefixes/helpers.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,9 @@ function endOfRequiredTypeParameters(checker: TypeChecker, type: GenericType): n
625625
next_cutoff: for (let cutoff = 0; cutoff < fullTypeArguments.length; cutoff++) {
626626
const typeArguments = fullTypeArguments.slice(0, cutoff);
627627
const filledIn = checker.fillMissingTypeArguments(typeArguments, target.typeParameters, cutoff, /*isJavaScriptImplicitAny*/ false);
628-
for (let i = 0; i < filledIn.length; i++) {
629-
// If they don't match, then we haven't yet reached the right cutoff
630-
if (filledIn[i] !== fullTypeArguments[i]) continue next_cutoff;
628+
if (filledIn.every((fill, i) => fill === fullTypeArguments[i])) {
629+
return cutoff;
631630
}
632-
return cutoff;
633631
}
634632
// If we make it all the way here, all the type arguments are required.
635633
return fullTypeArguments.length;

0 commit comments

Comments
 (0)