Update LKG

This commit is contained in:
TypeScript Bot 2024-01-25 00:39:08 +00:00
parent 13b6193b81
commit a450bda7fe
3 changed files with 42 additions and 36 deletions

View File

@ -42806,7 +42806,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
if (modulePath.isRedirect) {
redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
} else if (pathIsBareSpecifier(local)) {
pathsSpecifiers = append(pathsSpecifiers, local);
if (pathContainsNodeModules(local)) {
relativeSpecifiers = append(relativeSpecifiers, local);
} else {
pathsSpecifiers = append(pathsSpecifiers, local);
}
} else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
relativeSpecifiers = append(relativeSpecifiers, local);
}
@ -76090,19 +76094,16 @@ function createTypeChecker(host) {
}
}
}
function getNonGenericReturnTypeOfSingleCallSignature(funcType) {
function getReturnTypeOfSingleNonGenericCallSignature(funcType) {
const signature = getSingleCallSignature(funcType);
if (signature) {
const returnType = getReturnTypeOfSignature(signature);
if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
return returnType;
}
if (signature && !signature.typeParameters) {
return getReturnTypeOfSignature(signature);
}
}
function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
const funcType = checkExpression(expr.expression);
const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
const returnType = getNonGenericReturnTypeOfSingleCallSignature(funcType);
const returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType);
return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
}
function getTypeOfExpression(node) {
@ -76147,7 +76148,7 @@ function createTypeChecker(host) {
/*requireStringLiteralLikeArgument*/
true
) && !isSymbolOrSymbolForCall(expr)) {
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getNonGenericReturnTypeOfSingleCallSignature(checkNonNullExpression(expr.expression));
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
return getTypeFromTypeNode(expr.type);
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
@ -81502,14 +81503,15 @@ function createTypeChecker(host) {
idText(id)
);
}
if (!isIllegalExportDefaultInCJS && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
if (sym.flags & 2097152 /* Alias */ && resolveAlias(sym) !== unknownSymbol && getSymbolFlags(
if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
const nonLocalMeanings = getSymbolFlags(
sym,
/*excludeTypeOnlyMeanings*/
false,
/*excludeLocalMeanings*/
true
) & 788968 /* Type */ && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
);
if (sym.flags & 2097152 /* Alias */ && nonLocalMeanings & 788968 /* Type */ && !(nonLocalMeanings & 111551 /* Value */) && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
error(
id,
node.isExportEquals ? Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported : Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default,

View File

@ -47541,7 +47541,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
if (modulePath.isRedirect) {
redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
} else if (pathIsBareSpecifier(local)) {
pathsSpecifiers = append(pathsSpecifiers, local);
if (pathContainsNodeModules(local)) {
relativeSpecifiers = append(relativeSpecifiers, local);
} else {
pathsSpecifiers = append(pathsSpecifiers, local);
}
} else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
relativeSpecifiers = append(relativeSpecifiers, local);
}
@ -80825,19 +80829,16 @@ function createTypeChecker(host) {
}
}
}
function getNonGenericReturnTypeOfSingleCallSignature(funcType) {
function getReturnTypeOfSingleNonGenericCallSignature(funcType) {
const signature = getSingleCallSignature(funcType);
if (signature) {
const returnType = getReturnTypeOfSignature(signature);
if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
return returnType;
}
if (signature && !signature.typeParameters) {
return getReturnTypeOfSignature(signature);
}
}
function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
const funcType = checkExpression(expr.expression);
const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
const returnType = getNonGenericReturnTypeOfSingleCallSignature(funcType);
const returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType);
return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
}
function getTypeOfExpression(node) {
@ -80882,7 +80883,7 @@ function createTypeChecker(host) {
/*requireStringLiteralLikeArgument*/
true
) && !isSymbolOrSymbolForCall(expr)) {
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getNonGenericReturnTypeOfSingleCallSignature(checkNonNullExpression(expr.expression));
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
return getTypeFromTypeNode(expr.type);
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
@ -86237,14 +86238,15 @@ function createTypeChecker(host) {
idText(id)
);
}
if (!isIllegalExportDefaultInCJS && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
if (sym.flags & 2097152 /* Alias */ && resolveAlias(sym) !== unknownSymbol && getSymbolFlags(
if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
const nonLocalMeanings = getSymbolFlags(
sym,
/*excludeTypeOnlyMeanings*/
false,
/*excludeLocalMeanings*/
true
) & 788968 /* Type */ && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
);
if (sym.flags & 2097152 /* Alias */ && nonLocalMeanings & 788968 /* Type */ && !(nonLocalMeanings & 111551 /* Value */) && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
error2(
id,
node.isExportEquals ? Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported : Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default,

View File

@ -45394,7 +45394,11 @@ ${lanes.join("\n")}
if (modulePath.isRedirect) {
redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
} else if (pathIsBareSpecifier(local)) {
pathsSpecifiers = append(pathsSpecifiers, local);
if (pathContainsNodeModules(local)) {
relativeSpecifiers = append(relativeSpecifiers, local);
} else {
pathsSpecifiers = append(pathsSpecifiers, local);
}
} else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
relativeSpecifiers = append(relativeSpecifiers, local);
}
@ -78579,19 +78583,16 @@ ${lanes.join("\n")}
}
}
}
function getNonGenericReturnTypeOfSingleCallSignature(funcType) {
function getReturnTypeOfSingleNonGenericCallSignature(funcType) {
const signature = getSingleCallSignature(funcType);
if (signature) {
const returnType = getReturnTypeOfSignature(signature);
if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
return returnType;
}
if (signature && !signature.typeParameters) {
return getReturnTypeOfSignature(signature);
}
}
function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
const funcType = checkExpression(expr.expression);
const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
const returnType = getNonGenericReturnTypeOfSingleCallSignature(funcType);
const returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType);
return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
}
function getTypeOfExpression(node) {
@ -78636,7 +78637,7 @@ ${lanes.join("\n")}
/*requireStringLiteralLikeArgument*/
true
) && !isSymbolOrSymbolForCall(expr)) {
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getNonGenericReturnTypeOfSingleCallSignature(checkNonNullExpression(expr.expression));
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
return getTypeFromTypeNode(expr.type);
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
@ -83991,14 +83992,15 @@ ${lanes.join("\n")}
idText(id)
);
}
if (!isIllegalExportDefaultInCJS && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
if (sym.flags & 2097152 /* Alias */ && resolveAlias(sym) !== unknownSymbol && getSymbolFlags(
if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
const nonLocalMeanings = getSymbolFlags(
sym,
/*excludeTypeOnlyMeanings*/
false,
/*excludeLocalMeanings*/
true
) & 788968 /* Type */ && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
);
if (sym.flags & 2097152 /* Alias */ && nonLocalMeanings & 788968 /* Type */ && !(nonLocalMeanings & 111551 /* Value */) && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
error2(
id,
node.isExportEquals ? Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported : Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default,