@typescript-deploys/pr-build 5.4.0-pr-56434-11 → 5.4.0-pr-56476-3

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/tsserver.js CHANGED
@@ -724,6 +724,7 @@ __export(server_exports, {
724
724
  getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
725
725
  getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
726
726
  getDocumentPositionMapper: () => getDocumentPositionMapper,
727
+ getDocumentSpansEqualityComparer: () => getDocumentSpansEqualityComparer,
727
728
  getESModuleInterop: () => getESModuleInterop,
728
729
  getEditsForFileRename: () => getEditsForFileRename,
729
730
  getEffectiveBaseTypeNode: () => getEffectiveBaseTypeNode,
@@ -2330,7 +2331,7 @@ module.exports = __toCommonJS(server_exports);
2330
2331
 
2331
2332
  // src/compiler/corePublic.ts
2332
2333
  var versionMajorMinor = "5.4";
2333
- var version = `${versionMajorMinor}.0-insiders.20231117`;
2334
+ var version = `${versionMajorMinor}.0-insiders.20231121`;
2334
2335
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2335
2336
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2336
2337
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3624,7 +3625,7 @@ function compareStringsCaseSensitive(a, b) {
3624
3625
  function getStringComparer(ignoreCase) {
3625
3626
  return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive;
3626
3627
  }
3627
- var createUIStringComparer = (() => {
3628
+ var createUIStringComparer = /* @__PURE__ */ (() => {
3628
3629
  return createIntlCollatorStringComparer;
3629
3630
  function compareWithCallback(a, b, comparer) {
3630
3631
  if (a === b)
@@ -9484,6 +9485,10 @@ var Diagnostics = {
9484
9485
  ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1286, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286", "ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
9485
9486
  A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1287, 1 /* Error */, "A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimM_1287", "A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
9486
9487
  An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled: diag(1288, 1 /* Error */, "An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabl_1288", "An import alias cannot resolve to a type or type-only declaration when 'verbatimModuleSyntax' is enabled."),
9488
+ _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1289, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1289", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
9489
+ _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
9490
+ _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
9491
+ _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
9487
9492
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
9488
9493
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
9489
9494
  The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -41243,34 +41248,39 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
41243
41248
  return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
41244
41249
  }
41245
41250
  }
41246
- function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) {
41247
- const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
41251
+ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
41252
+ const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
41248
41253
  const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
41249
41254
  const wildcardDirectories = {};
41255
+ const wildCardKeyToPath = /* @__PURE__ */ new Map();
41250
41256
  if (include !== void 0) {
41251
41257
  const recursiveKeys = [];
41252
41258
  for (const file of include) {
41253
- const spec = normalizePath(combinePaths(path, file));
41259
+ const spec = normalizePath(combinePaths(basePath, file));
41254
41260
  if (excludeRegex && excludeRegex.test(spec)) {
41255
41261
  continue;
41256
41262
  }
41257
41263
  const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
41258
41264
  if (match) {
41259
- const { key, flags } = match;
41260
- const existingFlags = wildcardDirectories[key];
41265
+ const { key, path, flags } = match;
41266
+ const existingPath = wildCardKeyToPath.get(key);
41267
+ const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
41261
41268
  if (existingFlags === void 0 || existingFlags < flags) {
41262
- wildcardDirectories[key] = flags;
41269
+ wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
41270
+ if (existingPath === void 0)
41271
+ wildCardKeyToPath.set(key, path);
41263
41272
  if (flags === 1 /* Recursive */) {
41264
41273
  recursiveKeys.push(key);
41265
41274
  }
41266
41275
  }
41267
41276
  }
41268
41277
  }
41269
- for (const key in wildcardDirectories) {
41270
- if (hasProperty(wildcardDirectories, key)) {
41278
+ for (const path in wildcardDirectories) {
41279
+ if (hasProperty(wildcardDirectories, path)) {
41271
41280
  for (const recursiveKey of recursiveKeys) {
41272
- if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) {
41273
- delete wildcardDirectories[key];
41281
+ const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
41282
+ if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
41283
+ delete wildcardDirectories[path];
41274
41284
  }
41275
41285
  }
41276
41286
  }
@@ -41278,6 +41288,9 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
41278
41288
  }
41279
41289
  return wildcardDirectories;
41280
41290
  }
41291
+ function toCanonicalKey(path, useCaseSensitiveFileNames2) {
41292
+ return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
41293
+ }
41281
41294
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
41282
41295
  const match = wildcardDirectoryPattern.exec(spec);
41283
41296
  if (match) {
@@ -41285,13 +41298,16 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
41285
41298
  const starWildcardIndex = spec.indexOf("*");
41286
41299
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
41287
41300
  return {
41288
- key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]),
41301
+ key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
41302
+ path: match[0],
41289
41303
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
41290
41304
  };
41291
41305
  }
41292
41306
  if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
41307
+ const path = removeTrailingDirectorySeparator(spec);
41293
41308
  return {
41294
- key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)),
41309
+ key: toCanonicalKey(path, useCaseSensitiveFileNames2),
41310
+ path,
41295
41311
  flags: 1 /* Recursive */
41296
41312
  };
41297
41313
  }
@@ -42038,22 +42054,50 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
42038
42054
  }
42039
42055
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
42040
42056
  let cache;
42041
- return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, entries, getInternalMap };
42057
+ let canonicalPathToCacheKey;
42058
+ return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, deletePackageJsonInfo, clear: clear2, entries };
42042
42059
  function getPackageJsonInfo2(packageJsonPath) {
42043
- return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
42060
+ if (!cache)
42061
+ return void 0;
42062
+ const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
42063
+ const result = cache.get(absolute);
42064
+ if (result !== void 0)
42065
+ return result;
42066
+ if (!canonicalPathToCacheKey)
42067
+ return void 0;
42068
+ const path = getCanonicalFileName(absolute);
42069
+ if (path === absolute)
42070
+ return void 0;
42071
+ const cacheKey = canonicalPathToCacheKey.get(path);
42072
+ return cacheKey !== void 0 ? cache.get(cacheKey) : void 0;
42044
42073
  }
42045
42074
  function setPackageJsonInfo(packageJsonPath, info) {
42046
- (cache || (cache = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
42075
+ const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
42076
+ (cache || (cache = /* @__PURE__ */ new Map())).set(absolute, info);
42077
+ const path = getCanonicalFileName(absolute);
42078
+ if (path !== absolute) {
42079
+ (canonicalPathToCacheKey ?? (canonicalPathToCacheKey = /* @__PURE__ */ new Map())).set(path, absolute);
42080
+ }
42081
+ }
42082
+ function deletePackageJsonInfo(packageJsonPath) {
42083
+ if (!cache)
42084
+ return;
42085
+ const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
42086
+ cache.delete(absolute);
42087
+ if (canonicalPathToCacheKey) {
42088
+ const path = getCanonicalFileName(absolute);
42089
+ const cacheKey = canonicalPathToCacheKey.get(path);
42090
+ if (cacheKey !== void 0) {
42091
+ cache.delete(cacheKey);
42092
+ canonicalPathToCacheKey.delete(path);
42093
+ }
42094
+ }
42047
42095
  }
42048
42096
  function clear2() {
42049
42097
  cache = void 0;
42050
42098
  }
42051
42099
  function entries() {
42052
- const iter = cache == null ? void 0 : cache.entries();
42053
- return iter ? arrayFrom(iter) : [];
42054
- }
42055
- function getInternalMap() {
42056
- return cache;
42100
+ return cache == null ? void 0 : cache.entries();
42057
42101
  }
42058
42102
  }
42059
42103
  function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
@@ -47107,8 +47151,8 @@ function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourc
47107
47151
  return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getPreferences({}, compilerOptions, importingSourceFile), {}, options);
47108
47152
  }
47109
47153
  function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
47110
- const info = getInfo(importingSourceFile.path, host);
47111
- const modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
47154
+ const info = getInfo(importingSourceFile.fileName, host);
47155
+ const modulePaths = getAllModulePaths(importingSourceFile.fileName, nodeModulesFileName, host, preferences, options);
47112
47156
  return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
47113
47157
  modulePath,
