Fix quick fix for isolatedDeclarations to keep trailing unknown in generics (#61227)

This commit is contained in:
Ben Lickly
2025-02-19 17:28:50 -08:00
committed by GitHub
parent 71b16ea186
commit 3f416e0f52
5 changed files with 75 additions and 0 deletions

View File

@@ -621,6 +621,9 @@ function endOfRequiredTypeParameters(checker: TypeChecker, type: GenericType): n
const fullTypeArguments = type.typeArguments;
const target = type.target;
for (let cutoff = 0; cutoff < fullTypeArguments.length; cutoff++) {
if (target.localTypeParameters?.[cutoff].constraint === undefined) {
continue;
}
const typeArguments = fullTypeArguments.slice(0, cutoff);
const filledIn = checker.fillMissingTypeArguments(typeArguments, target.typeParameters, cutoff, /*isJavaScriptImplicitAny*/ false);
if (filledIn.every((fill, i) => fill === fullTypeArguments[i])) {