Skip to content

Commit e660490

Browse files
authored
Revert "Defer processing of nested generic calls that return construc… (#57746)
1 parent 3e91592 commit e660490

4 files changed

+3
-170
lines changed

src/compiler/checker.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -35187,7 +35187,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3518735187
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
3518835188
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
3518935189
// from which we never make inferences).
35190-
if (checkMode & CheckMode.SkipGenericFunctions && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
35190+
if (checkMode & CheckMode.SkipGenericFunctions && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
3519135191
skippedGenericFunction(node, checkMode);
3519235192
return resolvingSignature;
3519335193
}
@@ -35200,12 +35200,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3520035200
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
3520135201
}
3520235202

35203-
function isGenericFunctionReturningFunctionOrConstructor(signature: Signature) {
35204-
if (!signature.typeParameters) {
35205-
return false;
35206-
}
35207-
const returnType = getReturnTypeOfSignature(signature);
35208-
return isFunctionType(returnType) || isConstructorType(returnType);
35203+
function isGenericFunctionReturningFunction(signature: Signature) {
35204+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
3520935205
}
3521035206

3521135207
/**

tests/baselines/reference/inferenceGenericNestedCallReturningConstructor.symbols

-72
This file was deleted.

tests/baselines/reference/inferenceGenericNestedCallReturningConstructor.types

-63
This file was deleted.

tests/cases/compiler/inferenceGenericNestedCallReturningConstructor.ts

-28
This file was deleted.

0 commit comments

Comments
 (0)