47114
47158
  info,
@@ -47185,7 +47229,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
47185
47229
  if (!moduleSourceFile)
47186
47230
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
47187
47231
  computedWithoutCache = true;
47188
- modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
47232
+ modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.fileName, moduleSourceFile.originalFileName, host));
47189
47233
  const result = computeModuleSpecifiers(
47190
47234
  modulePaths,
47191
47235
  compilerOptions,
@@ -47199,7 +47243,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
47199
47243
  return { moduleSpecifiers: result, computedWithoutCache };
47200
47244
  }
47201
47245
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
47202
- const info = getInfo(importingSourceFile.path, host);
47246
+ const info = getInfo(importingSourceFile.fileName, host);
47203
47247
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
47204
47248
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
47205
47249
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
@@ -47263,6 +47307,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
47263
47307
  return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? redirectPathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
47264
47308
  }
47265
47309
  function getInfo(importingSourceFileName, host) {
47310
+ importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
47266
47311
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
47267
47312
  const sourceDirectory = getDirectoryPath(importingSourceFileName);
47268
47313
  return { getCanonicalFileName, importingSourceFileName, sourceDirectory };
@@ -47297,7 +47342,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
47297
47342
  if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
47298
47343
  const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
47299
47344
  const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
47300
- const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
47345
+ const sourceIsInternal = startsWith(info.getCanonicalFileName(sourceDirectory), projectDirectory);
47301
47346
  const targetIsInternal = startsWith(modulePath, projectDirectory);
47302
47347
  if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
47303
47348
  return maybeNonRelative;
@@ -47370,8 +47415,9 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
47370
47415
  });
47371
47416
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
47372
47417
  }
