Skip to content

Commit 3349152

Browse files
sandersntypescript-bot
authored andcommitted
Revert "Defer processing of nested generic calls that return construc… (#57746)
1 parent 42bb138 commit 3349152

4 files changed

+3
-170
lines changed

src/compiler/checker.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -35133,7 +35133,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3513335133
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
3513435134
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
3513535135
// from which we never make inferences).
35136-
if (checkMode & CheckMode.SkipGenericFunctions && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
35136+
if (checkMode & CheckMode.SkipGenericFunctions && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
3513735137
skippedGenericFunction(node, checkMode);
3513835138
return resolvingSignature;
3513935139
}
@@ -35146,12 +35146,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3514635146
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
3514735147
}
3514835148

35149-
function isGenericFunctionReturningFunctionOrConstructor(signature: Signature) {
35150-
if (!signature.typeParameters) {
35151-
return false;
35152-
}
35153-
const returnType = getReturnTypeOfSignature(signature);
35154-
return isFunctionType(returnType) || isConstructorType(returnType);
35149+
function isGenericFunctionReturningFunction(signature: Signature) {
35150+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
3515535151
}
3515635152

3515735153
/**

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)