typescript 5.6.0-dev.20240814 → 5.6.0-dev.20240816

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "Eine Namespacedeklaration darf sich nicht in einer anderen Datei als die Klasse oder Funktion befinden, mit der sie zusammengeführt wird.",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Eine Namespacedeklaration darf nicht vor der Klasse oder Funktion positioniert werden, mit der sie zusammengeführt wird.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "Eine Namespacedeklaration ist nur auf der obersten Ebene eines Namespaces oder Moduls zulässig.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "Eine Namespace-Deklaration darf nicht mit dem Schlüsselwort \"module\" deklariert werden. Verwenden Sie stattdessen das Schlüsselwort \"namespace\".",
65
66
  "A_non_dry_build_would_build_project_0_6357": "Bei einem Build ohne das Flag \"-dry\" würde das Projekt \"{0}\" erstellt.",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Bei einem Build ohne das Flag \"-dry\" würden die folgenden Dateien gelöscht: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "Ein Build ohne das Flag \"-dry\" würde die Zeitstempel der Ausgabe von Projekt \"{0}\" aktualisieren.",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "Una declaración de espacio de nombres no puede estar en un archivo distinto de una clase o función con la que se combina.",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Una declaración de espacio de nombres no se puede situar antes que una clase o función con la que se combina.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "Una declaración de espacio de nombres solo se permite en el nivel superior de un espacio de nombres o módulo.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "Una declaración \"namespace\" no debe declararse con la palabra clave \"module\". Use la palabra clave \"namespace\" en su lugar.",
65
66
  "A_non_dry_build_would_build_project_0_6357": "Una compilación no -dry compilaría el proyecto \"{0}\"",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Una compilación no -dry eliminaría los archivos siguientes: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "Una compilación no -dry actualizaría las marcas de tiempo para la salida del proyecto \"{0}\".",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "Une déclaration d'espace de noms ne peut pas se trouver dans un autre fichier que celui d'une classe ou d'une fonction avec laquelle elle est fusionnée.",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Une déclaration d'espace de noms ne peut pas se trouver avant une classe ou une fonction avec laquelle elle est fusionnée.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "Une déclaration d’espace de noms n’est autorisée qu’au niveau supérieur d’un espace de noms ou d’un module.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "Une déclaration d’« espace de noms » ne doit pas être déclarée à l’aide du mot clé « module ». Utilisez plutôt le mot clé « espace de noms ».",
