typescript 5.6.0-dev.20240711 → 5.6.0-dev.20240713

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.
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.20240711`;
21
+ var version = `${versionMajorMinor}.0-dev.20240713`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6761,7 +6761,7 @@ var Diagnostics = {
6761
6761
  Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
6762
6762
  Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
6763
6763
  Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
6764
- Property_0_of_exported_class_expression_may_not_be_private_or_protected: diag(4094, 1 /* Error */, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."),
6764
+ Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected: diag(4094, 1 /* Error */, "Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected_4094", "Property '{0}' of exported anonymous class type may not be private or protected."),
6765
6765
  Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4095, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
6766
6766
  Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4096, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
6767
6767
  Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4097, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."),
@@ -6999,7 +6999,6 @@ var Diagnostics = {
6999
6999
  Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, 3 /* Message */, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", 'Parse in strict mode and emit "use strict" for each source file.'),
7000
7000
  Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, 1 /* Error */, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."),
7001
7001
  Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, 3 /* Message */, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."),
7002
- Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, 3 /* Message */, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."),
7003
7002
  Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, 3 /* Message */, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."),
7004
7003
  Resolution_for_module_0_was_found_in_cache_from_location_1: diag(6147, 3 /* Message */, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."),
7005
7004
  Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, 3 /* Message */, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."),
@@ -45519,13 +45518,6 @@ function createTypeChecker(host) {
45519
45518
  /*withAugmentations*/
45520
45519
  true
45521
45520
  ),
45522
- tryFindAmbientModuleWithoutAugmentations: (moduleName) => {
45523
- return tryFindAmbientModule(
45524
- moduleName,
45525
- /*withAugmentations*/
45526
- false
45527
- );
45528
- },
45529
45521
  getApparentType,
45530
45522
  getUnionType,
45531
45523
  isTypeAssignableTo,
@@ -46068,6 +46060,7 @@ function createTypeChecker(host) {
46068
46060
  };
46069
46061
  var amalgamatedDuplicates;
46070
46062
  var reverseMappedCache = /* @__PURE__ */ new Map();
46063
+ var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
46071
46064
  var ambientModulesCache;
46072
46065
  var patternAmbientModules;
46073
46066
  var patternAmbientModuleAugmentations;
@@ -50296,7 +50289,21 @@ function createTypeChecker(host) {
50296
50289
  }
50297
50290
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
50298
50291
  var _a;
50299
- return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
50292
+ const depth = 3;
50293
+ return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
50294
+ function isDeeplyNestedReverseMappedTypeProperty() {
50295
+ var _a2;
50296
+ if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
50297
+ return false;
50298
+ }
50299
+ for (let i = 0; i < depth; i++) {
50300
+ const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
50301
+ if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
50302
+ return false;
50303
+ }
50304
+ }
50305
+ return true;
50306
+ }
50300
50307
  }
50301
50308
  function addPropertyToElementList(propertySymbol, context, typeElements) {
50302
50309
  var _a;
@@ -66342,11 +66349,11 @@ function createTypeChecker(host) {
66342
66349
  }
66343
66350
  function inferTypeForHomomorphicMappedType(source, target, constraint) {
66344
66351
  const cacheKey = source.id + "," + target.id + "," + constraint.id;
66345
- if (reverseMappedCache.has(cacheKey)) {
66346
- return reverseMappedCache.get(cacheKey);
66352
+ if (reverseHomomorphicMappedCache.has(cacheKey)) {
66353
+ return reverseHomomorphicMappedCache.get(cacheKey);
66347
66354
  }
66348
66355
  const type = createReverseMappedType(source, target, constraint);
66349
- reverseMappedCache.set(cacheKey, type);
66356
+ reverseHomomorphicMappedCache.set(cacheKey, type);
66350
66357
  return type;
66351
66358
  }
66352
66359
  function isPartiallyInferableType(type) {
@@ -111047,7 +111054,10 @@ function transformDeclarations(context) {
111047
111054
  function reportPrivateInBaseOfClassExpression(propertyName) {
111048
111055
  if (errorNameNode || errorFallbackNode) {
111049
111056
  context.addDiagnostic(
111050
- createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected, propertyName)
111057
+ addRelatedInfo(
111058
+ createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected, propertyName),
111059
+ ...isVariableDeclaration((errorNameNode || errorFallbackNode).parent) ? [createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : []
111060
+ )
111051
111061
  );
111052
111062
  }
111053
111063
  }
@@ -119255,7 +119265,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119255
119265
  let commonSourceDirectory;
119256
119266
  let typeChecker;
119257
119267
  let classifiableNames;
119258
- const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
119259
119268
  let fileReasons = createMultiMap();
119260
119269
  let filesWithReferencesProcessed;
119261
119270
  let fileReasonsToChain;
@@ -119845,35 +119854,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119845
119854
  getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
119846
119855
  getResolved: getResolvedModuleFromResolution,
119847
119856
  canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
119848
- isEntryResolvingToAmbientModule: moduleNameResolvesToAmbientModule
119857
+ resolveToOwnAmbientModule: true
119849
119858
  });
119850
119859
  }
119851
- function moduleNameResolvesToAmbientModule(moduleName, file) {
119852
- if (contains(file.ambientModuleNames, moduleName.text)) {
119853
- if (isTraceEnabled(options, host)) {
119854
- trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
119855
- }
119856
- return true;
119857
- } else {
119858
- return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
119859
- }
119860
- }
119861
- function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file) {
119862
- var _a2;
119863
- const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
119864
- const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
119865
- if (resolutionToFile && resolvedFile) {
119866
- return false;
119867
- }
119868
- const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
119869
- if (!unmodifiedFile) {
119870
- return false;
119871
- }
119872
- if (isTraceEnabled(options, host)) {
119873
- trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
119874
- }
119875
- return true;
119876
- }
119877
119860
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
119878
119861
  const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
119879
119862
  return resolveNamesReusingOldState({
@@ -119901,10 +119884,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119901
119884
  getResolutionFromOldProgram,
119902
119885
  getResolved,
119903
119886
  canReuseResolutionsInFile,
119904
- isEntryResolvingToAmbientModule
119887
+ resolveToOwnAmbientModule
119905
119888
  }) {
119906
119889
  if (!entries.length) return emptyArray;
119907
- if (structureIsReused === 0 /* Not */ && (!isEntryResolvingToAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
119890
+ if (structureIsReused === 0 /* Not */ && (!resolveToOwnAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
119908
119891
  return resolutionWorker(
119909
119892
  entries,
119910
119893
  containingFile,
@@ -119940,12 +119923,23 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119940
119923
  continue;
119941
119924
  }
119942
119925
  }
119943
- if (isEntryResolvingToAmbientModule == null ? void 0 : isEntryResolvingToAmbientModule(entry, containingFile)) {
119944
- (result ?? (result = new Array(entries.length)))[i] = emptyResolution;
119945
- } else {
119946
- (unknownEntries ?? (unknownEntries = [])).push(entry);
119947
- (unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
119926
+ if (resolveToOwnAmbientModule) {
119927
+ const name = nameAndModeGetter.getName(entry);
119928
+ if (contains(containingSourceFile.ambientModuleNames, name)) {
119929
+ if (isTraceEnabled(options, host)) {
119930
+ trace(
119931
+ host,
119932
+ Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1,
119933
+ name,
119934
+ getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory)
119935
+ );
119936
+ }
119937
+ (result ?? (result = new Array(entries.length)))[i] = emptyResolution;
119938
+ continue;
119939
+ }
119948
119940
  }
119941
+ (unknownEntries ?? (unknownEntries = [])).push(entry);
119942
+ (unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
119949
119943
  }
119950
119944
  if (!unknownEntries) return result;
119951
119945
  const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
@@ -120079,10 +120073,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120079
120073
  } else if (hasInvalidatedResolutions(oldSourceFile.path)) {
120080
120074
  structureIsReused = 1 /* SafeModules */;
120081
120075
  modifiedSourceFiles.push(newSourceFile);
120082
- } else {
120083
- for (const moduleName of oldSourceFile.ambientModuleNames) {
120084
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
120085
- }
120086
120076
  }
120087
120077
  newSourceFiles.push(newSourceFile);
120088
120078
  }
@@ -124610,7 +124600,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
124610
124600
  let filesWithChangedSetOfUnresolvedImports;
124611
124601
  let filesWithInvalidatedResolutions;
124612
124602
  let filesWithInvalidatedNonRelativeUnresolvedImports;
124613
- const nonRelativeExternalModuleResolutions = createMultiMap();
124603
+ const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
124614
124604
  const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
124615
124605
  const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
124616
124606
  const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -124761,8 +124751,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
124761
124751
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
124762
124752
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
124763
124753
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
124764
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
124765
- nonRelativeExternalModuleResolutions.clear();
124754
+ watchFailedLookupLocationOfNonRelativeModuleResolutions();
124766
124755
  isSymlinkCache.clear();
124767
124756
  }
124768
124757
  function cleanupLibResolutionWatching(newProgram) {
@@ -124781,8 +124770,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
124781
124770
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
124782
124771
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
124783
124772
  allModuleAndTypeResolutionsAreInvalidated = false;
124784
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
124785
- nonRelativeExternalModuleResolutions.clear();
124773
+ watchFailedLookupLocationOfNonRelativeModuleResolutions();
124786
124774
  if (newProgram !== oldProgram) {
124787
124775
  cleanupLibResolutionWatching(newProgram);
124788
124776
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
@@ -125045,7 +125033,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125045
125033
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
125046
125034
  watchFailedLookupLocationOfResolution(resolution);
125047
125035
  } else {
125048
- nonRelativeExternalModuleResolutions.add(name, resolution);
125036
+ nonRelativeExternalModuleResolutions.add(resolution);
125049
125037
  }
125050
125038
  const resolved = getResolutionWithResolvedFileName(resolution);
125051
125039
  if (resolved && resolved.resolvedFileName) {
@@ -125181,17 +125169,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125181
125169
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
125182
125170
  packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
125183
125171
  }
125184
- function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
125185
- const program = resolutionHost.getCurrentProgram();
125186
- if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
125187
- resolutions.forEach(watchFailedLookupLocationOfResolution);
125188
- } else {
125189
- resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
125190
- resolution,
125191
- /*addToResolutionsWithOnlyAffectingLocations*/
125192
- true
125193
- ));
125194
- }
125172
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
125173
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
125174
+ nonRelativeExternalModuleResolutions.clear();
125195
125175
  }
125196
125176
  function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
125197
125177
  Debug.assert(!nonRecursive);
package/lib/typescript.js CHANGED
@@ -2251,7 +2251,7 @@ module.exports = __toCommonJS(typescript_exports);
2251
2251
 
2252
2252
  // src/compiler/corePublic.ts
2253
2253
  var versionMajorMinor = "5.6";
2254
- var version = `${versionMajorMinor}.0-dev.20240711`;
2254
+ var version = `${versionMajorMinor}.0-dev.20240713`;
2255
2255
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2256
2256
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2257
2257
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10141,7 +10141,7 @@ var Diagnostics = {
10141
10141
  Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
10142
10142
  Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
10143
10143
  Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
10144
- Property_0_of_exported_class_expression_may_not_be_private_or_protected: diag(4094, 1 /* Error */, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."),
10144
+ Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected: diag(4094, 1 /* Error */, "Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected_4094", "Property '{0}' of exported anonymous class type may not be private or protected."),
10145
10145
  Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4095, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_4095", "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."),
10146
10146
  Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4096, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4096", "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'."),
10147
10147
  Public_static_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4097, 1 /* Error */, "Public_static_method_0_of_exported_class_has_or_is_using_private_name_1_4097", "Public static method '{0}' of exported class has or is using private name '{1}'."),
@@ -10379,7 +10379,6 @@ var Diagnostics = {
10379
10379
  Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, 3 /* Message */, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", 'Parse in strict mode and emit "use strict" for each source file.'),
10380
10380
  Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, 1 /* Error */, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."),
10381
10381
  Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, 3 /* Message */, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."),
10382
- Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, 3 /* Message */, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."),
10383
10382
  Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, 3 /* Message */, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."),
10384
10383
  Resolution_for_module_0_was_found_in_cache_from_location_1: diag(6147, 3 /* Message */, "Resolution_for_module_0_was_found_in_cache_from_location_1_6147", "Resolution for module '{0}' was found in cache from location '{1}'."),
10385
10384
  Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, 3 /* Message */, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."),
@@ -50121,13 +50120,6 @@ function createTypeChecker(host) {
50121
50120
  /*withAugmentations*/
50122
50121
  true
50123
50122
  ),
50124
- tryFindAmbientModuleWithoutAugmentations: (moduleName) => {
50125
- return tryFindAmbientModule(
50126
- moduleName,
50127
- /*withAugmentations*/
50128
- false
50129
- );
50130
- },
50131
50123
  getApparentType,
50132
50124
  getUnionType,
50133
50125
  isTypeAssignableTo,
@@ -50670,6 +50662,7 @@ function createTypeChecker(host) {
50670
50662
  };
50671
50663
  var amalgamatedDuplicates;
50672
50664
  var reverseMappedCache = /* @__PURE__ */ new Map();
50665
+ var reverseHomomorphicMappedCache = /* @__PURE__ */ new Map();
50673
50666
  var ambientModulesCache;
50674
50667
  var patternAmbientModules;
50675
50668
  var patternAmbientModuleAugmentations;
@@ -54898,7 +54891,21 @@ function createTypeChecker(host) {
54898
54891
  }
54899
54892
  function shouldUsePlaceholderForProperty(propertySymbol, context) {
54900
54893
  var _a;
54901
- return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
54894
+ const depth = 3;
54895
+ return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */) || isDeeplyNestedReverseMappedTypeProperty());
54896
+ function isDeeplyNestedReverseMappedTypeProperty() {
54897
+ var _a2;
54898
+ if ((((_a2 = context.reverseMappedStack) == null ? void 0 : _a2.length) ?? 0) < depth) {
54899
+ return false;
54900
+ }
54901
+ for (let i = 0; i < depth; i++) {
54902
+ const prop = context.reverseMappedStack[context.reverseMappedStack.length - 1 - i];
54903
+ if (prop.links.mappedType.symbol !== propertySymbol.links.mappedType.symbol) {
54904
+ return false;
54905
+ }
54906
+ }
54907
+ return true;
54908
+ }
54902
54909
  }
54903
54910
  function addPropertyToElementList(propertySymbol, context, typeElements) {
54904
54911
  var _a;
@@ -70944,11 +70951,11 @@ function createTypeChecker(host) {
70944
70951
  }
70945
70952
  function inferTypeForHomomorphicMappedType(source, target, constraint) {
70946
70953
  const cacheKey = source.id + "," + target.id + "," + constraint.id;
70947
- if (reverseMappedCache.has(cacheKey)) {
70948
- return reverseMappedCache.get(cacheKey);
70954
+ if (reverseHomomorphicMappedCache.has(cacheKey)) {
70955
+ return reverseHomomorphicMappedCache.get(cacheKey);
70949
70956
  }
70950
70957
  const type = createReverseMappedType(source, target, constraint);
70951
- reverseMappedCache.set(cacheKey, type);
70958
+ reverseHomomorphicMappedCache.set(cacheKey, type);
70952
70959
  return type;
70953
70960
  }
70954
70961
  function isPartiallyInferableType(type) {
@@ -115831,7 +115838,10 @@ function transformDeclarations(context) {
115831
115838
  function reportPrivateInBaseOfClassExpression(propertyName) {
115832
115839
  if (errorNameNode || errorFallbackNode) {
115833
115840
  context.addDiagnostic(
115834
- createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected, propertyName)
115841
+ addRelatedInfo(
115842
+ createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected, propertyName),
115843
+ ...isVariableDeclaration((errorNameNode || errorFallbackNode).parent) ? [createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : []
115844
+ )
115835
115845
  );
115836
115846
  }
115837
115847
  }
@@ -124093,7 +124103,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124093
124103
  let commonSourceDirectory;
124094
124104
  let typeChecker;
124095
124105
  let classifiableNames;
124096
- const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
124097
124106
  let fileReasons = createMultiMap();
124098
124107
  let filesWithReferencesProcessed;
124099
124108
  let fileReasonsToChain;
@@ -124683,35 +124692,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124683
124692
  getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
124684
124693
  getResolved: getResolvedModuleFromResolution,
124685
124694
  canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
124686
- isEntryResolvingToAmbientModule: moduleNameResolvesToAmbientModule
124695
+ resolveToOwnAmbientModule: true
124687
124696
  });
124688
124697
  }
124689
- function moduleNameResolvesToAmbientModule(moduleName, file) {
124690
- if (contains(file.ambientModuleNames, moduleName.text)) {
124691
- if (isTraceEnabled(options, host)) {
124692
- trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
124693
- }
124694
- return true;
124695
- } else {
124696
- return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
124697
- }
124698
- }
124699
- function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file) {
124700
- var _a2;
124701
- const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
124702
- const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
124703
- if (resolutionToFile && resolvedFile) {
124704
- return false;
124705
- }
124706
- const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
124707
- if (!unmodifiedFile) {
124708
- return false;
124709
- }
124710
- if (isTraceEnabled(options, host)) {
124711
- trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
124712
- }
124713
- return true;
124714
- }
124715
124698
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
124716
124699
  const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
124717
124700
  return resolveNamesReusingOldState({
@@ -124739,10 +124722,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124739
124722
  getResolutionFromOldProgram,
124740
124723
  getResolved,
124741
124724
  canReuseResolutionsInFile,
124742
- isEntryResolvingToAmbientModule
124725
+ resolveToOwnAmbientModule
124743
124726
  }) {
124744
124727
  if (!entries.length) return emptyArray;
124745
- if (structureIsReused === 0 /* Not */ && (!isEntryResolvingToAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
124728
+ if (structureIsReused === 0 /* Not */ && (!resolveToOwnAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
124746
124729
  return resolutionWorker(
124747
124730
  entries,
124748
124731
  containingFile,
@@ -124778,12 +124761,23 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124778
124761
  continue;
124779
124762
  }
124780
124763
  }
124781
- if (isEntryResolvingToAmbientModule == null ? void 0 : isEntryResolvingToAmbientModule(entry, containingFile)) {
124782
- (result ?? (result = new Array(entries.length)))[i] = emptyResolution;
124783
- } else {
124784
- (unknownEntries ?? (unknownEntries = [])).push(entry);
124785
- (unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
124764
+ if (resolveToOwnAmbientModule) {
124765
+ const name = nameAndModeGetter.getName(entry);
124766
+ if (contains(containingSourceFile.ambientModuleNames, name)) {
124767
+ if (isTraceEnabled(options, host)) {
124768
+ trace(
124769
+ host,
124770
+ Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1,
124771
+ name,
124772
+ getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory)
124773
+ );
124774
+ }
124775
+ (result ?? (result = new Array(entries.length)))[i] = emptyResolution;
124776
+ continue;
124777
+ }
124786
124778
  }
124779
+ (unknownEntries ?? (unknownEntries = [])).push(entry);
124780
+ (unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
124787
124781
  }
124788
124782
  if (!unknownEntries) return result;
124789
124783
  const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
@@ -124917,10 +124911,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124917
124911
  } else if (hasInvalidatedResolutions(oldSourceFile.path)) {
124918
124912
  structureIsReused = 1 /* SafeModules */;
124919
124913
  modifiedSourceFiles.push(newSourceFile);
124920
- } else {
124921
- for (const moduleName of oldSourceFile.ambientModuleNames) {
124922
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
124923
- }
124924
124914
  }
124925
124915
  newSourceFiles.push(newSourceFile);
124926
124916
  }
@@ -129509,7 +129499,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
129509
129499
  let filesWithChangedSetOfUnresolvedImports;
129510
129500
  let filesWithInvalidatedResolutions;
129511
129501
  let filesWithInvalidatedNonRelativeUnresolvedImports;
129512
- const nonRelativeExternalModuleResolutions = createMultiMap();
129502
+ const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
129513
129503
  const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
129514
129504
  const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
129515
129505
  const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -129660,8 +129650,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
129660
129650
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
129661
129651
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
129662
129652
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
129663
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
129664
- nonRelativeExternalModuleResolutions.clear();
129653
+ watchFailedLookupLocationOfNonRelativeModuleResolutions();
129665
129654
  isSymlinkCache.clear();
129666
129655
  }
129667
129656
  function cleanupLibResolutionWatching(newProgram) {
@@ -129680,8 +129669,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
129680
129669
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
129681
129670
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
129682
129671
  allModuleAndTypeResolutionsAreInvalidated = false;
129683
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
129684
- nonRelativeExternalModuleResolutions.clear();
129672
+ watchFailedLookupLocationOfNonRelativeModuleResolutions();
129685
129673
  if (newProgram !== oldProgram) {
129686
129674
  cleanupLibResolutionWatching(newProgram);
129687
129675
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
@@ -129944,7 +129932,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
129944
129932
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
129945
129933
  watchFailedLookupLocationOfResolution(resolution);
129946
129934
  } else {
129947
- nonRelativeExternalModuleResolutions.add(name, resolution);
129935
+ nonRelativeExternalModuleResolutions.add(resolution);
129948
129936
  }
129949
129937
  const resolved = getResolutionWithResolvedFileName(resolution);
129950
129938
  if (resolved && resolved.resolvedFileName) {
@@ -130080,17 +130068,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
130080
130068
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
130081
130069
  packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
130082
130070
  }
130083
- function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
130084
- const program = resolutionHost.getCurrentProgram();
130085
- if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
130086
- resolutions.forEach(watchFailedLookupLocationOfResolution);
130087
- } else {
130088
- resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
130089
- resolution,
130090
- /*addToResolutionsWithOnlyAffectingLocations*/
130091
- true
130092
- ));
130093
- }
130071
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
130072
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
130073
+ nonRelativeExternalModuleResolutions.clear();
130094
130074
  }
130095
130075
  function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
130096
130076
  Debug.assert(!nonRecursive);
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.20240711",
5
+ "version": "5.6.0-dev.20240713",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "e450c463c610136ee86392f90025e03071334def"
116
+ "gitHead": "6d3be985c82bead3b41348de76efec8110c677c5"
117
117
  }