typescript 5.4.0-dev.20231120 → 5.4.0-dev.20231122

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-dev.20231120`;
2334
+ var version = `${versionMajorMinor}.0-dev.20231122`;
2334
2335
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2335
2336
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2336
2337
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6674,7 +6675,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6674
6675
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
6675
6676
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
6676
6677
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
6677
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
6678
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
6678
6679
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
6679
6680
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
6680
6681
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -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."),
@@ -20056,7 +20061,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
20056
20061
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
20057
20062
  }
20058
20063
  function getObjectFlags(type) {
20059
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
20064
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
20060
20065
  }
20061
20066
  function forSomeAncestorDirectory(directory, callback) {
20062
20067
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
@@ -22344,7 +22349,7 @@ function addNodeFactoryPatcher(fn) {
22344
22349
  nodeFactoryPatchers.push(fn);
22345
22350
  }
22346
22351
  function createNodeFactory(flags, baseFactory2) {
22347
- const update = flags & 8 /* NoOriginalNode */ ? updateWithoutOriginal : updateWithOriginal;
22352
+ const setOriginal = flags & 8 /* NoOriginalNode */ ? identity : setOriginalNode;
22348
22353
  const parenthesizerRules = memoize(() => flags & 1 /* NoParenthesizerRules */ ? nullParenthesizerRules : createParenthesizerRules(factory2));
22349
22354
  const converters = memoize(() => flags & 2 /* NoNodeConverters */ ? nullNodeConverters : createNodeConverters(factory2));
22350
22355
  const getBinaryCreateFunction = memoizeOne((operator) => (left, right) => createBinaryExpression(left, operator, right));
@@ -25842,7 +25847,7 @@ function createNodeFactory(flags, baseFactory2) {
25842
25847
  }
25843
25848
  function cloneSourceFile(source) {
25844
25849
  const node = source.redirectInfo ? cloneRedirectedSourceFile(source) : cloneSourceFileWorker(source);
25845
- setOriginalNode(node, source);
25850
+ setOriginal(node, source);
25846
25851
  return node;
25847
25852
  }
25848
25853
  function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
@@ -25975,7 +25980,7 @@ function createNodeFactory(flags, baseFactory2) {
25975
25980
  const clone2 = createBaseIdentifier(node.escapedText);
25976
25981
  clone2.flags |= node.flags & ~16 /* Synthesized */;
25977
25982
  clone2.transformFlags = node.transformFlags;
25978
- setOriginalNode(clone2, node);
25983
+ setOriginal(clone2, node);
25979
25984
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
25980
25985
  return clone2;
25981
25986
  }
@@ -25986,7 +25991,7 @@ function createNodeFactory(flags, baseFactory2) {
25986
25991
  clone2.flowNode = node.flowNode;
25987
25992
  clone2.symbol = node.symbol;
25988
25993
  clone2.transformFlags = node.transformFlags;
25989
- setOriginalNode(clone2, node);
25994
+ setOriginal(clone2, node);
25990
25995
  const typeArguments = getIdentifierTypeArguments(node);
25991
25996
  if (typeArguments)
25992
25997
  setIdentifierTypeArguments(clone2, typeArguments);
@@ -25996,7 +26001,7 @@ function createNodeFactory(flags, baseFactory2) {
25996
26001
  const clone2 = createBasePrivateIdentifier(node.escapedText);
25997
26002
  clone2.flags |= node.flags & ~16 /* Synthesized */;
25998
26003
  clone2.transformFlags = node.transformFlags;
25999
- setOriginalNode(clone2, node);
26004
+ setOriginal(clone2, node);
26000
26005
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
26001
26006
  return clone2;
26002
26007
  }
@@ -26004,7 +26009,7 @@ function createNodeFactory(flags, baseFactory2) {
26004
26009
  const clone2 = createBasePrivateIdentifier(node.escapedText);
26005
26010
  clone2.flags |= node.flags & ~16 /* Synthesized */;
26006
26011
  clone2.transformFlags = node.transformFlags;
26007
- setOriginalNode(clone2, node);
26012
+ setOriginal(clone2, node);
26008
26013
  return clone2;
26009
26014
  }
26010
26015
  function cloneNode(node) {
@@ -26029,7 +26034,7 @@ function createNodeFactory(flags, baseFactory2) {
26029
26034
  const clone2 = !isNodeKind(node.kind) ? baseFactory2.createBaseTokenNode(node.kind) : baseFactory2.createBaseNode(node.kind);
26030
26035
  clone2.flags |= node.flags & ~16 /* Synthesized */;
26031
26036
  clone2.transformFlags = node.transformFlags;
26032
- setOriginalNode(clone2, node);
26037
+ setOriginal(clone2, node);
26033
26038
  for (const key in node) {
26034
26039
  if (hasProperty(clone2, key) || !hasProperty(node, key)) {
26035
26040
  continue;
@@ -26554,7 +26559,7 @@ function createNodeFactory(flags, baseFactory2) {
26554
26559
  return typeof value === "number" ? createToken(value) : value;
26555
26560
  }
26556
26561
  function asEmbeddedStatement(statement) {
26557
- return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginalNode(createEmptyStatement(), statement), statement) : statement;
26562
+ return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginal(createEmptyStatement(), statement), statement) : statement;
26558
26563
  }
26559
26564
  function asVariableDeclaration(variableDeclaration) {
26560
26565
  if (typeof variableDeclaration === "string" || variableDeclaration && !isVariableDeclaration(variableDeclaration)) {
@@ -26570,19 +26575,13 @@ function createNodeFactory(flags, baseFactory2) {
26570
26575
  }
26571
26576
  return variableDeclaration;
26572
26577
  }
26573
- }
26574
- function updateWithoutOriginal(updated, original) {
26575
- if (updated !== original) {
26576
- setTextRange(updated, original);
26577
- }
26578
- return updated;
26579
- }
26580
- function updateWithOriginal(updated, original) {
26581
- if (updated !== original) {
26582
- setOriginalNode(updated, original);
26583
- setTextRange(updated, original);
26578
+ function update(updated, original) {
26579
+ if (updated !== original) {
26580
+ setOriginal(updated, original);
26581
+ setTextRange(updated, original);
26582
+ }
26583
+ return updated;
26584
26584
  }
26585
- return updated;
26586
26585
  }
26587
26586
  function getDefaultTagNameForKind(kind) {
26588
26587
  switch (kind) {
@@ -31318,8 +31317,10 @@ var Parser;
31318
31317
  setTextRangePosWidth(sourceFile, 0, sourceText.length);
31319
31318
  setFields(sourceFile);
31320
31319
  if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */) {
31320
+ const oldSourceFile = sourceFile;
31321
31321
  sourceFile = reparseTopLevelAwait(sourceFile);
31322
- setFields(sourceFile);
31322
+ if (oldSourceFile !== sourceFile)
31323
+ setFields(sourceFile);
31323
31324
  }
31324
31325
  return sourceFile;
31325
31326
  function setFields(sourceFile2) {
@@ -58922,7 +58923,12 @@ function createTypeChecker(host) {
58922
58923
  const checkType = type.checkType;
58923
58924
  const constraint = getLowerBoundOfKeyType(checkType);
58924
58925
  if (constraint !== checkType) {
58925
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
58926
+ return getConditionalTypeInstantiation(
58927
+ type,
58928
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
58929
+ /*forConstraint*/
58930
+ false
58931
+ );
58926
58932
  }
58927
58933
  }
58928
58934
  return type;
@@ -59274,7 +59280,12 @@ function createTypeChecker(host) {
59274
59280
  );
59275
59281
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
59276
59282
  if (constraint && constraint !== type.checkType) {
59277
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
59283
+ const instantiated = getConditionalTypeInstantiation(
59284
+ type,
59285
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
59286
+ /*forConstraint*/
59287
+ true
59288
+ );
59278
59289
  if (!(instantiated.flags & 131072 /* Never */)) {
59279
59290
  type.resolvedConstraintOfDistributive = instantiated;
59280
59291
  return instantiated;
@@ -61708,7 +61719,7 @@ function createTypeChecker(host) {
61708
61719
  }
61709
61720
  }
61710
61721
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
61711
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
61722
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
61712
61723
  if (templates.length) {
61713
61724
  let i = types.length;
61714
61725
  while (i > 0) {
@@ -62108,19 +62119,14 @@ function createTypeChecker(host) {
62108
62119
  function getConstituentCountOfTypes(types) {
62109
62120
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
62110
62121
  }
62111
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
62112
- if (types.length !== 2) {
62113
- return false;
62114
- }
62115
- const [t1, t2] = types;
62116
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
62117
- }
62118
62122
  function getTypeFromIntersectionTypeNode(node) {
62119
62123
  const links = getNodeLinks(node);
62120
62124
  if (!links.resolvedType) {
62121
62125
  const aliasSymbol = getAliasSymbolForTypeNode(node);
62122
62126
  const types = map(node.types, getTypeFromTypeNode);
62123
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
62127
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
62128
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
62129
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
62124
62130
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
62125
62131
  }
62126
62132
  return links.resolvedType;
@@ -62147,19 +62153,17 @@ function createTypeChecker(host) {
62147
62153
  return constraintType;
62148
62154
  }
62149
62155
  const keyTypes = [];
62150
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62151
- if (!isGenericIndexType(constraintType)) {
62152
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62153
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62154
- } else {
62156
+ if (isGenericIndexType(constraintType)) {
62157
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62155
62158
  return getIndexTypeForGenericType(type, indexFlags);
62156
62159
  }
62160
+ forEachType(constraintType, addMemberForKeyType);
62161
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62162
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62163
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62157
62164
  } else {
62158
62165
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
62159
62166
  }
62160
- if (isGenericIndexType(constraintType)) {
62161
- forEachType(constraintType, addMemberForKeyType);
62162
- }
62163
62167
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
62164
62168
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
62165
62169
  return constraintType;
@@ -62332,11 +62336,6 @@ function createTypeChecker(host) {
62332
62336
  }
62333
62337
  function createTemplateLiteralType(texts, types) {
62334
62338
  const type = createType(134217728 /* TemplateLiteral */);
62335
- type.objectFlags = getPropagatingFlagsOfTypes(
62336
- types,
62337
- /*excludeKinds*/
62338
- 98304 /* Nullable */
62339
- );
62340
62339
  type.texts = texts;
62341
62340
  type.types = types;
62342
62341
  return type;
@@ -62631,7 +62630,15 @@ function createTypeChecker(host) {
62631
62630
  }
62632
62631
  function isPatternLiteralPlaceholderType(type) {
62633
62632
  if (type.flags & 2097152 /* Intersection */) {
62634
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
62633
+ let seenPlaceholder = false;
62634
+ for (const t of type.types) {
62635
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
62636
+ seenPlaceholder = true;
62637
+ } else if (!(t.flags & 524288 /* Object */)) {
62638
+ return false;
62639
+ }
62640
+ }
62641
+ return seenPlaceholder;
62635
62642
  }
62636
62643
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
62637
62644
  }
@@ -62648,7 +62655,7 @@ function createTypeChecker(host) {
62648
62655
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
62649
62656
  }
62650
62657
  function getGenericObjectFlags(type) {
62651
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
62658
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
62652
62659
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
62653
62660
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
62654
62661
  }
@@ -62660,7 +62667,7 @@ function createTypeChecker(host) {
62660
62667
  }
62661
62668
  return type.objectFlags & 12582912 /* IsGenericType */;
62662
62669
  }
62663
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
62670
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
62664
62671
  }
62665
62672
  function getSimplifiedType(type, writing) {
62666
62673
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -62841,7 +62848,7 @@ function createTypeChecker(host) {
62841
62848
  function isDeferredType(type, checkTuples) {
62842
62849
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
62843
62850
  }
62844
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
62851
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
62845
62852
  let result;
62846
62853
  let extraTypes;
62847
62854
  let tailCount = 0;
@@ -62887,7 +62894,7 @@ function createTypeChecker(host) {
62887
62894
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
62888
62895
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
62889
62896
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
62890
- if (checkType.flags & 1 /* Any */) {
62897
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
62891
62898
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
62892
62899
  }
62893
62900
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -62997,7 +63004,9 @@ function createTypeChecker(host) {
62997
63004
  links.resolvedType = getConditionalType(
62998
63005
  root,
62999
63006
  /*mapper*/
63000
- void 0
63007
+ void 0,
63008
+ /*forConstraint*/
63009
+ false
63001
63010
  );
63002
63011
  if (outerTypeParameters) {
63003
63012
  root.instantiations = /* @__PURE__ */ new Map();
@@ -63686,7 +63695,7 @@ function createTypeChecker(host) {
63686
63695
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
63687
63696
  target.instantiations.set(id, result);
63688
63697
  const resultObjectFlags = getObjectFlags(result);
63689
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
63698
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
63690
63699
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
63691
63700
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
63692
63701
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -63852,17 +63861,17 @@ function createTypeChecker(host) {
63852
63861
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
63853
63862
  return result;
63854
63863
  }
63855
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
63864
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
63856
63865
  const root = type.root;
63857
63866
  if (root.outerTypeParameters) {
63858
63867
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
63859
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63868
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63860
63869
  let result = root.instantiations.get(id);
63861
63870
  if (!result) {
63862
63871
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
63863
63872
  const checkType = root.checkType;
63864
63873
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
63865
- 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);
63874
+ 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);
63866
63875
  root.instantiations.set(id, result);
63867
63876
  }
63868
63877
  return result;
@@ -63950,7 +63959,14 @@ function createTypeChecker(host) {
63950
63959
  );
63951
63960
  }
63952
63961
  if (flags & 16777216 /* Conditional */) {
63953
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
63962
+ return getConditionalTypeInstantiation(
63963
+ type,
63964
+ combineTypeMappers(type.mapper, mapper),
63965
+ /*forConstraint*/
63966
+ false,
63967
+ aliasSymbol,
63968
+ aliasTypeArguments
63969
+ );
63954
63970
  }
63955
63971
  if (flags & 33554432 /* Substitution */) {
63956
63972
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -65594,7 +65610,7 @@ function createTypeChecker(host) {
65594
65610
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
65595
65611
  }
65596
65612
  if (target2.flags & 1048576 /* Union */) {
65597
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
65613
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
65598
65614
  }
65599
65615
  if (target2.flags & 2097152 /* Intersection */) {
65600
65616
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -65639,7 +65655,8 @@ function createTypeChecker(host) {
65639
65655
  sourceType,
65640
65656
  target2,
65641
65657
  /*reportErrors*/
65642
- false
65658
+ false,
65659
+ 0 /* None */
65643
65660
  );
65644
65661
  if (!related) {
65645
65662
  return 0 /* False */;
@@ -65648,7 +65665,7 @@ function createTypeChecker(host) {
65648
65665
  }
65649
65666
  return result2;
65650
65667
  }
65651
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
65668
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
65652
65669
  const targetTypes = target2.types;
65653
65670
  if (target2.flags & 1048576 /* Union */) {
65654
65671
  if (containsType(targetTypes, source2)) {
@@ -65666,7 +65683,10 @@ function createTypeChecker(host) {
65666
65683
  match,
65667
65684
  2 /* Target */,
65668
65685
  /*reportErrors*/
65669
- false
65686
+ false,
65687
+ /*headMessage*/
65688
+ void 0,
65689
+ intersectionState
65670
65690
  );
65671
65691
  if (related) {
65672
65692
  return related;
@@ -65679,7 +65699,10 @@ function createTypeChecker(host) {
65679
65699
  type,
65680
65700
  2 /* Target */,
65681
65701
  /*reportErrors*/
65682
- false
65702
+ false,
65703
+ /*headMessage*/
65704
+ void 0,
65705
+ intersectionState
65683
65706
  );
65684
65707
  if (related) {
65685
65708
  return related;
@@ -65693,7 +65716,10 @@ function createTypeChecker(host) {
65693
65716
  bestMatchingType,
65694
65717
  2 /* Target */,
65695
65718
  /*reportErrors*/
65696
- true
65719
+ true,
65720
+ /*headMessage*/
65721
+ void 0,
65722
+ intersectionState
65697
65723
  );
65698
65724
  }
65699
65725
  }
@@ -66491,13 +66517,6 @@ function createTypeChecker(host) {
66491
66517
  return result2;
66492
66518
  }
66493
66519
  }
66494
- } else {
66495
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66496
- if (distributiveConstraint) {
66497
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66498
- return result2;
66499
- }
66500
- }
66501
66520
  }
66502
66521
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
66503
66522
  if (defaultConstraint) {
@@ -66505,6 +66524,13 @@ function createTypeChecker(host) {
66505
66524
  return result2;
66506
66525
  }
66507
66526
  }
66527
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66528
+ if (distributiveConstraint) {
66529
+ resetErrorInfo(saveErrorInfo);
66530
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66531
+ return result2;
66532
+ }
66533
+ }
66508
66534
  } else {
66509
66535
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
66510
66536
  return -1 /* True */;
@@ -68402,8 +68428,8 @@ function createTypeChecker(host) {
68402
68428
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
68403
68429
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
68404
68430
  }
68405
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
68406
- if (type.flags & 138117121 /* ObjectFlagsType */) {
68431
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
68432
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
68407
68433
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
68408
68434
  }
68409
68435
  return result;
@@ -69530,7 +69556,8 @@ function createTypeChecker(host) {
69530
69556
  if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
69531
69557
  const initializer = getEffectiveInitializer(declaration);
69532
69558
  if (initializer) {
69533
- return tryGetNameFromType(getTypeOfExpression(initializer));
69559
+ const initializerType = isBindingPattern(declaration.parent) ? getTypeForBindingElement(declaration) : getTypeOfExpression(initializer);
69560
+ return initializerType && tryGetNameFromType(initializerType);
69534
69561
  }
69535
69562
  if (isEnumMember(declaration)) {
69536
69563
  return getTextOfPropertyName(declaration.name);
@@ -85376,10 +85403,11 @@ function createTypeChecker(host) {
85376
85403
  node
85377
85404
  ));
85378
85405
  if (sym) {
85406
+ const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
85379
85407
  markAliasReferenced(sym, id);
85380
85408
  if (getSymbolFlags(sym) & 111551 /* Value */) {
85381
85409
  checkExpressionCached(id);
85382
- if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
85410
+ if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
85383
85411
  error2(
85384
85412
  id,
85385
85413
  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,
@@ -85393,6 +85421,33 @@ function createTypeChecker(host) {
85393
85421
  idText(id)
85394
85422
  );
85395
85423
  }
85424
+ if (!isIllegalExportDefaultInCJS && getIsolatedModules(compilerOptions) && !(sym.flags & 111551 /* Value */)) {
85425
+ if (sym.flags & 2097152 /* Alias */ && resolveAlias(sym) !== unknownSymbol && getSymbolFlags(
85426
+ sym,
85427
+ /*excludeTypeOnlyMeanings*/
85428
+ false,
85429
+ /*excludeLocalMeanings*/
85430
+ true
85431
+ ) & 788968 /* Type */ && (!typeOnlyDeclaration || getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node))) {
85432
+ error2(
85433
+ id,
85434
+ 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,
85435
+ idText(id),
85436
+ isolatedModulesLikeFlagName
85437
+ );
85438
+ } else if (typeOnlyDeclaration && getSourceFileOfNode(typeOnlyDeclaration) !== getSourceFileOfNode(node)) {
85439
+ addTypeOnlyDeclarationRelatedInfo(
85440
+ error2(
85441
+ id,
85442
+ 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,
85443
+ idText(id),
85444
+ isolatedModulesLikeFlagName
85445
+ ),
85446
+ typeOnlyDeclaration,
85447
+ idText(id)
85448
+ );
85449
+ }
85450
+ }
85396
85451
  } else {
85397
85452
  checkExpressionCached(id);
85398
85453
  }
@@ -86787,7 +86842,11 @@ function createTypeChecker(host) {
86787
86842
  const exportClause = node.exportClause;
86788
86843
  return !!exportClause && (isNamespaceExport(exportClause) || some(exportClause.elements, isValueAliasDeclaration));
86789
86844
  case 277 /* ExportAssignment */:
86790
- return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfDeclaration(node)) : true;
86845
+ return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(
86846
+ getSymbolOfDeclaration(node),
86847
+ /*excludeTypeOnlyValues*/
86848
+ true
86849
+ ) : true;
86791
86850
  }
86792
86851
  return false;
86793
86852
  }
@@ -133172,8 +133231,11 @@ function getTypeKeywordOfTypeOnlyImport(importClause, sourceFile) {
133172
133231
  function textSpansEqual(a, b) {
133173
133232
  return !!a && !!b && a.start === b.start && a.length === b.length;
133174
133233
  }
133175
- function documentSpansEqual(a, b) {
133176
- return a.fileName === b.fileName && textSpansEqual(a.textSpan, b.textSpan);
133234
+ function documentSpansEqual(a, b, useCaseSensitiveFileNames2) {
133235
+ return (useCaseSensitiveFileNames2 ? equateStringsCaseSensitive : equateStringsCaseInsensitive)(a.fileName, b.fileName) && textSpansEqual(a.textSpan, b.textSpan);
133236
+ }
133237
+ function getDocumentSpansEqualityComparer(useCaseSensitiveFileNames2) {
133238
+ return (a, b) => documentSpansEqual(a, b, useCaseSensitiveFileNames2);
133177
133239
  }
133178
133240
  function forEachUnique(array, callback) {
133179
133241
  if (array) {
@@ -160414,6 +160476,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160414
160476
  }
160415
160477
  return void 0;
160416
160478
  }
160479
+ function isInDifferentLineThanContextToken(contextToken2, position2) {
160480
+ return sourceFile.getLineEndOfPosition(contextToken2.getEnd()) < position2;
160481
+ }
160417
160482
  function isSolelyIdentifierDefinitionLocation(contextToken2) {
160418
160483
  const parent2 = contextToken2.parent;
160419
160484
  const containingNodeKind = parent2.kind;
@@ -160455,11 +160520,19 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160455
160520
  case 139 /* GetKeyword */:
160456
160521
  case 153 /* SetKeyword */:
160457
160522
  return !isFromObjectTypeDeclaration(contextToken2);
160458
- case 80 /* Identifier */:
160523
+ case 80 /* Identifier */: {
160459
160524
  if (containingNodeKind === 276 /* ImportSpecifier */ && contextToken2 === parent2.name && contextToken2.text === "type") {
160460
160525
  return false;
160461
160526
  }
160527
+ const ancestorVariableDeclaration = findAncestor(
160528
+ contextToken2.parent,
160529
+ isVariableDeclaration
160530
+ );
160531
+ if (ancestorVariableDeclaration && isInDifferentLineThanContextToken(contextToken2, position)) {
160532
+ return false;
160533
+ }
160462
160534
  break;
160535
+ }
160463
160536
  case 86 /* ClassKeyword */:
160464
160537
  case 94 /* EnumKeyword */:
160465
160538
  case 120 /* InterfaceKeyword */:
@@ -173509,6 +173582,7 @@ __export(ts_exports2, {
173509
173582
  getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
173510
173583
  getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
173511
173584
  getDocumentPositionMapper: () => getDocumentPositionMapper,
173585
+ getDocumentSpansEqualityComparer: () => getDocumentSpansEqualityComparer,
173512
173586
  getESModuleInterop: () => getESModuleInterop,
173513
173587
  getEditsForFileRename: () => getEditsForFileRename,
173514
173588
  getEffectiveBaseTypeNode: () => getEffectiveBaseTypeNode,
@@ -182833,10 +182907,10 @@ function combineProjectOutput(defaultValue, getValue, projects, action) {
182833
182907
  }
182834
182908
  return deduplicate(outputs, equateValues);
182835
182909
  }
182836
- function createDocumentSpanSet() {
182837
- return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, documentSpansEqual);
182910
+ function createDocumentSpanSet(useCaseSensitiveFileNames2) {
182911
+ return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, getDocumentSpansEqualityComparer(useCaseSensitiveFileNames2));
182838
182912
  }
182839
- function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences) {
182913
+ function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences, useCaseSensitiveFileNames2) {
182840
182914
  const perProjectResults = getPerProjectReferences(
182841
182915
  projects,
182842
182916
  defaultProject,
@@ -182850,7 +182924,7 @@ function getRenameLocationsWorker(projects, defaultProject, initialLocation, fin
182850
182924
  return perProjectResults;
182851
182925
  }
182852
182926
  const results = [];
182853
- const seen = createDocumentSpanSet();
182927
+ const seen = createDocumentSpanSet(useCaseSensitiveFileNames2);
182854
182928
  perProjectResults.forEach((projectResults, project) => {
182855
182929
  for (const result of projectResults) {
182856
182930
  if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
@@ -182873,7 +182947,7 @@ function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
182873
182947
  const info = infos && firstOrUndefined(infos);
182874
182948
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : void 0;
182875
182949
  }
182876
- function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
182950
+ function getReferencesWorker(projects, defaultProject, initialLocation, useCaseSensitiveFileNames2, logger) {
182877
182951
  var _a, _b;
182878
182952
  const perProjectResults = getPerProjectReferences(
182879
182953
  projects,
@@ -182905,7 +182979,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182905
182979
  }
182906
182980
  });
182907
182981
  } else {
182908
- const knownSymbolSpans = createDocumentSpanSet();
182982
+ const knownSymbolSpans = createDocumentSpanSet(useCaseSensitiveFileNames2);
182909
182983
  for (const referencedSymbol of defaultProjectResults) {
182910
182984
  for (const ref of referencedSymbol.references) {
182911
182985
  if (ref.isDefinition) {
@@ -182940,7 +183014,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182940
183014
  });
182941
183015
  }
182942
183016
  const results = [];
182943
- const seenRefs = createDocumentSpanSet();
183017
+ const seenRefs = createDocumentSpanSet(useCaseSensitiveFileNames2);
182944
183018
  perProjectResults.forEach((projectResults, project) => {
182945
183019
  for (const referencedSymbol of projectResults) {
182946
183020
  const mappedDefinitionFile = getMappedLocationForProject(documentSpanLocation(referencedSymbol.definition), project);
@@ -182951,7 +183025,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182951
183025
  fileName: mappedDefinitionFile.fileName,
182952
183026
  contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project)
182953
183027
  };
182954
- let symbolToAddTo = find(results, (o) => documentSpansEqual(o.definition, definition));
183028
+ let symbolToAddTo = find(results, (o) => documentSpansEqual(o.definition, definition, useCaseSensitiveFileNames2));
182955
183029
  if (!symbolToAddTo) {
182956
183030
  symbolToAddTo = { definition, references: [] };
182957
183031
  results.push(symbolToAddTo);
@@ -184311,7 +184385,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184311
184385
  let definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || emptyArray2, project).slice();
184312
184386
  const needsJsResolution = this.projectService.serverMode === 0 /* Semantic */ && (!some(definitions, (d) => toNormalizedPath(d.fileName) !== file && !d.isAmbient) || some(definitions, (d) => !!d.failedAliasResolution));
184313
184387
  if (needsJsResolution) {
184314
- const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
184388
+ const definitionSet = createSet(
184389
+ (d) => d.textSpan.start,
184390
+ getDocumentSpansEqualityComparer(this.host.useCaseSensitiveFileNames)
184391
+ );
184315
184392
  definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
184316
184393
  const noDtsProject = project.getNoDtsResolutionProject(file);
184317
184394
  const ls = noDtsProject.getLanguageService();
@@ -184752,7 +184829,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184752
184829
  { fileName: args.file, pos: position },
184753
184830
  !!args.findInStrings,
184754
184831
  !!args.findInComments,
184755
- preferences
184832
+ preferences,
184833
+ this.host.useCaseSensitiveFileNames
184756
184834
  );
184757
184835
  if (!simplifiedResult)
184758
184836
  return locations;
@@ -184787,6 +184865,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184787
184865
  projects,
184788
184866
  this.getDefaultProject(args),
184789
184867
  { fileName: args.file, pos: position },
184868
+ this.host.useCaseSensitiveFileNames,
184790
184869
  this.logger
184791
184870
  );
184792
184871
  if (!simplifiedResult)
@@ -184809,7 +184888,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184809
184888
  const fileName = args.file;
184810
184889
  const preferences = this.getPreferences(toNormalizedPath(fileName));
184811
184890
  const references = [];
184812
- const seen = createDocumentSpanSet();
184891
+ const seen = createDocumentSpanSet(this.host.useCaseSensitiveFileNames);
184813
184892
  forEachProjectInProjects(
184814
184893
  projects,
184815
184894
  /*path*/
@@ -188266,6 +188345,7 @@ start(initializeNodeSystem(), require("os").platform());
188266
188345
  getDirectoryToWatchFailedLookupLocation,
188267
188346
  getDirectoryToWatchFailedLookupLocationFromTypeRoot,
188268
188347
  getDocumentPositionMapper,
188348
+ getDocumentSpansEqualityComparer,
188269
188349
  getESModuleInterop,
188270
188350
  getEditsForFileRename,
188271
188351
  getEffectiveBaseTypeNode,