65
66
  "A_non_dry_build_would_build_project_0_6357": "Une build non-dry va générer le projet '{0}'",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Une build non-dry va supprimer les fichiers suivants : {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "Une build non-dry va mettre à jour les horodatages de la sortie du projet '{0}'",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "Una dichiarazione di spazio dei nomi non può essere presente in un file diverso rispetto a una classe o funzione con cui è stato eseguito il merge.",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Una dichiarazione di spazio dei nomi non può essere specificata prima di una classe o funzione con cui è stato eseguito il merge.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "Una dichiarazione di spazio dei nomi è consentita solo al livello superiore di uno spazio dei nomi o di un modulo.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "Una dichiarazione 'namespace' non deve essere dichiarata usando la parola chiave 'module'. Usare invece la parola chiave 'namespace'.",
65
66
  "A_non_dry_build_would_build_project_0_6357": "Se si esegue una compilazione senza flag -dry, verrà compilato il progetto '{0}'",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Se si esegue una compilazione senza flag -dry, i file seguenti verranno eliminati: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "Se si esegue una compilazione non di prova, i timestamp dell'output del progetto '{0}' verranno aggiornati",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "名前空間宣言は、それとマージするクラスや関数と異なるファイルに配置できません。",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "名前空間宣言は、それとマージするクラスや関数より前に配置できません。",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "名前空間宣言は、名前空間またはモジュールの最上位レベルでのみ許可されます。",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "'namespace' 宣言を 'module' キーワードを使用して宣言することはできません。代わりに 'namespace' キーワードを使用してください。",
65
66
  "A_non_dry_build_would_build_project_0_6357": "非 -dry ビルドを実行した場合、プロジェクト '{0}' がビルドされます",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "非 -dry ビルドを実行した場合、次のファイルが削除されます: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "non-dry build では、プロジェクト '{0}' の出力のタイムスタンプが更新されます",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "네임스페이스 선언은 해당 선언이 병합된 클래스나 함수와 다른 파일에 있을 수 없습니다,",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "네임스페이스 선언은 해당 선언이 병합된 클래스나 함수 앞에 있을 수 없습니다.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "네임스페이스 선언은 네임스페이스 또는 모듈의 최상위 수준에서만 허용됩니다.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "'module' 키워드를 사용하여 'namespace' 선언을 선언하면 안 됩니다. 대신 'namespace' 키워드를 사용하세요.",
65
66
  "A_non_dry_build_would_build_project_0_6357": "-dry가 아닌 빌드는 프로젝트 '{0}'을(를) 빌드합니다.",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "-dry가 아닌 빌드는 다음 파일을 삭제합니다. {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "DRY가 아닌 빌드는 '{0}' 프로젝트의 출력 타임스탬프를 업데이트합니다.",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "Uma declaração de namespace não pode estar em um arquivo diferente de uma classe ou função com a qual ela é mesclada.",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Uma declaração de namespace não pode estar localizada antes de uma classe ou função com a qual ela é mesclada.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "Uma declaração de namespace só é permitida no nível superior de um namespace ou módulo.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "Uma declaração \"namespace\" não deve ser declarada usando a palavra-chave \"module\". Use a palavra-chave \"namespace\".",
65
66
  "A_non_dry_build_would_build_project_0_6357": "Um build não -dry criaria o projeto '{0}'",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "Um build não -dry excluiria os seguintes arquivos: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "Um build não -dry atualizaria carimbos de data/hora para a saída do projeto '{0}'",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "Объявление пространства имен и класс или функция, с которыми оно объединено, не могут находится в разных файлах.",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Объявление пространства имен не может располагаться раньше класса или функции, с которыми оно объединено.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "Объявление пространства имен разрешено только на верхнем уровне пространства имен или модуля.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "Объявление \"namespace\" с использованием ключевого слова \"module\" недопустимо. Вместо него используйте ключевое слово \"namespace\".",
65
66
  "A_non_dry_build_would_build_project_0_6357": "При сборке без флага -dry будет собран проект \"{0}\"",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "При сборке без флага -dry будут удалены следующие файлы: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "Сборка без флага -dry обновит метки времени для выходных данных проекта \"{0}\"",
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "Bir ad alanı bildirimi, birleştirildiği sınıf veya işlevden farklı bir dosyada olamaz.",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "Bir ad alanı bildirimi, birleştirildiği sınıf veya işlevden önce gelemez.",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "Ad alanı bildirimine yalnızca bir ad alanının veya modülün en üst düzeyinde izin verilir.",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "'module' anahtar sözcüğü kullanılarak 'namespace' bildirimi bildirilmez. Lütfen bunun yerine 'namespace' anahtar sözcüğünü kullanın.",
65
66
  "A_non_dry_build_would_build_project_0_6357": "-dry bayrağı kullanılmayan bir derleme '{0}' projesini derler",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "-dry bayrağı kullanılmayan bir derleme şu dosyaları siler: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "DRY dışı bir derleme, '{0}' projesinin çıkışı için zaman damgalarını güncelleştirir",
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.6";
21
- var version = `${versionMajorMinor}.0-dev.20240814`;
21
+ var version = `${versionMajorMinor}.0-dev.20240816`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7390,6 +7390,7 @@ var Diagnostics = {
7390
7390
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
7391
7391
  Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
7392
7392
  Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
7393
+ This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
7393
7394
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
7394
7395
  one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
7395
7396
  type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
@@ -35839,7 +35840,6 @@ var commonOptionsWithBuild = [
35839
35840
  name: "generateTrace",
35840
35841
  type: "string",
35841
35842
  isFilePath: true,
35842
- isCommandLineOnly: true,
35843
35843
  paramType: Diagnostics.DIRECTORY,
35844
35844
  category: Diagnostics.Compiler_Diagnostics,
35845
35845
  description: Diagnostics.Generates_an_event_trace_and_a_list_of_types
@@ -44067,21 +44067,25 @@ function createBinder() {
44067
44067
  const reportError = (
44068
44068
  // report error on all statements except empty ones
44069
44069
  isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
44070
- node.kind === 263 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
44070
+ node.kind === 263 /* ClassDeclaration */ || // report errors on enums with preserved emit
44071
+ isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
44071
44072
  node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
44072
44073
  );
44073
44074
  if (reportError) {
44074
44075
  currentFlow = reportedUnreachableFlow;
44075
44076
  if (!options.allowUnreachableCode) {
44076
44077
  const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
44077
- eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
44078
+ eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
44078
44079
  }
44079
44080
  }
44080
44081
  }
44081
44082
  return true;
44082
44083
  }
44083
44084
  }
44084
- function eachUnreachableRange(node, cb) {
44085
+ function isEnumDeclarationWithPreservedEmit(node, options) {
44086
+ return node.kind === 266 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
44087
+ }
44088
+ function eachUnreachableRange(node, options, cb) {
44085
44089
  if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
44086
44090
  const { statements } = node.parent;
44087
44091
  const slice = sliceAfter(statements, node);
@@ -44089,22 +44093,22 @@ function eachUnreachableRange(node, cb) {
44089
44093
  } else {
44090
44094
  cb(node, node);
44091
44095
  }
44092
- }
44093
- function isExecutableStatement(s) {
44094
- return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !isEnumDeclaration(s) && // `var x;` may declare a variable used above
44095
- !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
44096
- }
44097
- function isPurelyTypeDeclaration(s) {
44098
- switch (s.kind) {
44099
- case 264 /* InterfaceDeclaration */:
44100
- case 265 /* TypeAliasDeclaration */:
44101
- return true;
44102
- case 267 /* ModuleDeclaration */:
44103
- return getModuleInstanceState(s) !== 1 /* Instantiated */;
44104
- case 266 /* EnumDeclaration */:
44105
- return hasSyntacticModifier(s, 4096 /* Const */);
44106
- default:
44107
- return false;
44096
+ function isExecutableStatement(s) {
44097
+ return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
44098
+ !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
44099
+ }
44100
+ function isPurelyTypeDeclaration(s) {
44101
+ switch (s.kind) {
44102
+ case 264 /* InterfaceDeclaration */:
44103
+ case 265 /* TypeAliasDeclaration */:
44104
+ return true;
44105
+ case 267 /* ModuleDeclaration */:
44106
+ return getModuleInstanceState(s) !== 1 /* Instantiated */;
44107
+ case 266 /* EnumDeclaration */:
44108
+ return !isEnumDeclarationWithPreservedEmit(s, options);
44109
+ default:
44110
+ return false;
44111
+ }
44108
44112
  }
44109
44113
  }
44110
44114
  function isExportsOrModuleExportsOrAlias(sourceFile, node) {
@@ -46687,7 +46691,7 @@ function createTypeChecker(host) {
46687
46691
  }
46688
46692
  if (source.exports) {
46689
46693
  if (!target.exports) target.exports = createSymbolTable();
46690
- mergeSymbolTable(target.exports, source.exports, unidirectional);
46694
+ mergeSymbolTable(target.exports, source.exports, unidirectional, target);
46691
46695
  }
46692
46696
  if (!unidirectional) {
46693
46697
  recordMergedSymbol(target, source);
@@ -46767,10 +46771,14 @@ function createTypeChecker(host) {
46767
46771
  mergeSymbolTable(combined, second);
46768
46772
  return combined;
46769
46773
  }
46770
- function mergeSymbolTable(target, source, unidirectional = false) {
46774
+ function mergeSymbolTable(target, source, unidirectional = false, mergedParent) {
46771
46775
  source.forEach((sourceSymbol, id) => {
46772
46776
  const targetSymbol = target.get(id);
46773
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
46777
+ const merged = targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol);
46778
+ if (mergedParent && targetSymbol) {
46779
+ merged.parent = mergedParent;
46780
+ }
46781
+ target.set(id, merged);
46774
46782
  });
46775
46783
  }
46776
46784
  function mergeModuleAugmentation(moduleName) {
@@ -60239,7 +60247,7 @@ function createTypeChecker(host) {
60239
60247
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
60240
60248
  removeFromEach(typeSet, 65536 /* Null */);
60241
60249
  result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60242
- } else if (typeSet.length >= 4) {
60250
+ } else if (typeSet.length >= 3 && types.length > 2) {
60243
60251
  const middle = Math.floor(typeSet.length / 2);
60244
60252
  result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
60245
60253
  } else {
@@ -78136,6 +78144,29 @@ function createTypeChecker(host) {
78136
78144
  }
78137
78145
  if (leftOk && rightOk) {
78138
78146
  checkAssignmentOperator(resultType2);
78147
+ switch (operator) {
78148
+ case 48 /* LessThanLessThanToken */:
78149
+ case 71 /* LessThanLessThanEqualsToken */:
78150
+ case 49 /* GreaterThanGreaterThanToken */:
78151
+ case 72 /* GreaterThanGreaterThanEqualsToken */:
78152
+ case 50 /* GreaterThanGreaterThanGreaterThanToken */:
78153
+ case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
78154
+ const rhsEval = evaluate(right);
78155
+ if (typeof rhsEval.value === "number" && Math.abs(rhsEval.value) >= 32) {
78156
+ errorOrSuggestion(
78157
+ isEnumMember(walkUpParenthesizedExpressions(right.parent.parent)),
78158
+ // elevate from suggestion to error within an enum member
78159
+ errorNode || operatorToken,
78160
+ Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2,
78161
+ getTextOfNode(left),
78162
+ tokenToString(operator),
78163
+ rhsEval.value % 32
78164
+ );
78165
+ }
78166
+ break;
78167
+ default:
78168
+ break;
78169
+ }
78139
78170
  }
78140
78171
  return resultType2;
78141
78172
  }
package/lib/typescript.js CHANGED
@@ -541,6 +541,7 @@ __export(typescript_exports, {
541
541
  extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
542
542
  externalHelpersModuleNameText: () => externalHelpersModuleNameText,
543
543
  factory: () => factory,
544
+ fileContainsPackageImport: () => fileContainsPackageImport,
544
545
  fileExtensionIs: () => fileExtensionIs,
545
546
  fileExtensionIsOneOf: () => fileExtensionIsOneOf,
546
547
  fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
@@ -2262,7 +2263,7 @@ module.exports = __toCommonJS(typescript_exports);
2262
2263
 
2263
2264
  // src/compiler/corePublic.ts
2264
2265
  var versionMajorMinor = "5.6";
2265
- var version = `${versionMajorMinor}.0-dev.20240814`;
2266
+ var version = `${versionMajorMinor}.0-dev.20240816`;
2266
2267
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2267
2268
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2268
2269
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10787,6 +10788,7 @@ var Diagnostics = {
10787
10788
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
10788
10789
  Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
10789
10790
  Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
10791
+ This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
10790
10792
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
10791
10793
  one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
10792
10794
  type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
@@ -40109,7 +40111,6 @@ var commonOptionsWithBuild = [
40109
40111
  name: "generateTrace",
40110
40112
  type: "string",
40111
40113
  isFilePath: true,
40112
- isCommandLineOnly: true,
40113
40114
  paramType: Diagnostics.DIRECTORY,
40114
40115
  category: Diagnostics.Compiler_Diagnostics,
40115
40116
  description: Diagnostics.Generates_an_event_trace_and_a_list_of_types
@@ -48586,21 +48587,25 @@ function createBinder() {
48586
48587
  const reportError = (
48587
48588
  // report error on all statements except empty ones
48588
48589
  isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
48589
- node.kind === 263 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
48590
+ node.kind === 263 /* ClassDeclaration */ || // report errors on enums with preserved emit
48591
+ isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
48590
48592
  node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
48591
48593
  );
48592
48594
  if (reportError) {
48593
48595
  currentFlow = reportedUnreachableFlow;
48594
48596
  if (!options.allowUnreachableCode) {
48595
48597
  const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
48596
- eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
48598
+ eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
48597
48599
  }
48598
48600
  }
48599
48601
  }
48600
48602
  return true;
48601
48603
  }
48602
48604
  }
48603
- function eachUnreachableRange(node, cb) {
48605
+ function isEnumDeclarationWithPreservedEmit(node, options) {
48606
+ return node.kind === 266 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
48607
+ }
48608
+ function eachUnreachableRange(node, options, cb) {
48604
48609
  if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
48605
48610
  const { statements } = node.parent;
48606
48611
  const slice = sliceAfter(statements, node);
@@ -48608,22 +48613,22 @@ function eachUnreachableRange(node, cb) {
48608
48613
  } else {
48609
48614
  cb(node, node);
48610
48615
  }
48611
- }
48612
- function isExecutableStatement(s) {
48613
- return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !isEnumDeclaration(s) && // `var x;` may declare a variable used above
48614
- !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
48615
- }
48616
- function isPurelyTypeDeclaration(s) {
48617
- switch (s.kind) {
48618
- case 264 /* InterfaceDeclaration */:
48619
- case 265 /* TypeAliasDeclaration */:
48620
- return true;
48621
- case 267 /* ModuleDeclaration */:
48622
- return getModuleInstanceState(s) !== 1 /* Instantiated */;
48623
- case 266 /* EnumDeclaration */:
48624
- return hasSyntacticModifier(s, 4096 /* Const */);
48625
- default:
48626
- return false;
48616
+ function isExecutableStatement(s) {
48617
+ return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
48618
+ !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
48619
+ }
48620
+ function isPurelyTypeDeclaration(s) {
48621
+ switch (s.kind) {
48622
+ case 264 /* InterfaceDeclaration */:
48623
+ case 265 /* TypeAliasDeclaration */:
48624
+ return true;
48625
+ case 267 /* ModuleDeclaration */:
48626
+ return getModuleInstanceState(s) !== 1 /* Instantiated */;
48627
+ case 266 /* EnumDeclaration */:
48628
+ return !isEnumDeclarationWithPreservedEmit(s, options);
48629
+ default:
48630
+ return false;
48631
+ }
48627
48632
  }
48628
48633
  }
48629
48634
  function isExportsOrModuleExportsOrAlias(sourceFile, node) {
@@ -51306,7 +51311,7 @@ function createTypeChecker(host) {
51306
51311
  }
51307
51312
  if (source.exports) {
51308
51313
  if (!target.exports) target.exports = createSymbolTable();
51309
- mergeSymbolTable(target.exports, source.exports, unidirectional);
51314
+ mergeSymbolTable(target.exports, source.exports, unidirectional, target);
51310
51315
  }
51311
51316
  if (!unidirectional) {
51312
51317
  recordMergedSymbol(target, source);
@@ -51386,10 +51391,14 @@ function createTypeChecker(host) {
51386
51391
  mergeSymbolTable(combined, second);
51387
51392
  return combined;
51388
51393
  }
51389
- function mergeSymbolTable(target, source, unidirectional = false) {
51394
+ function mergeSymbolTable(target, source, unidirectional = false, mergedParent) {
51390
51395
  source.forEach((sourceSymbol, id) => {
51391
51396
  const targetSymbol = target.get(id);
51392
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
51397
+ const merged = targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol);
51398
+ if (mergedParent && targetSymbol) {
51399
+ merged.parent = mergedParent;
51400
+ }
51401
+ target.set(id, merged);
51393
51402
  });
51394
51403
  }
51395
51404
  function mergeModuleAugmentation(moduleName) {
@@ -64858,7 +64867,7 @@ function createTypeChecker(host) {
64858
64867
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
64859
64868
  removeFromEach(typeSet, 65536 /* Null */);
64860
64869
  result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64861
- } else if (typeSet.length >= 4) {
64870
+ } else if (typeSet.length >= 3 && types.length > 2) {
64862
64871
  const middle = Math.floor(typeSet.length / 2);
64863
64872
  result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
64864
64873
  } else {
@@ -82755,6 +82764,29 @@ function createTypeChecker(host) {
82755
82764
  }
82756
82765
  if (leftOk && rightOk) {
82757
82766
  checkAssignmentOperator(resultType2);
82767
+ switch (operator) {
82768
+ case 48 /* LessThanLessThanToken */:
82769
+ case 71 /* LessThanLessThanEqualsToken */:
82770
+ case 49 /* GreaterThanGreaterThanToken */:
82771
+ case 72 /* GreaterThanGreaterThanEqualsToken */:
82772
+ case 50 /* GreaterThanGreaterThanGreaterThanToken */:
82773
+ case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
82774
+ const rhsEval = evaluate(right);
82775
+ if (typeof rhsEval.value === "number" && Math.abs(rhsEval.value) >= 32) {
82776
+ errorOrSuggestion(
82777
+ isEnumMember(walkUpParenthesizedExpressions(right.parent.parent)),
82778
+ // elevate from suggestion to error within an enum member
82779
+ errorNode || operatorToken,
82780
+ Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2,
82781
+ getTextOfNode(left),
82782
+ tokenToString(operator),
82783
+ rhsEval.value % 32
82784
+ );
82785
+ }
82786
+ break;
82787
+ default:
82788
+ break;
82789
+ }
82758
82790
  }
82759
82791
  return resultType2;
82760
82792
  }
@@ -138689,7 +138721,7 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
138689
138721
  let sourceFileCache;
138690
138722
  return {
138691
138723
  allowsImportingAmbientModule,
138692
- allowsImportingSourceFile,
138724
+ getSourceFileInfo,
138693
138725
  allowsImportingSpecifier
138694
138726
  };
138695
138727
  function moduleSpecifierIsCoveredByPackageJson(specifier) {
@@ -138728,9 +138760,9 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
138728
138760
  ambientModuleCache.set(moduleSymbol, result);
138729
138761
  return result;
138730
138762
  }
138731
- function allowsImportingSourceFile(sourceFile, moduleSpecifierResolutionHost) {
138763
+ function getSourceFileInfo(sourceFile, moduleSpecifierResolutionHost) {
138732
138764
  if (!packageJsons.length) {
138733
- return true;
138765
+ return { importable: true, packageName: void 0 };
138734
138766
  }
138735
138767
  if (!sourceFileCache) {
138736
138768
  sourceFileCache = /* @__PURE__ */ new Map();
@@ -138740,12 +138772,14 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
138740
138772
  return cached;
138741
138773
  }
138742
138774
  }
138743
- const moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
138744
- if (!moduleSpecifier) {
138745
- sourceFileCache.set(sourceFile, true);
138746
- return true;
138775
+ const packageName = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
138776
+ if (!packageName) {
138777
+ const result2 = { importable: true, packageName };
138778
+ sourceFileCache.set(sourceFile, result2);
138779
+ return result2;
138747
138780
  }
138748
- const result = moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
138781
+ const importable = moduleSpecifierIsCoveredByPackageJson(packageName);
138782
+ const result = { importable, packageName };
138749
138783
  sourceFileCache.set(sourceFile, result);
138750
138784
  return result;
138751
138785
  }
@@ -139291,7 +139325,7 @@ function isImportableFile(program, from, to, preferences, packageJsonFilter, mod
139291
139325
  if (from === to) return false;
139292
139326
  const cachedResult = moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {});
139293
139327
  if ((cachedResult == null ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== void 0) {
139294
- return !cachedResult.isBlockedByPackageJsonDependencies;
139328
+ return !cachedResult.isBlockedByPackageJsonDependencies || !!cachedResult.packageName && fileContainsPackageImport(from, cachedResult.packageName);
139295
139329
  }
139296
139330
  const getCanonicalFileName = hostGetCanonicalFileName(moduleSpecifierResolutionHost);
139297
139331
  const globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) == null ? void 0 : _a.call(moduleSpecifierResolutionHost);
@@ -139307,12 +139341,15 @@ function isImportableFile(program, from, to, preferences, packageJsonFilter, mod
139307
139341
  }
139308
139342
  );
139309
139343
  if (packageJsonFilter) {
139310
- const isAutoImportable = hasImportablePath && packageJsonFilter.allowsImportingSourceFile(to, moduleSpecifierResolutionHost);
139311
- moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, !isAutoImportable);
139312
- return isAutoImportable;
139344
+ const importInfo = hasImportablePath ? packageJsonFilter.getSourceFileInfo(to, moduleSpecifierResolutionHost) : void 0;
139345
+ moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, importInfo == null ? void 0 : importInfo.packageName, !(importInfo == null ? void 0 : importInfo.importable));
139346
+ return !!(importInfo == null ? void 0 : importInfo.importable) || !!(importInfo == null ? void 0 : importInfo.packageName) && fileContainsPackageImport(from, importInfo.packageName);
139313
139347
  }
139314
139348
  return hasImportablePath;
139315
139349
  }
139350
+ function fileContainsPackageImport(sourceFile, packageName) {
139351
+ return sourceFile.imports && sourceFile.imports.some((i) => i.text === packageName || i.text.startsWith(packageName + "/"));
139352
+ }
139316
139353
  function isImportablePath(fromPath, toPath3, getCanonicalFileName, globalCachePath) {
139317
139354
  const toNodeModules = forEachAncestorDirectory(toPath3, (ancestor) => getBaseFileName(ancestor) === "node_modules" ? ancestor : void 0);
139318
139355
  const toNodeModulesParent = toNodeModules && getDirectoryPath(getCanonicalFileName(toNodeModules));
@@ -142063,7 +142100,8 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
142063
142100
  }
142064
142101
  addRange(diags, sourceFile.bindSuggestionDiagnostics);
142065
142102
  addRange(diags, program.getSuggestionDiagnostics(sourceFile, cancellationToken));
142066
- return diags.sort((d1, d2) => d1.start - d2.start);
142103
+ diags.sort((d1, d2) => d1.start - d2.start);
142104
+ return diags;
142067
142105
  function check(node) {
142068
142106
  if (isJsFile) {
142069
142107
  if (canBeConvertedToClass(node, checker)) {
@@ -142309,6 +142347,7 @@ function transpileWorker(input, transpileOptions, declaration) {
142309
142347
  options.isolatedDeclarations = true;
142310
142348
  } else {
142311
142349
  options.declaration = false;
142350
+ options.declarationMap = false;
142312
142351
  }
142313
142352
  const newLine = getNewLineCharacter(options);
142314
142353
  const compilerHost = {
@@ -142504,7 +142543,8 @@ function getContainers(declaration) {
142504
142543
  }
142505
142544
  container = getContainerNode(container);
142506
142545
  }
142507
- return containers.reverse();
142546
+ containers.reverse();
142547
+ return containers;
142508
142548
  }
142509
142549
  function compareNavigateToItems(i1, i2) {
142510
142550
  return compareValues(i1.matchKind, i2.matchKind) || compareStringsCaseSensitiveUI(i1.name, i2.name);
@@ -145087,7 +145127,12 @@ registerRefactor(refactorName4, {
145087
145127
  const { references, declaration, replacement } = info;
145088
145128
  const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
145089
145129
  for (const node of references) {
145090
- tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
145130
+ const closestStringIdentifierParent = isStringLiteral(replacement) && isIdentifier(node) && walkUpParenthesizedExpressions(node.parent);
145131
+ if (closestStringIdentifierParent && isTemplateSpan(closestStringIdentifierParent) && !isTaggedTemplateExpression(closestStringIdentifierParent.parent.parent)) {
145132
+ replaceTemplateStringVariableWithLiteral(tracker, file, closestStringIdentifierParent, replacement);
145133
+ } else {
145134
+ tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
145135
+ }
145091
145136
  }
145092
145137
  tracker.delete(file, declaration);
145093
145138
  });
@@ -145176,6 +145221,19 @@ function getReplacementExpression(reference, replacement) {
145176
145221
  }
145177
145222
  return replacement;
145178
145223
  }
145224
+ function replaceTemplateStringVariableWithLiteral(tracker, sourceFile, reference, replacement) {
145225
+ const templateExpression = reference.parent;
145226
+ const index = templateExpression.templateSpans.indexOf(reference);
145227
+ const prevNode = index === 0 ? templateExpression.head : templateExpression.templateSpans[index - 1];
145228
+ tracker.replaceRangeWithText(
145229
+ sourceFile,
145230
+ {
145231
+ pos: prevNode.getEnd() - 2,
145232
+ end: reference.literal.getStart() + 1
145233
+ },
145234
+ replacement.text.replace(/\\/g, "\\\\").replace(/`/g, "\\`")
145235
+ );
145236
+ }
145179
145237
 
145180
145238
  // src/services/refactors/moveToNewFile.ts
145181
145239
  var refactorName5 = "Move to a new file";
@@ -147404,8 +147462,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
147404
147462
  callArguments.push(factory.createIdentifier(name));
147405
147463
  });
147406
147464
  const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
147407
- const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
147408
- const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration);
147465
+ typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
147466
+ const typeParameters = typeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(typeParametersAndDeclarations, ({ declaration }) => declaration);
147409
147467
  const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
147410
147468
  decl.name,
147411
147469
  /*typeArguments*/
@@ -156114,7 +156172,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
156114
156172
  });
156115
156173
  function addSymbol(moduleSymbol, toFile, exportedSymbol, exportKind, program2, isFromPackageJson) {
156116
156174
  const moduleSpecifierResolutionHost = getModuleSpecifierResolutionHost(isFromPackageJson);
156117
- if (toFile && isImportableFile(program2, fromFile, toFile, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) || !toFile && packageJsonFilter.allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost)) {
156175
+ if (toFile && isImportableFile(program2, fromFile, toFile, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) || (!toFile && packageJsonFilter.allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost) || fileContainsPackageImport(fromFile, stripQuotes(moduleSymbol.name)))) {
156118
156176
  const checker = program2.getTypeChecker();
156119
156177
  originalSymbolToExportInfos.add(getUniqueSymbolId(exportedSymbol, checker).toString(), { symbol: exportedSymbol, moduleSymbol, moduleFileName: toFile == null ? void 0 : toFile.fileName, exportKind, targetFlags: skipAlias(exportedSymbol, checker).flags, isFromPackageJson });
156120
156178
  }
@@ -166085,7 +166143,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
166085
166143
  if (ts_JsTyping_exports.nodeCoreModules.has(moduleName) && startsWith(moduleName, "node:") !== shouldUseUriStyleNodeCoreModules(sourceFile, program)) {
166086
166144
  return false;
166087
166145
  }
166088
- return packageJsonFilter ? packageJsonFilter.allowsImportingAmbientModule(info.moduleSymbol, getModuleSpecifierResolutionHost(info.isFromPackageJson)) : true;
166146
+ return ((packageJsonFilter == null ? void 0 : packageJsonFilter.allowsImportingAmbientModule(info.moduleSymbol, getModuleSpecifierResolutionHost(info.isFromPackageJson))) ?? true) || fileContainsPackageImport(sourceFile, moduleName);
166089
166147
  }
166090
166148
  return isImportableFile(
166091
166149
  info.isFromPackageJson ? packageJsonAutoImportProvider : program,
@@ -172494,9 +172552,10 @@ ${content}
172494
172552
  parsedNodes.push({ sourceFile: sourceFile2, body: bod });
172495
172553
  }
172496
172554
  }
172497
- const { body } = parsedNodes.sort(
172555
+ parsedNodes.sort(
172498
172556
  (a, b) => a.sourceFile.parseDiagnostics.length - b.sourceFile.parseDiagnostics.length
172499
- )[0];
172557
+ );
172558
+ const { body } = parsedNodes[0];
172500
172559
  return body;
172501
172560
  }
172502
172561
  function placeNodeGroup(originalFile, changeTracker, changes, focusLocations) {
@@ -173307,7 +173366,8 @@ function collectElements(sourceFile, cancellationToken) {
173307
173366
  const res = [];
173308
173367
  addNodeOutliningSpans(sourceFile, cancellationToken, res);
173309
173368
  addRegionOutliningSpans(sourceFile, res);
173310
- return res.sort((span1, span2) => span1.textSpan.start - span2.textSpan.start);
173369
+ res.sort((span1, span2) => span1.textSpan.start - span2.textSpan.start);
173370
+ return res;
173311
173371
  }
173312
173372
  function addNodeOutliningSpans(sourceFile, cancellationToken, out) {
173313
173373
  let depthRemaining = 40;
@@ -179864,6 +179924,7 @@ __export(ts_exports2, {
179864
179924
  extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution,
179865
179925
  externalHelpersModuleNameText: () => externalHelpersModuleNameText,
179866
179926
  factory: () => factory,
179927
+ fileContainsPackageImport: () => fileContainsPackageImport,
179867
179928
  fileExtensionIs: () => fileExtensionIs,
179868
179929
  fileExtensionIsOneOf: () => fileExtensionIsOneOf,
179869
179930
  fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
@@ -185635,23 +185696,8 @@ var nullTypingsInstaller = {
185635
185696
  };
185636
185697
  var noopConfigFileWatcher = { close: noop };
185637
185698
  function getConfigFileNameFromCache(info, cache) {
185638
- if (!cache) return void 0;
185639
- const configFileForOpenFile = cache.get(info.path);
185640
- if (configFileForOpenFile === void 0) return void 0;
185641
- if (!isAncestorConfigFileInfo(info)) {
185642
- return isString(configFileForOpenFile) || !configFileForOpenFile ? configFileForOpenFile : (
185643
- // direct result
185644
- configFileForOpenFile.get(
185645
- /*key*/
185646
- false
185647
- )
185648
- );
185649
- } else {
185650
- return configFileForOpenFile && !isString(configFileForOpenFile) ? (
185651
- // Map with fileName as key
185652
- configFileForOpenFile.get(info.fileName)
185653
- ) : void 0;
185654
- }
185699
+ if (!cache || isAncestorConfigFileInfo(info)) return void 0;
185700
+ return cache.get(info.path);
185655
185701
  }
185656
185702
  function isOpenScriptInfo(infoOrFileNameOrConfig) {
185657
185703
  return !!infoOrFileNameOrConfig.containingProjects;
@@ -185665,17 +185711,13 @@ var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) =>
185665
185711
  ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
185666
185712
  return ConfiguredProjectLoadKind2;
185667
185713
  })(ConfiguredProjectLoadKind || {});
185668
- function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, searchOnlyPotentialSolution, delayReloadedConfiguredProjects) {
185714
+ function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
185669
185715
  while (true) {
185670
- if (!project.isInitialLoadPending() && (searchOnlyPotentialSolution && !project.getCompilerOptions().composite || // Currently disableSolutionSearching is shared for finding solution/project when
185671
- // - loading solution for find all references
185672
- // - trying to find default project
185673
- project.getCompilerOptions().disableSolutionSearching)) return;
185716
+ if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
185674
185717
  const configFileName = project.projectService.getConfigFileNameForFile({
185675
185718
  fileName: project.getConfigFilePath(),
185676
185719
  path: info.path,
185677
- configFileInfo: true,
185678
- isForDefaultProject: !searchOnlyPotentialSolution
185720
+ configFileInfo: true
185679
185721
  }, kind === 0 /* Find */);
185680
185722
  if (!configFileName) return;
185681
185723
  const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
@@ -185683,11 +185725,11 @@ function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredCl
185683
185725
  kind,
185684
185726
  reason,
185685
185727
  allowDeferredClosed,
185686
- !searchOnlyPotentialSolution ? info.fileName : void 0,
185687
- // Config Diag event for project if its for default project
185728
+ /*triggerFile*/
185729
+ void 0,
185688
185730
  reloadedProjects,
185689
- searchOnlyPotentialSolution,
185690
- // Delay load if we are searching for solution
185731
+ /*delayLoad*/
185732
+ true,
185691
185733
  delayReloadedConfiguredProjects
185692
185734
  );
185693
185735
  if (!ancestor) return;
@@ -186798,7 +186840,7 @@ var _ProjectService = class _ProjectService {
186798
186840
  configFileExists(configFileName, canonicalConfigFilePath, info) {
186799
186841
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
186800
186842
  let openFilesImpactedByConfigFile;
186801
- if (this.openFiles.has(info.path) && (!isAncestorConfigFileInfo(info) || info.isForDefaultProject)) {
186843
+ if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
186802
186844
  if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
186803
186845
  else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
186804
186846
  }
@@ -186925,31 +186967,24 @@ var _ProjectService = class _ProjectService {
186925
186967
  let searchPath = asNormalizedPath(getDirectoryPath(info.fileName));
186926
186968
  const isSearchPathInProjectRoot = () => containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames);
186927
186969
  const anySearchPathOk = !projectRootPath || !isSearchPathInProjectRoot();
186928
- let searchTsconfig = true;
186929
- let searchJsconfig = true;
186930
- if (isAncestorConfigFileInfo(info)) {
186931
- if (endsWith(info.fileName, "tsconfig.json")) searchTsconfig = false;
186932
- else searchTsconfig = searchJsconfig = false;
186933
- }
186970
+ let searchInDirectory = !isAncestorConfigFileInfo(info);
186934
186971
  do {
186935
- const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
186936
- if (searchTsconfig) {
186972
+ if (searchInDirectory) {
186973
+ const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
186937
186974
  const tsconfigFileName = asNormalizedPath(combinePaths(searchPath, "tsconfig.json"));
186938
- const result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
186975
+ let result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
186939
186976
  if (result) return tsconfigFileName;
186940
- }
186941
- if (searchJsconfig) {
186942
186977
  const jsconfigFileName = asNormalizedPath(combinePaths(searchPath, "jsconfig.json"));
186943
- const result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
186978
+ result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
186944
186979
  if (result) return jsconfigFileName;
186945
- }
186946
- if (isNodeModulesDirectory(canonicalSearchPath)) {
186947
- break;
186980
+ if (isNodeModulesDirectory(canonicalSearchPath)) {
186981
+ break;
186982
+ }
186948
186983
  }
186949
186984
  const parentPath = asNormalizedPath(getDirectoryPath(searchPath));
186950
186985
  if (parentPath === searchPath) break;
186951
186986
  searchPath = parentPath;
186952
- searchTsconfig = searchJsconfig = true;
186987
+ searchInDirectory = true;
186953
186988
  } while (anySearchPathOk || isSearchPathInProjectRoot());
186954
186989
  return void 0;
186955
186990
  }
@@ -186972,19 +187007,8 @@ var _ProjectService = class _ProjectService {
186972
187007
  /** Caches the configFilename for script info or ancestor of open script info */
186973
187008
  setConfigFileNameForFileInCache(info, configFileName) {
186974
187009
  if (!this.openFiles.has(info.path)) return;
186975
- const config = configFileName || false;
186976
- if (!isAncestorConfigFileInfo(info)) {
186977
- this.configFileForOpenFiles.set(info.path, config);
186978
- } else {
186979
- let configFileForOpenFile = this.configFileForOpenFiles.get(info.path);
186980
- if (!configFileForOpenFile || isString(configFileForOpenFile)) {
186981
- this.configFileForOpenFiles.set(
186982
- info.path,
186983
- configFileForOpenFile = (/* @__PURE__ */ new Map()).set(false, configFileForOpenFile)
186984
- );
186985
- }
186986
- configFileForOpenFile.set(info.fileName, config);
186987
- }
187010
+ if (isAncestorConfigFileInfo(info)) return;
187011
+ this.configFileForOpenFiles.set(info.path, configFileName || false);
186988
187012
  }
186989
187013
  /**
186990
187014
  * This function tries to search for a tsconfig.json for the given file.
@@ -188370,7 +188394,7 @@ Dynamic files must always be opened with service's current directory or service
188370
188394
  seenProjects
188371
188395
  };
188372
188396
  function tryFindDefaultConfiguredProject(project) {
188373
- return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project) ?? tryFindDefaultConfiguredProjectFromAncestor(project);
188397
+ return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
188374
188398
  }
188375
188399
  function isDefaultProject(project) {
188376
188400
  if (!tryAddToSet(seenProjects, project)) return;
@@ -188393,20 +188417,6 @@ Dynamic files must always be opened with service's current directory or service
188393
188417
  reloadedProjects
188394
188418
  );
188395
188419
  }
188396
- function tryFindDefaultConfiguredProjectFromAncestor(project) {
188397
- return forEachAncestorProject(
188398
- // If not in referenced projects, try ancestors and its references
188399
- info,
188400
- project,
188401
- tryFindDefaultConfiguredProject,
188402
- kind,
188403
- `Creating possible configured project for ${info.fileName} to open`,
188404
- allowDeferredClosed,
188405
- reloadedProjects,
188406
- /*searchOnlyPotentialSolution*/
188407
- false
188408
- );
188409
- }
188410
188420
  }
188411
188421
  tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
188412
188422
  const allowDeferredClosed = kind === 0 /* Find */;
@@ -188429,8 +188439,6 @@ Dynamic files must always be opened with service's current directory or service
188429
188439
  `Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
188430
188440
  allowDeferredClosed,
188431
188441
  reloadedProjects,
188432
- /*searchOnlyPotentialSolution*/
188433
- true,
188434
188442
  delayReloadedConfiguredProjects
188435
188443
  );
188436
188444
  }
@@ -189202,6 +189210,8 @@ function createModuleSpecifierCache(host) {
189202
189210
  kind,
189203
189211
  modulePaths,
189204
189212
  moduleSpecifiers,
189213
+ /*packageName*/
189214
+ void 0,
189205
189215
  /*isBlockedByPackageJsonDependencies*/
189206
189216
  false
189207
189217
  ));
@@ -189232,16 +189242,19 @@ function createModuleSpecifierCache(host) {
189232
189242
  modulePaths,
189233
189243
  /*moduleSpecifiers*/
189234
189244
  void 0,
189245
+ /*packageName*/
189246
+ void 0,
189235
189247
  /*isBlockedByPackageJsonDependencies*/
189236
189248
  void 0
189237
189249
  ));
189238
189250
  }
189239
189251
  },
189240
- setBlockedByPackageJsonDependencies(fromFileName, toFileName2, preferences, options, isBlockedByPackageJsonDependencies) {
189252
+ setBlockedByPackageJsonDependencies(fromFileName, toFileName2, preferences, options, packageName, isBlockedByPackageJsonDependencies) {
189241
189253
  const cache2 = ensureCache(fromFileName, preferences, options);
189242
189254
  const info = cache2.get(toFileName2);
189243
189255
  if (info) {
189244
189256
  info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
189257
+ info.packageName = packageName;
189245
189258
  } else {
189246
189259
  cache2.set(toFileName2, createInfo(
189247
189260
  /*kind*/
@@ -189250,6 +189263,7 @@ function createModuleSpecifierCache(host) {
189250
189263
  void 0,
189251
189264
  /*moduleSpecifiers*/
189252
189265
  void 0,
189266
+ packageName,
189253
189267
  isBlockedByPackageJsonDependencies
189254
189268
  ));
189255
189269
  }
@@ -189279,8 +189293,8 @@ function createModuleSpecifierCache(host) {
189279
189293
  function key(fromFileName, preferences, options) {
189280
189294
  return `${fromFileName},${preferences.importModuleSpecifierEnding},${preferences.importModuleSpecifierPreference},${options.overrideImportMode}`;
189281
189295
  }
189282
- function createInfo(kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
189283
- return { kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies };
189296
+ function createInfo(kind, modulePaths, moduleSpecifiers, packageName, isBlockedByPackageJsonDependencies) {
189297
+ return { kind, modulePaths, moduleSpecifiers, packageName, isBlockedByPackageJsonDependencies };
189284
189298
  }
189285
189299
  }
189286
189300
 
@@ -194268,6 +194282,7 @@ if (typeof console !== "undefined") {
194268
194282
  extensionsNotSupportingExtensionlessResolution,
194269
194283
  externalHelpersModuleNameText,
194270
194284
  factory,
194285
+ fileContainsPackageImport,
194271
194286
  fileExtensionIs,
194272
194287
  fileExtensionIsOneOf,
194273
194288
  fileIncludeReasonToDiagnostics,
@@ -62,6 +62,7 @@
62
62
  "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433": "命名空間宣告的所在檔案位置,不得與其要合併的類別或函式不同。",
63
63
  "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434": "命名空間宣告的位置不得先於其要合併的類別或函式。",
64
64
  "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "命名空間宣告只允許在命名空間或模組的頂層。",
65
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540": "不應該使用 'module' 關鍵字宣告 'namespace' 宣告。請改為使用 'namespace' 關鍵字。",
65
66
  "A_non_dry_build_would_build_project_0_6357": "非 -dry 組建會建置專案 '{0}'",
66
67
  "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "非 -dry 組建會刪除下列檔案: {0}",
67
68
  "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "非 DRY 組建將會更新專案 '{0}' 輸出的時間戳記",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.6.0-dev.20240814",
5
+ "version": "5.6.0-dev.20240816",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -53,6 +53,7 @@
53
53
  "@types/source-map-support": "^0.5.10",
54
54
  "@types/which": "^3.0.4",
55
55
  "@typescript-eslint/rule-tester": "^8.1.0",
56
+ "@typescript-eslint/type-utils": "^8.1.0",
56
57
  "@typescript-eslint/utils": "^8.1.0",
57
58
  "azure-devops-node-api": "^14.0.2",
58
59
  "c8": "^10.1.2",
@@ -116,5 +117,5 @@
116
117
  "node": "20.1.0",
117
118
  "npm": "8.19.4"
118
119
  },
119
- "gitHead": "77534875918d98c75006123a910ebf89fd4fb1be"
120
+ "gitHead": "52395892e0c4ee8a22b4fa6190bad46d81e66651"
120
121
  }