47373
- function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options = {}) {
47418
+ function getAllModulePaths(importingFileName, importedFileName, host, preferences, options = {}) {
47374
47419
  var _a;
47420
+ const importingFilePath = toPath(importingFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
47375
47421
  const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
47376
47422
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
47377
47423
  if (cache) {
@@ -47379,7 +47425,7 @@ function getAllModulePaths(importingFilePath, importedFileName, host, preference
47379
47425
  if (cached == null ? void 0 : cached.modulePaths)
47380
47426
  return cached.modulePaths;
47381
47427
  }
47382
- const modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host);
47428
+ const modulePaths = getAllModulePathsWorker(importingFileName, importedFileName, host);
47383
47429
  if (cache) {
47384
47430
  cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
47385
47431
  }
@@ -47402,7 +47448,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
47402
47448
  }
47403
47449
  );
47404
47450
  const sortedPaths = [];
47405
- for (let directory = getDirectoryPath(importingFileName); allFileNames.size !== 0; ) {
47451
+ for (let directory = getDirectoryPath(getCanonicalFileName(importingFileName)); allFileNames.size !== 0; ) {
47406
47452
  const directoryStart = ensureTrailingDirectorySeparator(directory);
47407
47453
  let pathsInDirectory;
47408
47454
  allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
@@ -47423,7 +47469,10 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
47423
47469
  directory = newDirectory;
47424
47470
  }
47425
47471
  if (allFileNames.size) {
47426
- const remainingPaths = arrayFrom(allFileNames.values());
47472
+ const remainingPaths = arrayFrom(
47473
+ allFileNames.entries(),
47474
+ ([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
47475
+ );
47427
47476
  if (remainingPaths.length > 1)
47428
47477
  remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
47429
47478
  sortedPaths.push(...remainingPaths);
@@ -47627,7 +47676,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
47627
47676
  }
47628
47677
  const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
47629
47678
  const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
47630
- if (!(startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
47679
+ if (!(startsWith(getCanonicalFileName(sourceDirectory), pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
47631
47680
  return void 0;
47632
47681
  }
47633
47682
  const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
@@ -58922,7 +58971,12 @@ function createTypeChecker(host) {
58922
58971
  const checkType = type.checkType;
58923
58972
  const constraint = getLowerBoundOfKeyType(checkType);
58924
58973
  if (constraint !== checkType) {
58925
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
58974
+ return getConditionalTypeInstantiation(
58975
+ type,
58976
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
58977
+ /*forConstraint*/
58978
+ false
58979
+ );
58926
58980
  }
58927
58981
  }
58928
58982
  return type;
@@ -59274,7 +59328,12 @@ function createTypeChecker(host) {
59274
59328
  );
59275
59329
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
59276
59330
  if (constraint && constraint !== type.checkType) {
59277
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
59331
+ const instantiated = getConditionalTypeInstantiation(
59332
+ type,
59333
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
59334
+ /*forConstraint*/
59335
+ true
59336
+ );
59278
59337
  if (!(instantiated.flags & 131072 /* Never */)) {
59279
59338
  type.resolvedConstraintOfDistributive = instantiated;
59280
59339
  return instantiated;
@@ -62142,19 +62201,17 @@ function createTypeChecker(host) {
62142
62201
  return constraintType;
62143
62202
  }
62144
62203
  const keyTypes = [];
62145
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62146
- if (!isGenericIndexType(constraintType)) {
62147
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62148
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62149
- } else {
62204
+ if (isGenericIndexType(constraintType)) {
62205
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62150
62206
  return getIndexTypeForGenericType(type, indexFlags);
62151
62207
  }
62208
+ forEachType(constraintType, addMemberForKeyType);
62209
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62210
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62211
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62152
62212
  } else {
62153
62213
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
62154
62214
  }
62155
- if (isGenericIndexType(constraintType)) {
62156
- forEachType(constraintType, addMemberForKeyType);
62157
- }
62158
62215
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
62159
62216
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
62160
62217
  return constraintType;
@@ -62839,7 +62896,7 @@ function createTypeChecker(host) {
62839
62896
  function isDeferredType(type, checkTuples) {
62840
62897
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
62841
62898
  }
62842
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
62899
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
62843
62900
  let result;
62844
62901
  let extraTypes;
62845
62902
  let tailCount = 0;
@@ -62885,7 +62942,7 @@ function createTypeChecker(host) {
62885
62942
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
62886
62943
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
62887
62944
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
62888
- if (checkType.flags & 1 /* Any */) {
62945
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
62889
62946
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
62890
62947
  }
62891
62948
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -62995,7 +63052,9 @@ function createTypeChecker(host) {
62995
63052
  links.resolvedType = getConditionalType(
62996
63053
  root,
62997
63054
  /*mapper*/
62998
- void 0
63055
+ void 0,
63056
+ /*forConstraint*/
63057
+ false
62999
63058
  );
63000
63059
  if (outerTypeParameters) {
63001
63060
  root.instantiations = /* @__PURE__ */ new Map();
@@ -63850,17 +63909,17 @@ function createTypeChecker(host) {
63850
63909
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
63851
63910
  return result;
63852
63911
  }
63853
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
63912
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
63854
63913
  const root = type.root;
63855
63914
  if (root.outerTypeParameters) {
63856
63915
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
63857
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63916
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63858
63917
  let result = root.instantiations.get(id);
63859
63918
  if (!result) {
63860
63919
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
63861
63920
  const checkType = root.checkType;
63862
63921
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
63863
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
63922
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
63864
63923
  root.instantiations.set(id, result);
63865
63924
  }
63866
63925
  return result;
@@ -63948,7 +64007,14 @@ function createTypeChecker(host) {
63948
64007
  );
63949
64008
  }
63950
64009
  if (flags & 16777216 /* Conditional */) {
63951
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
64010
+ return getConditionalTypeInstantiation(
64011
+ type,
64012
+ combineTypeMappers(type.mapper, mapper),
64013
+ /*forConstraint*/
64014
+ false,
64015
+ aliasSymbol,
64016
+ aliasTypeArguments
64017
+ );
63952
64018
  }
63953
64019
  if (flags & 33554432 /* Substitution */) {
63954
64020
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -65592,7 +65658,7 @@ function createTypeChecker(host) {
65592
65658
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
65593
65659
  }
65594
65660
  if (target2.flags & 1048576 /* Union */) {
65595
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
65661
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
65596
65662
  }
65597
65663
  if (target2.flags & 2097152 /* Intersection */) {
65598
65664
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -65637,7 +65703,8 @@ function createTypeChecker(host) {
65637
65703
  sourceType,
65638
65704
  target2,
65639
65705
  /*reportErrors*/
65640
- false
65706
+ false,
65707
+ 0 /* None */
65641
65708
  );
65642
65709
  if (!related) {
65643
65710
  return 0 /* False */;
@@ -65646,7 +65713,7 @@ function createTypeChecker(host) {
65646
65713
  }
65647
65714
  return result2;
65648
65715
  }
65649
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
65716
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
65650
65717
  const targetTypes = target2.types;
65651
65718
  if (target2.flags & 1048576 /* Union */) {
65652
65719
  if (containsType(targetTypes, source2)) {
@@ -65664,7 +65731,10 @@ function createTypeChecker(host) {
65664
65731
  match,
65665
65732
  2 /* Target */,
65666
65733
  /*reportErrors*/
65667
- false
65734
+ false,
65735
+ /*headMessage*/
65736
+ void 0,
65737
+ intersectionState
65668
65738
  );
65669
65739
  if (related) {
65670
65740
  return related;
@@ -65677,7 +65747,10 @@ function createTypeChecker(host) {
65677
65747
  type,
65678
65748
  2 /* Target */,
65679
65749
  /*reportErrors*/
65680
- false
65750
+ false,
65751
+ /*headMessage*/
65752
+ void 0,
65753
+ intersectionState
65681
65754
  );
65682
65755
  if (related) {
65683
65756
  return related;
@@ -65691,7 +65764,10 @@ function createTypeChecker(host) {
65691
65764
  bestMatchingType,
65692
65765
  2 /* Target */,
65693
65766
  /*reportErrors*/
65694
- true
65767
+ true,
65768
+ /*headMessage*/
65769
+ void 0,
65770
+ intersectionState
65695
65771
  );
65696
65772
  }
65697
65773
  }
@@ -66489,13 +66565,6 @@ function createTypeChecker(host) {
66489
66565
  return result2;
66490
66566
  }
66491
66567
  }
66492
- } else {
66493
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66494
- if (distributiveConstraint) {
66495
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66496
- return result2;
66497
- }
66498
- }
66499
66568
  }
66500
66569
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
66501
66570
  if (defaultConstraint) {
@@ -66503,6 +66572,13 @@ function createTypeChecker(host) {
66503
66572
  return result2;
66504
66573
  }
66505
66574
  }
66575
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66576
+ if (distributiveConstraint) {
66577
+ resetErrorInfo(saveErrorInfo);
66578
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66579
+ return result2;
66580
+ }
66581
+ }
66506
66582
  } else {
66507
66583
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
66508
66584
  return -1 /* True */;
@@ -85374,10 +85450,11 @@ function createTypeChecker(host) {
85374
85450
  node
85375
85451
  ));
85376
85452
  if (sym) {
85453
+ const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
85377
85454
  markAliasReferenced(sym, id);
85378
85455
  if (getSymbolFlags(sym) & 111551 /* Value */) {
85379
85456
  checkExpressionCached(id);
85380
- if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
85457
+ if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
85381
85458
  error2(
85382
85459
  id,
85383
85460
  node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
@@ -85391,6 +85468,33 @@ function createTypeChecker(host) {
85391
85468
  idText(id)
85392
85469
  );
85393
85470
  }
85471
+ if (!isIllegalExportDefaultInCJS && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
85472
+ if (sym.flags & 2097152 /* Alias */ && resolveAlias(sym) !== unknownSymbol && getSymbolFlags(
85473
+ sym,
85474
+ /*excludeTypeOnlyMeanings*/
85475
+ false,
85476
+ /*excludeLocalMeanings*/
85477
+ true
85478
+ ) & 788968 /* Type */ && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
85479
+ error2(
85480
+ id,
85481
+ node.isExportEquals ? Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported : Diagnostics._0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default,
85482
+ idText(id),
85483
+ isolatedModulesLikeFlagName
85484
+ );
85485
+ } else if (typeOnlyDeclaration && getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node)) {
85486
+ addTypeOnlyDeclarationRelatedInfo(
85487
+ error2(
85488
+ id,
85489
+ node.isExportEquals ? Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default,
85490
+ idText(id),
85491
+ isolatedModulesLikeFlagName
85492
+ ),
85493
+ typeOnlyDeclaration,
85494
+ idText(id)
85495
+ );
85496
+ }
85497
+ }
85394
85498
  } else {
85395
85499
  checkExpressionCached(id);
85396
85500
  }
@@ -86785,7 +86889,11 @@ function createTypeChecker(host) {
86785
86889
  const exportClause = node.exportClause;
86786
86890
  return !!exportClause && (isNamespaceExport(exportClause) || some(exportClause.elements, isValueAliasDeclaration));
86787
86891
  case 277 /* ExportAssignment */:
86788
- return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfDeclaration(node)) : true;
86892
+ return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(
86893
+ getSymbolOfDeclaration(node),
86894
+ /*excludeTypeOnlyValues*/
86895
+ true
86896
+ ) : true;
86789
86897
  }
86790
86898
  return false;
86791
86899
  }
@@ -86803,7 +86911,7 @@ function createTypeChecker(host) {
86803
86911
  }
86804
86912
  const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
86805
86913
  if (target === unknownSymbol) {
86806
- return true;
86914
+ return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol);
86807
86915
  }
86808
86916
  return !!(getSymbolFlags(
86809
86917
  symbol,
@@ -112807,8 +112915,8 @@ function transformDeclarations(context) {
112807
112915
  const specifier = getModuleSpecifier(
112808
112916
  options,
112809
112917
  currentSourceFile,
112810
- toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
112811
- toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
112918
+ getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
112919
+ getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
112812
112920
  host
112813
112921
  );
112814
112922
  if (!pathIsRelative(specifier)) {
@@ -120245,8 +120353,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
120245
120353
  }
120246
120354
  const baseName = getBaseNameOfFileName(fileOrDirectory);
120247
120355
  const fsQueryResult = {
120248
- fileExists: host.fileExists(fileOrDirectoryPath),
120249
- directoryExists: host.directoryExists(fileOrDirectoryPath)
120356
+ fileExists: host.fileExists(fileOrDirectory),
120357
+ directoryExists: host.directoryExists(fileOrDirectory)
120250
120358
  };
120251
120359
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
120252
120360
  clearCache();
@@ -120346,11 +120454,9 @@ function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWa
120346
120454
  );
120347
120455
  }
120348
120456
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
120349
- const missingFilePaths = program.getMissingFilePaths();
120350
- const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
120351
120457
  mutateMap(
120352
120458
  missingFileWatches,
120353
- newMissingFilePathMap,
120459
+ program.getMissingFilePaths(),
120354
120460
  {
120355
120461
  // Watch the missing files
120356
120462
  createNewValue: createMissingFileWatch,
@@ -121210,7 +121316,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
121210
121316
  return false;
121211
121317
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
121212
121318
  return false;
121213
- if (program.getMissingFilePaths().some(fileExists))
121319
+ const missingPaths = program.getMissingFilePaths();
121320
+ if (missingPaths && forEachEntry(missingPaths, fileExists))
121214
121321
  return false;
121215
121322
  const currentOptions = program.getCompilerOptions();
121216
121323
  if (!compareDataObjects(currentOptions, newOptions))
@@ -121514,7 +121621,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121514
121621
  let redirectTargetsMap = createMultiMap();
121515
121622
  let usesUriStyleNodeCoreModules = false;
121516
121623
  const filesByName = /* @__PURE__ */ new Map();
121517
- let missingFilePaths;
121624
+ let missingFileNames = /* @__PURE__ */ new Map();
121518
121625
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
121519
121626
  let resolvedProjectReferences;
121520
121627
  let projectReferenceRedirects;
@@ -121633,12 +121740,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121633
121740
  });
121634
121741
  }
121635
121742
  }
121636
- missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
121637
121743
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
121638
121744
  processingDefaultLibFiles = void 0;
121639
121745
  processingOtherFiles = void 0;
121640
121746
  }
121641
- Debug.assert(!!missingFilePaths);
121642
121747
  if (oldProgram && host.onReleaseOldSourceFile) {
121643
121748
  const oldSourceFiles = oldProgram.getSourceFiles();
121644
121749
  for (const oldSourceFile of oldSourceFiles) {
@@ -121683,8 +121788,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121683
121788
  getSourceFile,
121684
121789
  getSourceFileByPath,
121685
121790
  getSourceFiles: () => files,
121686
- getMissingFilePaths: () => missingFilePaths,
121687
- // TODO: GH#18217
121791
+ getMissingFilePaths: () => missingFileNames,
121688
121792
  getModuleResolutionCache: () => moduleResolutionCache,
121689
121793
  getFilesByNameMap: () => filesByName,
121690
121794
  getCompilerOptions: () => options,
@@ -122111,7 +122215,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122111
122215
  const newSourceFiles = [];
122112
122216
  const modifiedSourceFiles = [];
122113
122217
  structureIsReused = 2 /* Completely */;
122114
- if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
122218
+ if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
122115
122219
  return 0 /* Not */;
122116
122220
  }
122117
122221
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -122251,7 +122355,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122251
122355
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
122252
122356
  return 1 /* SafeModules */;
122253
122357
  }
122254
- missingFilePaths = oldProgram.getMissingFilePaths();
122358
+ missingFileNames = oldProgram.getMissingFilePaths();
122255
122359
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
122256
122360
  for (const newSourceFile of newSourceFiles) {
122257
122361
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -122308,7 +122412,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122308
122412
  const path = toPath3(f);
122309
122413
  if (getSourceFileByPath(path))
122310
122414
  return true;
122311
- if (contains(missingFilePaths, path))
122415
+ if (missingFileNames.has(path))
122312
122416
  return false;
122313
122417
  return host.fileExists(f);
122314
122418
  },
@@ -123120,6 +123224,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123120
123224
  addFileToFilesByName(
123121
123225
  file2,
123122
123226
  path,
123227
+ fileName,
123123
123228
  /*redirectedPath*/
123124
123229
  void 0
123125
123230
  );
@@ -123192,7 +123297,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123192
123297
  if (fileFromPackageId) {
123193
123298
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
123194
123299
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
123195
- addFileToFilesByName(dupFile, path, redirectedPath);
123300
+ addFileToFilesByName(dupFile, path, fileName, redirectedPath);
123196
123301
  addFileIncludeReason(dupFile, reason);
123197
123302
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123198
123303
  processingOtherFiles.push(dupFile);
@@ -123202,7 +123307,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123202
123307
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123203
123308
  }
123204
123309
  }
123205
- addFileToFilesByName(file, path, redirectedPath);
123310
+ addFileToFilesByName(file, path, fileName, redirectedPath);
123206
123311
  if (file) {
123207
123312
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
123208
123313
  file.fileName = fileName;
@@ -123242,14 +123347,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123242
123347
  if (file)
123243
123348
  fileReasons.add(file.path, reason);
123244
123349
  }
123245
- function addFileToFilesByName(file, path, redirectedPath) {
123350
+ function addFileToFilesByName(file, path, fileName, redirectedPath) {
123246
123351
  if (redirectedPath) {
123247
- filesByName.set(redirectedPath, file);
123248
- filesByName.set(path, file || false);
123352
+ updateFilesByNameMap(fileName, redirectedPath, file);
123353
+ updateFilesByNameMap(fileName, path, file || false);
123249
123354
  } else {
123250
- filesByName.set(path, file);
123355
+ updateFilesByNameMap(fileName, path, file);
123251
123356
  }
123252
123357
  }
123358
+ function updateFilesByNameMap(fileName, path, file) {
123359
+ filesByName.set(path, file);
123360
+ if (file !== void 0)
123361
+ missingFileNames.delete(path);
123362
+ else
123363
+ missingFileNames.set(path, fileName);
123364
+ }
123253
123365
  function getProjectReferenceRedirect(fileName) {
123254
123366
  const referencedProject = getProjectReferenceRedirectProject(fileName);
123255
123367
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -123570,6 +123682,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123570
123682
  /*file*/
123571
123683
  void 0,
123572
123684
  sourceFilePath,
123685
+ refPath,
123573
123686
  /*redirectedPath*/
123574
123687
  void 0
123575
123688
  );
@@ -123581,6 +123694,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123581
123694
  addFileToFilesByName(
123582
123695
  sourceFile,
123583
123696
  sourceFilePath,
123697
+ refPath,
123584
123698
  /*redirectedPath*/
123585
123699
  void 0
123586
123700
  );
@@ -123590,6 +123704,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123590
123704
  addFileToFilesByName(
123591
123705
  sourceFile,
123592
123706
  sourceFilePath,
123707
+ refPath,
123593
123708
  /*redirectedPath*/
123594
123709
  void 0
123595
123710
  );
@@ -127126,7 +127241,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127126
127241
  const watcher = {
127127
127242
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
127128
127243
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
127129
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
127244
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
127130
127245
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127131
127246
  }) : noopFileWatcher,
127132
127247
  resolutions: isSymlink ? 0 : resolutions,
@@ -127166,7 +127281,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127166
127281
  if (watcher == null ? void 0 : watcher.files)
127167
127282
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
127168
127283
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
127169
- packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
127284
+ packageJsonMap.deletePackageJsonInfo(path);
127170
127285
  }
127171
127286
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
127172
127287
  const program = resolutionHost.getCurrentProgram();
@@ -127351,9 +127466,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127351
127466
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127352
127467
  }
127353
127468
  function invalidatePackageJsonMap() {
127354
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
127469
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
127355
127470
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
127356
- packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
127471
+ for (const key of packageJsonMap) {
127472
+ const path = resolutionHost.toPath(key[0]);
127473
+ if (isInvalidatedFailedLookup(path)) {
127474
+ moduleResolutionCache.getPackageJsonInfoCache().deletePackageJsonInfo(key[0]);
127475
+ }
127476
+ }
127357
127477
  }
127358
127478
  }
127359
127479
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -128395,7 +128515,11 @@ function createWatchProgram(host) {
128395
128515
  const oldProgram = getCurrentProgram();
128396
128516
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
128397
128517
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
128398
- updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
128518
+ updateMissingFilePathsWatch(
128519
+ builderProgram.getProgram(),
128520
+ missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
128521
+ watchMissingFilePath
128522
+ );
128399
128523
  if (needsUpdateInTypeRootWatch) {
128400
128524
  resolutionCache.updateTypeRootsWatch();
128401
128525
  }
@@ -128688,8 +128812,15 @@ function createWatchProgram(host) {
128688
128812
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
128689
128813
  }
128690
128814
  }
128691
- function watchMissingFilePath(missingFilePath) {
128692
- return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
128815
+ function watchMissingFilePath(missingFilePath, missingFileName) {
128816
+ return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
128817
+ missingFilePath,
128818
+ missingFileName,
128819
+ onMissingFileChange,
128820
+ 500 /* Medium */,
128821
+ watchOptions,
128822
+ WatchType.MissingFile
128823
+ );
128693
128824
  }
128694
128825
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
128695
128826
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -129185,6 +129316,7 @@ function createStateBuildOrder(state) {
129185
129316
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
129186
129317
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
129187
129318
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
129319
+ mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
129188
129320
  if (state.watch) {
129189
129321
  mutateMapSkippingNewValues(
129190
129322
  state.allWatchedConfigFiles,
@@ -129439,7 +129571,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129439
129571
  return withProgramOrUndefined(action) || emptyArray;
129440
129572
  }
129441
129573
  function createProgram2() {
129442
- var _a, _b;
129574
+ var _a, _b, _c;
129443
129575
  Debug.assert(program === void 0);
129444
129576
  if (state.options.dry) {
129445
129577
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -129468,12 +129600,16 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129468
129600
  config.projectReferences
129469
129601
  );
129470
129602
  if (state.watch) {
129603
+ const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
129471
129604
  state.lastCachedPackageJsonLookups.set(
129472
129605
  projectPath,
129473
- state.moduleResolutionCache && map(
129474
- state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
129475
- ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
129476
- )
129606
+ entries && new Map(arrayFrom(
129607
+ entries,
129608
+ ([path, data]) => {
129609
+ path = state.host.realpath && data ? state.host.realpath(path) : path;
129610
+ return [toPath2(state, path), path];
129611
+ }
129612
+ ))
129477
129613
  );
129478
129614
  state.builderPrograms.set(projectPath, program);
129479
129615
  }
@@ -130206,9 +130342,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
130206
130342
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
130207
130343
  if (extendedConfigStatus)
130208
130344
  return extendedConfigStatus;
130209
- const dependentPackageFileStatus = forEach(
130210
- state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
130211
- ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130345
+ const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
130346
+ const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
130347
+ packageJsonLookups,
130348
+ (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130212
130349
  );
130213
130350
  if (dependentPackageFileStatus)
130214
130351
  return dependentPackageFileStatus;
@@ -130619,9 +130756,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
130619
130756
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
130620
130757
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
130621
130758
  {
130622
- createNewValue: (path, _input) => watchFile(
130759
+ createNewValue: (_path, input) => watchFile(
130623
130760
  state,
130624
- path,
130761
+ input,
130625
130762
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130626
130763
  2e3 /* High */,
130627
130764
  parsed == null ? void 0 : parsed.watchOptions,
@@ -133170,8 +133307,11 @@ function getTypeKeywordOfTypeOnlyImport(importClause, sourceFile) {
133170
133307
  function textSpansEqual(a, b) {
133171
133308
  return !!a && !!b && a.start === b.start && a.length === b.length;
133172
133309
  }
133173
- function documentSpansEqual(a, b) {
133174
- return a.fileName === b.fileName && textSpansEqual(a.textSpan, b.textSpan);
133310
+ function documentSpansEqual(a, b, useCaseSensitiveFileNames2) {
133311
+ return (useCaseSensitiveFileNames2 ? equateStringsCaseSensitive : equateStringsCaseInsensitive)(a.fileName, b.fileName) && textSpansEqual(a.textSpan, b.textSpan);
133312
+ }
133313
+ function getDocumentSpansEqualityComparer(useCaseSensitiveFileNames2) {
133314
+ return (a, b) => documentSpansEqual(a, b, useCaseSensitiveFileNames2);
133175
133315
  }
133176
133316
  function forEachUnique(array, callback) {
133177
133317
  if (array) {
@@ -133429,7 +133569,8 @@ function buildLinkParts(link, checker) {
133429
133569
  if (text)
133430
133570
  parts.push(linkTextPart(text));
133431
133571
  } else {
133432
- parts.push(linkTextPart(name + (suffix ? "" : " ") + text));
133572
+ const separator = suffix === 0 || link.text.charCodeAt(suffix) === 124 /* bar */ && name.charCodeAt(name.length - 1) !== 32 /* space */ ? " " : "";
133573
+ parts.push(linkTextPart(name + separator + text));
133433
133574
  }
133434
133575
  }
133435
133576
  parts.push(linkPart("}"));
@@ -136400,7 +136541,7 @@ function updateImports(program, changeTracker, oldToNew, newToOld, host, getCano
136400
136541
  if ((importedModuleSymbol == null ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some((d) => isAmbientModule(d)))
136401
136542
  return void 0;
136402
136543
  const toImport = oldFromNew !== void 0 ? getSourceFileToImportFromResolved(importLiteral, resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles) : getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
136403
- return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && pathIsRelative(importLiteral.text)) ? ts_moduleSpecifiers_exports.updateModuleSpecifier(program.getCompilerOptions(), sourceFile, getCanonicalFileName(newImportFromPath), toImport.newFileName, createModuleSpecifierResolutionHost(program, host), importLiteral.text) : void 0;
136544
+ return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && pathIsRelative(importLiteral.text)) ? ts_moduleSpecifiers_exports.updateModuleSpecifier(program.getCompilerOptions(), sourceFile, newImportFromPath, toImport.newFileName, createModuleSpecifierResolutionHost(program, host), importLiteral.text) : void 0;
136404
136545
  });
136405
136546
  }
136406
136547
  }
@@ -137239,11 +137380,11 @@ function getSourceMapper(host) {
137239
137380
  const fileFromCache = sourceFileLike.get(path);
137240
137381
  if (fileFromCache !== void 0)
137241
137382
  return fileFromCache ? fileFromCache : void 0;
137242
- if (!host.readFile || host.fileExists && !host.fileExists(path)) {
137383
+ if (!host.readFile || host.fileExists && !host.fileExists(fileName)) {
137243
137384
  sourceFileLike.set(path, false);
137244
137385
  return void 0;
137245
137386
  }
137246
- const text = host.readFile(path);
137387
+ const text = host.readFile(fileName);
137247
137388
  const file = text ? createSourceFileLike(text) : false;
137248
137389
  sourceFileLike.set(path, file);
137249
137390
  return file ? file : void 0;
@@ -139796,7 +139937,7 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
139796
139937
  const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
139797
139938
  const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
139798
139939
  if (fileName && targetSourceFile) {
139799
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
139940
+ const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
139800
139941
  append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
139801
139942
  } else {
139802
139943
  append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
@@ -139874,7 +140015,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
139874
140015
  };
139875
140016
  deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
139876
140017
  const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName);
139877
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
140018
+ const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
139878
140019
  const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
139879
140020
  if (newImportDeclaration)
139880
140021
  changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
@@ -140009,7 +140150,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
140009
140150
  }
140010
140151
  function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
140011
140152
  const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension);
140012
- const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
140153
+ const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
140013
140154
  if (useEs6Imports) {
140014
140155
  const specifiers = imports.map((i) => factory.createImportSpecifier(
140015
140156
  /*isTypeOnly*/
@@ -160411,6 +160552,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160411
160552
  }
160412
160553
  return void 0;
160413
160554
  }
160555
+ function isInDifferentLineThanContextToken(contextToken2, position2) {
160556
+ return sourceFile.getLineEndOfPosition(contextToken2.getEnd()) < position2;
160557
+ }
160414
160558
  function isSolelyIdentifierDefinitionLocation(contextToken2) {
160415
160559
  const parent2 = contextToken2.parent;
160416
160560
  const containingNodeKind = parent2.kind;
@@ -160452,11 +160596,19 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160452
160596
  case 139 /* GetKeyword */:
160453
160597
  case 153 /* SetKeyword */:
160454
160598
  return !isFromObjectTypeDeclaration(contextToken2);
160455
- case 80 /* Identifier */:
160599
+ case 80 /* Identifier */: {
160456
160600
  if (containingNodeKind === 276 /* ImportSpecifier */ && contextToken2 === parent2.name && contextToken2.text === "type") {
160457
160601
  return false;
160458
160602
  }
160603
+ const ancestorVariableDeclaration = findAncestor(
160604
+ contextToken2.parent,
160605
+ isVariableDeclaration
160606
+ );
160607
+ if (ancestorVariableDeclaration && isInDifferentLineThanContextToken(contextToken2, position)) {
160608
+ return false;
160609
+ }
160459
160610
  break;
160611
+ }
160460
160612
  case 86 /* ClassKeyword */:
160461
160613
  case 94 /* EnumKeyword */:
160462
160614
  case 120 /* InterfaceKeyword */:
@@ -163900,6 +164052,10 @@ var Core;
163900
164052
  getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent2, search, state, addReferencesHere);
163901
164053
  return;
163902
164054
  }
164055
+ if (isJSDocPropertyLikeTag(parent2) && parent2.isNameFirst && parent2.typeExpression && isJSDocTypeLiteral(parent2.typeExpression.type) && parent2.typeExpression.type.jsDocPropertyTags && length(parent2.typeExpression.type.jsDocPropertyTags)) {
164056
+ getReferencesAtJSDocTypeLiteral(parent2.typeExpression.type.jsDocPropertyTags, referenceLocation, search, state);
164057
+ return;
164058
+ }
163903
164059
  const relatedSymbol = getRelatedSymbol(search, referenceSymbol, referenceLocation, state);
163904
164060
  if (!relatedSymbol) {
163905
164061
  getReferenceForShorthandProperty(referenceSymbol, search, state);
@@ -163926,6 +164082,15 @@ var Core;
163926
164082
  }
163927
164083
  getImportOrExportReferences(referenceLocation, referenceSymbol, search, state);
163928
164084
  }
164085
+ function getReferencesAtJSDocTypeLiteral(jsDocPropertyTags, referenceLocation, search, state) {
164086
+ const addRef = state.referenceAdder(search.symbol);
164087
+ addReference(referenceLocation, search.symbol, state);
164088
+ forEach(jsDocPropertyTags, (propTag) => {
164089
+ if (isQualifiedName(propTag.name)) {
164090
+ addRef(propTag.name.left);
164091
+ }
164092
+ });
164093
+ }
163929
164094
  function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state, addReferencesHere, alwaysGetReferences) {
163930
164095
  Debug.assert(!alwaysGetReferences || !!state.options.providePrefixAndSuffixTextForRename, "If alwaysGetReferences is true, then prefix/suffix text must be enabled");
163931
164096
  const { parent: parent2, propertyName, name } = exportSpecifier;
@@ -173493,6 +173658,7 @@ __export(ts_exports2, {
173493
173658
  getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
173494
173659
  getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
173495
173660
  getDocumentPositionMapper: () => getDocumentPositionMapper,
173661
+ getDocumentSpansEqualityComparer: () => getDocumentSpansEqualityComparer,
173496
173662
  getESModuleInterop: () => getESModuleInterop,
173497
173663
  getEditsForFileRename: () => getEditsForFileRename,
173498
173664
  getEffectiveBaseTypeNode: () => getEffectiveBaseTypeNode,
@@ -177424,6 +177590,7 @@ var Project3 = class _Project {
177424
177590
  this.resolutionCache.clear();
177425
177591
  this.resolutionCache = void 0;
177426
177592
  this.cachedUnresolvedImportsPerFile = void 0;
177593
+ this.moduleSpecifierCache.clear();
177427
177594
  this.moduleSpecifierCache = void 0;
177428
177595
  this.directoryStructureHost = void 0;
177429
177596
  this.exportMapCache = void 0;
@@ -177839,7 +178006,7 @@ var Project3 = class _Project {
177839
178006
  this.program,
177840
178007
  this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
177841
178008
  // Watch the missing files
177842
- (missingFilePath) => this.addMissingFileWatcher(missingFilePath)
178009
+ (missingFilePath, missingFileName) => this.addMissingFileWatcher(missingFilePath, missingFileName)
177843
178010
  );
177844
178011
  if (this.generatedFilesMap) {
177845
178012
  const outPath = outFile(this.compilerOptions);
@@ -177953,7 +178120,7 @@ var Project3 = class _Project {
177953
178120
  }
177954
178121
  }
177955
178122
  }
177956
- addMissingFileWatcher(missingFilePath) {
178123
+ addMissingFileWatcher(missingFilePath, missingFileName) {
177957
178124
  var _a;
177958
178125
  if (isConfiguredProject(this)) {
177959
178126
  const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(missingFilePath);
@@ -177961,7 +178128,7 @@ var Project3 = class _Project {
177961
178128
  return noopFileWatcher;
177962
178129
  }
177963
178130
  const fileWatcher = this.projectService.watchFactory.watchFile(
177964
- missingFilePath,
178131
+ getNormalizedAbsolutePath(missingFileName, this.currentDirectory),
177965
178132
  (fileName, eventKind) => {
177966
178133
  if (isConfiguredProject(this)) {
177967
178134
  this.getCachedDirectoryStructureHost().addOrDeleteFile(fileName, missingFilePath, eventKind);
@@ -178307,7 +178474,7 @@ var Project3 = class _Project {
178307
178474
  /** @internal */
178308
178475
  getPackageJsonsForAutoImport(rootDir) {
178309
178476
  const packageJsons = this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
178310
- this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => p.fileName));
178477
+ this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => this.projectService.toPath(p.fileName)));
178311
178478
  return packageJsons;
178312
178479
  }
178313
178480
  /** @internal */
@@ -178394,7 +178561,7 @@ var Project3 = class _Project {
178394
178561
  }
178395
178562
  /** @internal */
178396
178563
  watchNodeModulesForPackageJsonChanges(directoryPath) {
178397
- return this.projectService.watchPackageJsonsInNodeModules(this.toPath(directoryPath), this);
178564
+ return this.projectService.watchPackageJsonsInNodeModules(directoryPath, this);
178398
178565
  }
178399
178566
  /** @internal */
178400
178567
  getIncompleteCompletionsCache() {
@@ -179975,13 +180142,13 @@ var _ProjectService = class _ProjectService {
179975
180142
  (fileOrDirectory) => {
179976
180143
  const fileOrDirectoryPath = this.toPath(fileOrDirectory);
179977
180144
  const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
179978
- if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectoryPath))) {
180145
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
179979
180146
  this.logger.info(`Config: ${configFileName} Detected new package.json: ${fileOrDirectory}`);
179980
- this.onAddPackageJson(fileOrDirectoryPath);
180147
+ this.onAddPackageJson(this.getNormalizedAbsolutePath(fileOrDirectory), fileOrDirectoryPath);
179981
180148
  }
179982
180149
  const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
179983
180150
  if (isIgnoredFileFromWildCardWatching({
179984
- watchedDirPath: directory,
180151
+ watchedDirPath: this.toPath(directory),
179985
180152
  fileOrDirectory,
179986
180153
  fileOrDirectoryPath,
179987
180154
  configFileName,
@@ -180852,7 +181019,7 @@ var _ProjectService = class _ProjectService {
180852
181019
  if (value.info) {
180853
181020
  project.removeFile(
180854
181021
  value.info,
180855
- project.fileExists(path),
181022
+ project.fileExists(value.info.fileName),
180856
181023
  /*detachFromProject*/
180857
181024
  true
180858
181025
  );
@@ -181084,7 +181251,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181084
181251
  watchClosedScriptInfo(info) {
181085
181252
  Debug.assert(!info.fileWatcher);
181086
181253
  if (!info.isDynamicOrHasMixedContent() && (!this.globalCacheLocationDirectoryPath || !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
181087
- const indexOfNodeModules = info.path.indexOf("/node_modules/");
181254
+ const indexOfNodeModules = info.fileName.indexOf("/node_modules/");
181088
181255
  if (!this.host.getModifiedTime || indexOfNodeModules === -1) {
181089
181256
  info.fileWatcher = this.watchFactory.watchFile(
181090
181257
  info.fileName,
@@ -181095,12 +181262,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181095
181262
  );
181096
181263
  } else {
181097
181264
  info.mTime = this.getModifiedTime(info);
181098
- info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.path.substr(0, indexOfNodeModules));
181265
+ info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.fileName.substring(0, indexOfNodeModules));
181099
181266
  }
181100
181267
  }
181101
181268
  }
181102
- createNodeModulesWatcher(dir) {
181103
- const watcher = this.watchFactory.watchDirectory(
181269
+ createNodeModulesWatcher(dir, dirPath) {
181270
+ let watcher = this.watchFactory.watchDirectory(
181104
181271
  dir,
181105
181272
  (fileOrDirectory) => {
181106
181273
  var _a;
@@ -181115,8 +181282,8 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181115
181282
  });
181116
181283
  }
181117
181284
  if (result.refreshScriptInfoRefCount) {
181118
- if (dir === fileOrDirectoryPath) {
181119
- this.refreshScriptInfosInDirectory(dir);
181285
+ if (dirPath === fileOrDirectoryPath) {
181286
+ this.refreshScriptInfosInDirectory(dirPath);
181120
181287
  } else {
181121
181288
  const info = this.getScriptInfoForPath(fileOrDirectoryPath);
181122
181289
  if (info) {
@@ -181139,29 +181306,34 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181139
181306
  close: () => {
181140
181307
  var _a;
181141
181308
  if (!result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
181142
- watcher.close();
181143
- this.nodeModulesWatchers.delete(dir);
181309
+ watcher == null ? void 0 : watcher.close();
181310
+ watcher = void 0;
181311
+ this.nodeModulesWatchers.delete(dirPath);
181144
181312
  }
181145
181313
  }
181146
181314
  };
181147
- this.nodeModulesWatchers.set(dir, result);
181315
+ this.nodeModulesWatchers.set(dirPath, result);
181148
181316
  return result;
181149
181317
  }
181150
181318
  /** @internal */
181151
181319
  watchPackageJsonsInNodeModules(dir, project) {
181152
- const watcher = this.nodeModulesWatchers.get(dir) || this.createNodeModulesWatcher(dir);
181320
+ var _a;
181321
+ const dirPath = this.toPath(dir);
181322
+ const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
181323
+ Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project.getProjectName())));
181153
181324
  (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project.getProjectName());
181154
181325
  return {
181155
181326
  close: () => {
181156
- var _a;
181157
- (_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.delete(project.getProjectName());
181327
+ var _a2;
181328
+ (_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project.getProjectName());
181158
181329
  watcher.close();
181159
181330
  }
181160
181331
  };
181161
181332
  }
181162
181333
  watchClosedScriptInfoInNodeModules(dir) {
181163
181334
  const watchDir = dir + "/node_modules";
181164
- const watcher = this.nodeModulesWatchers.get(watchDir) || this.createNodeModulesWatcher(watchDir);
181335
+ const watchedDirPath = this.toPath(watchDir);
181336
+ const watcher = this.nodeModulesWatchers.get(watchedDirPath) || this.createNodeModulesWatcher(watchDir, watchedDirPath);
181165
181337
  watcher.refreshScriptInfoRefCount++;
181166
181338
  return {
181167
181339
  close: () => {
@@ -181171,7 +181343,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181171
181343
  };
181172
181344
  }
181173
181345
  getModifiedTime(info) {
181174
- return (this.host.getModifiedTime(info.path) || missingFileModifiedTime).getTime();
181346
+ return (this.host.getModifiedTime(info.fileName) || missingFileModifiedTime).getTime();
181175
181347
  }
181176
181348
  refreshScriptInfo(info) {
181177
181349
  const mTime = this.getModifiedTime(info);
@@ -182360,7 +182532,6 @@ Dynamic files must always be opened with service's current directory or service
182360
182532
  getPackageJsonsVisibleToFile(fileName, rootDir) {
182361
182533
  const packageJsonCache = this.packageJsonCache;
182362
182534
  const rootPath = rootDir && this.toPath(rootDir);
182363
- const filePath = this.toPath(fileName);
182364
182535
  const result = [];
182365
182536
  const processDirectory = (directory) => {
182366
182537
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
@@ -182369,7 +182540,7 @@ Dynamic files must always be opened with service's current directory or service
182369
182540
  return processDirectory(directory);
182370
182541
  case -1 /* True */:
182371
182542
  const packageJsonFileName = combinePaths(directory, "package.json");
182372
- this.watchPackageJsonFile(packageJsonFileName);
182543
+ this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName));
182373
182544
  const info = packageJsonCache.getInDirectory(directory);
182374
182545
  if (info)
182375
182546
  result.push(info);
@@ -182378,13 +182549,13 @@ Dynamic files must always be opened with service's current directory or service
182378
182549
  return true;
182379
182550
  }
182380
182551
  };
182381
- forEachAncestorDirectory(getDirectoryPath(filePath), processDirectory);
182552
+ forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
182382
182553
  return result;
182383
182554
  }
182384
182555
  /** @internal */
182385
182556
  getNearestAncestorDirectoryWithPackageJson(fileName) {
182386
182557
  return forEachAncestorDirectory(fileName, (directory) => {
182387
- switch (this.packageJsonCache.directoryHasPackageJson(this.toPath(directory))) {
182558
+ switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
182388
182559
  case -1 /* True */:
182389
182560
  return directory;
182390
182561
  case 0 /* False */:
@@ -182395,28 +182566,27 @@ Dynamic files must always be opened with service's current directory or service
182395
182566
  });
182396
182567
  }
182397
182568
  /** @internal */
182398
- watchPackageJsonFile(path) {
182569
+ watchPackageJsonFile(file, path) {
182399
182570
  const watchers = this.packageJsonFilesMap || (this.packageJsonFilesMap = /* @__PURE__ */ new Map());
182400
182571
  if (!watchers.has(path)) {
182401
182572
  this.invalidateProjectPackageJson(path);
182402
182573
  watchers.set(
182403
182574
  path,
182404
182575
  this.watchFactory.watchFile(
182405
- path,
182576
+ file,
182406
182577
  (fileName, eventKind) => {
182407
- const path2 = this.toPath(fileName);
182408
182578
  switch (eventKind) {
182409
182579
  case 0 /* Created */:
182410
182580
  return Debug.fail();
182411
182581
  case 1 /* Changed */:
182412
- this.packageJsonCache.addOrUpdate(path2);
182413
- this.invalidateProjectPackageJson(path2);
182582
+ this.packageJsonCache.addOrUpdate(fileName, path);
182583
+ this.invalidateProjectPackageJson(path);
182414
182584
  break;
182415
182585
  case 2 /* Deleted */:
182416
- this.packageJsonCache.delete(path2);
182417
- this.invalidateProjectPackageJson(path2);
182418
- watchers.get(path2).close();
182419
- watchers.delete(path2);
182586
+ this.packageJsonCache.delete(path);
182587
+ this.invalidateProjectPackageJson(path);
182588
+ watchers.get(path).close();
182589
+ watchers.delete(path);
182420
182590
  }
182421
182591
  },
182422
182592
  250 /* Low */,
@@ -182427,9 +182597,9 @@ Dynamic files must always be opened with service's current directory or service
182427
182597
  }
182428
182598
  }
182429
182599
  /** @internal */
182430
- onAddPackageJson(path) {
182431
- this.packageJsonCache.addOrUpdate(path);
182432
- this.watchPackageJsonFile(path);
182600
+ onAddPackageJson(file, path) {
182601
+ this.packageJsonCache.addOrUpdate(file, path);
182602
+ this.watchPackageJsonFile(file, path);
182433
182603
  }
182434
182604
  /** @internal */
182435
182605
  includePackageJsonAutoImports() {
@@ -182444,16 +182614,13 @@ Dynamic files must always be opened with service's current directory or service
182444
182614
  }
182445
182615
  /** @internal */
182446
182616
  invalidateProjectPackageJson(packageJsonPath) {
182447
- this.configuredProjects.forEach(invalidate);
182448
- this.inferredProjects.forEach(invalidate);
182449
- this.externalProjects.forEach(invalidate);
182450
- function invalidate(project) {
182617
+ this.forEachProject((project) => {
182451
182618
  if (packageJsonPath) {
182452
182619
  project.onPackageJsonChange(packageJsonPath);
182453
182620
  } else {
182454
182621
  project.onAutoImportProviderSettingsChanged();
182455
182622
  }
182456
- }
182623
+ });
182457
182624
  }
182458
182625
  /** @internal */
182459
182626
  getIncompleteCompletionsCache() {
@@ -182513,9 +182680,10 @@ function createModuleSpecifierCache(host) {
182513
182680
  for (const p of modulePaths) {
182514
182681
  if (p.isInNodeModules) {
182515
182682
  const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1);
182516
- if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(nodeModulesPath))) {
182683
+ const key2 = host.toPath(nodeModulesPath);
182684
+ if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(key2))) {
182517
182685
  (containedNodeModulesWatchers || (containedNodeModulesWatchers = /* @__PURE__ */ new Map())).set(
182518
- nodeModulesPath,
182686
+ key2,
182519
182687
  host.watchNodeModulesForPackageJsonChanges(nodeModulesPath)
182520
182688
  );
182521
182689
  }
@@ -182554,7 +182722,7 @@ function createModuleSpecifierCache(host) {
182554
182722
  }
182555
182723
  },
182556
182724
  clear() {
182557
- containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach((watcher) => watcher.close());
182725
+ containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
182558
182726
  cache == null ? void 0 : cache.clear();
182559
182727
  containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
182560
182728
  currentKey = void 0;
@@ -182589,37 +182757,37 @@ function createPackageJsonCache(host) {
182589
182757
  const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
182590
182758
  return {
182591
182759
  addOrUpdate,
182592
- forEach: packageJsons.forEach.bind(packageJsons),
182593
- get: packageJsons.get.bind(packageJsons),
182594
182760
  delete: (fileName) => {
182595
182761
  packageJsons.delete(fileName);
182596
182762
  directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
182597
182763
  },
182598
182764
  getInDirectory: (directory) => {
182599
- return packageJsons.get(combinePaths(directory, "package.json")) || void 0;
182765
+ return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
182600
182766
  },
182601
- directoryHasPackageJson,
182767
+ directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
182602
182768
  searchDirectoryAndAncestors: (directory) => {
182603
182769
  forEachAncestorDirectory(directory, (ancestor) => {
182604
- if (directoryHasPackageJson(ancestor) !== 3 /* Maybe */) {
182770
+ const ancestorPath = host.toPath(ancestor);
182771
+ if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
182605
182772
  return true;
182606
182773
  }
182607
- const packageJsonFileName = host.toPath(combinePaths(ancestor, "package.json"));
182774
+ const packageJsonFileName = combinePaths(ancestor, "package.json");
182608
182775
  if (tryFileExists(host, packageJsonFileName)) {
182609
- addOrUpdate(packageJsonFileName);
182776
+ addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
182610
182777
  } else {
182611
- directoriesWithoutPackageJson.set(ancestor, true);
182778
+ directoriesWithoutPackageJson.set(ancestorPath, true);
182612
182779
  }
182613
182780
  });
182614
182781
  }
182615
182782
  };
182616
- function addOrUpdate(fileName) {
182617
- const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(fileName, host.host));
182618
- packageJsons.set(fileName, packageJsonInfo);
182619
- directoriesWithoutPackageJson.delete(getDirectoryPath(fileName));
182783
+ function addOrUpdate(file, path) {
182784
+ const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(file, host.host));
182785
+ packageJsons.set(path, packageJsonInfo);
182786
+ directoriesWithoutPackageJson.delete(getDirectoryPath(path));
182620
182787
  }
182621
182788
  function directoryHasPackageJson(directory) {
182622
- return packageJsons.has(combinePaths(directory, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */;
182789
+ const path = host.toPath(directory);
182790
+ return packageJsons.has(combinePaths(path, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(path) ? 0 /* False */ : 3 /* Maybe */;
182623
182791
  }
182624
182792
  }
182625
182793
 
@@ -182817,10 +182985,10 @@ function combineProjectOutput(defaultValue, getValue, projects, action) {
182817
182985
  }
182818
182986
  return deduplicate(outputs, equateValues);
182819
182987
  }
182820
- function createDocumentSpanSet() {
182821
- return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, documentSpansEqual);
182988
+ function createDocumentSpanSet(useCaseSensitiveFileNames2) {
182989
+ return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, getDocumentSpansEqualityComparer(useCaseSensitiveFileNames2));
182822
182990
  }
182823
- function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences) {
182991
+ function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences, useCaseSensitiveFileNames2) {
182824
182992
  const perProjectResults = getPerProjectReferences(
182825
182993
  projects,
182826
182994
  defaultProject,
@@ -182834,7 +183002,7 @@ function getRenameLocationsWorker(projects, defaultProject, initialLocation, fin
182834
183002
  return perProjectResults;
182835
183003
  }
182836
183004
  const results = [];
182837
- const seen = createDocumentSpanSet();
183005
+ const seen = createDocumentSpanSet(useCaseSensitiveFileNames2);
182838
183006
  perProjectResults.forEach((projectResults, project) => {
182839
183007
  for (const result of projectResults) {
182840
183008
  if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
@@ -182857,7 +183025,7 @@ function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
182857
183025
  const info = infos && firstOrUndefined(infos);
182858
183026
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : void 0;
182859
183027
  }
182860
- function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
183028
+ function getReferencesWorker(projects, defaultProject, initialLocation, useCaseSensitiveFileNames2, logger) {
182861
183029
  var _a, _b;
182862
183030
  const perProjectResults = getPerProjectReferences(
182863
183031
  projects,
@@ -182889,7 +183057,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182889
183057
  }
182890
183058
  });
182891
183059
  } else {
182892
- const knownSymbolSpans = createDocumentSpanSet();
183060
+ const knownSymbolSpans = createDocumentSpanSet(useCaseSensitiveFileNames2);
182893
183061
  for (const referencedSymbol of defaultProjectResults) {
182894
183062
  for (const ref of referencedSymbol.references) {
182895
183063
  if (ref.isDefinition) {
@@ -182924,7 +183092,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182924
183092
  });
182925
183093
  }
182926
183094
  const results = [];
182927
- const seenRefs = createDocumentSpanSet();
183095
+ const seenRefs = createDocumentSpanSet(useCaseSensitiveFileNames2);
182928
183096
  perProjectResults.forEach((projectResults, project) => {
182929
183097
  for (const referencedSymbol of projectResults) {
182930
183098
  const mappedDefinitionFile = getMappedLocationForProject(documentSpanLocation(referencedSymbol.definition), project);
@@ -182935,7 +183103,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182935
183103
  fileName: mappedDefinitionFile.fileName,
182936
183104
  contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project)
182937
183105
  };
182938
- let symbolToAddTo = find(results, (o) => documentSpansEqual(o.definition, definition));
183106
+ let symbolToAddTo = find(results, (o) => documentSpansEqual(o.definition, definition, useCaseSensitiveFileNames2));
182939
183107
  if (!symbolToAddTo) {
182940
183108
  symbolToAddTo = { definition, references: [] };
182941
183109
  results.push(symbolToAddTo);
@@ -184295,7 +184463,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184295
184463
  let definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || emptyArray2, project).slice();
184296
184464
  const needsJsResolution = this.projectService.serverMode === 0 /* Semantic */ && (!some(definitions, (d) => toNormalizedPath(d.fileName) !== file && !d.isAmbient) || some(definitions, (d) => !!d.failedAliasResolution));
184297
184465
  if (needsJsResolution) {
184298
- const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
184466
+ const definitionSet = createSet(
184467
+ (d) => d.textSpan.start,
184468
+ getDocumentSpansEqualityComparer(this.host.useCaseSensitiveFileNames)
184469
+ );
184299
184470
  definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
184300
184471
  const noDtsProject = project.getNoDtsResolutionProject(file);
184301
184472
  const ls = noDtsProject.getLanguageService();
@@ -184736,7 +184907,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184736
184907
  { fileName: args.file, pos: position },
184737
184908
  !!args.findInStrings,
184738
184909
  !!args.findInComments,
184739
- preferences
184910
+ preferences,
184911
+ this.host.useCaseSensitiveFileNames
184740
184912
  );
184741
184913
  if (!simplifiedResult)
184742
184914
  return locations;
@@ -184771,6 +184943,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184771
184943
  projects,
184772
184944
  this.getDefaultProject(args),
184773
184945
  { fileName: args.file, pos: position },
184946
+ this.host.useCaseSensitiveFileNames,
184774
184947
  this.logger
184775
184948
  );
184776
184949
  if (!simplifiedResult)
@@ -184793,7 +184966,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184793
184966
  const fileName = args.file;
184794
184967
  const preferences = this.getPreferences(toNormalizedPath(fileName));
184795
184968
  const references = [];
184796
- const seen = createDocumentSpanSet();
184969
+ const seen = createDocumentSpanSet(this.host.useCaseSensitiveFileNames);
184797
184970
  forEachProjectInProjects(
184798
184971
  projects,
184799
184972
  /*path*/
@@ -188250,6 +188423,7 @@ start(initializeNodeSystem(), require("os").platform());
188250
188423
  getDirectoryToWatchFailedLookupLocation,
188251
188424
  getDirectoryToWatchFailedLookupLocationFromTypeRoot,
188252
188425
  getDocumentPositionMapper,
188426
+ getDocumentSpansEqualityComparer,
188253
188427
  getESModuleInterop,
188254
188428
  getEditsForFileRename,
188255
188429
  getEffectiveBaseTypeNode,