From a450bda7fed951dab8d0c370dba4fa26e286c16d Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Thu, 25 Jan 2024 00:39:08 +0000 Subject: [PATCH] Update LKG --- lib/tsc.js | 26 ++++++++++++++------------ lib/tsserver.js | 26 ++++++++++++++------------ lib/typescript.js | 26 ++++++++++++++------------ 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 74e27f7ced419..564e3233b2a67 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -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, diff --git a/lib/tsserver.js b/lib/tsserver.js index d542572006dfa..de1991f53fce4 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -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, diff --git a/lib/typescript.js b/lib/typescript.js index ea326efde092c..acd1a29f67af5 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -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,