mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 12:19:32 -05:00
Fix self tail call return type inference in assigned anonymous functions (#58124)
This commit is contained in:
@@ -28086,7 +28086,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
case SyntaxKind.Identifier:
|
||||
if (!isThisInTypeQuery(node)) {
|
||||
const symbol = getResolvedSymbol(node as Identifier);
|
||||
return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
|
||||
return isConstantVariable(symbol)
|
||||
|| isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol)
|
||||
|| !!symbol.valueDeclaration && isFunctionExpression(symbol.valueDeclaration);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
@@ -37796,7 +37798,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (
|
||||
expr.kind === SyntaxKind.CallExpression &&
|
||||
(expr as CallExpression).expression.kind === SyntaxKind.Identifier &&
|
||||
checkExpressionCached((expr as CallExpression).expression).symbol === func.symbol
|
||||
checkExpressionCached((expr as CallExpression).expression).symbol === getMergedSymbol(func.symbol) &&
|
||||
(!isFunctionExpressionOrArrowFunction(func.symbol.valueDeclaration!) || isConstantReference((expr as CallExpression).expression))
|
||||
) {
|
||||
hasReturnOfTypeNever = true;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user