@@ -39347,20 +39347,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
39347
39347
}
39348
39348
}
39349
39349
39350
- function getNonGenericReturnTypeOfSingleCallSignature (funcType: Type) {
39350
+ function getReturnTypeOfSingleNonGenericCallSignature (funcType: Type) {
39351
39351
const signature = getSingleCallSignature(funcType);
39352
- if (signature) {
39353
- const returnType = getReturnTypeOfSignature(signature);
39354
- if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
39355
- return returnType;
39356
- }
39352
+ if (signature && !signature.typeParameters) {
39353
+ return getReturnTypeOfSignature(signature);
39357
39354
}
39358
39355
}
39359
39356
39360
39357
function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr: CallChain) {
39361
39358
const funcType = checkExpression(expr.expression);
39362
39359
const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
39363
- const returnType = getNonGenericReturnTypeOfSingleCallSignature (funcType);
39360
+ const returnType = getReturnTypeOfSingleNonGenericCallSignature (funcType);
39364
39361
return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
39365
39362
}
39366
39363
@@ -39409,7 +39406,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
39409
39406
// signature where we can just fetch the return type without checking the arguments.
39410
39407
if (isCallExpression(expr) && expr.expression.kind !== SyntaxKind.SuperKeyword && !isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !isSymbolOrSymbolForCall(expr)) {
39411
39408
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) :
39412
- getNonGenericReturnTypeOfSingleCallSignature (checkNonNullExpression(expr.expression));
39409
+ getReturnTypeOfSingleNonGenericCallSignature (checkNonNullExpression(expr.expression));
39413
39410
}
39414
39411
else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
39415
39412
return getTypeFromTypeNode((expr as TypeAssertion).type);
@@ -46384,11 +46381,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
46384
46381
);
46385
46382
}
46386
46383
46387
- if (!isIllegalExportDefaultInCJS && getIsolatedModules(compilerOptions) && !(sym.flags & SymbolFlags.Value)) {
46384
+ if (!isIllegalExportDefaultInCJS && !(node.flags & NodeFlags.Ambient) && getIsolatedModules(compilerOptions) && !(sym.flags & SymbolFlags.Value)) {
46385
+ const nonLocalMeanings = getSymbolFlags(sym, /*excludeTypeOnlyMeanings*/ false, /*excludeLocalMeanings*/ true);
46388
46386
if (
46389
46387
sym.flags & SymbolFlags.Alias
46390
- && resolveAlias(sym) !== unknownSymbol
46391
- && getSymbolFlags(sym, /*excludeTypeOnlyMeanings*/ false, /*excludeLocalMeanings*/ true) & SymbolFlags.Type
46388
+ && nonLocalMeanings & SymbolFlags.Type
46389
+ && !(nonLocalMeanings & SymbolFlags.Value)
46392
46390
&& (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))
46393
46391
) {
46394
46392
// import { SomeType } from "./someModule";
0 commit comments