typescript 5.6.0-dev.20240722 → 5.6.0-dev.20240724

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/typescript.js CHANGED
@@ -142,6 +142,7 @@ __export(typescript_exports, {
142
142
  PollingInterval: () => PollingInterval,
143
143
  PollingWatchKind: () => PollingWatchKind,
144
144
  PragmaKindFlags: () => PragmaKindFlags,
145
+ PredicateSemantics: () => PredicateSemantics,
145
146
  PrivateIdentifierKind: () => PrivateIdentifierKind,
146
147
  ProcessLevel: () => ProcessLevel,
147
148
  ProgramUpdateLevel: () => ProgramUpdateLevel,
@@ -898,6 +899,7 @@ __export(typescript_exports, {
898
899
  getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
899
900
  getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
900
901
  getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots,
902
+ getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode,
901
903
  getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
902
904
  getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
903
905
  getNormalizedPathComponents: () => getNormalizedPathComponents,
@@ -1178,6 +1180,7 @@ __export(typescript_exports, {
1178
1180
  isAwaitKeyword: () => isAwaitKeyword,
1179
1181
  isBigIntLiteral: () => isBigIntLiteral,
1180
1182
  isBinaryExpression: () => isBinaryExpression,
1183
+ isBinaryLogicalOperator: () => isBinaryLogicalOperator,
1181
1184
  isBinaryOperatorToken: () => isBinaryOperatorToken,
1182
1185
  isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
1183
1186
  isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
@@ -2075,7 +2078,6 @@ __export(typescript_exports, {
2075
2078
  skipWhile: () => skipWhile,
2076
2079
  sliceAfter: () => sliceAfter,
2077
2080
  some: () => some,
2078
- sort: () => sort,
2079
2081
  sortAndDeduplicate: () => sortAndDeduplicate,
2080
2082
  sortAndDeduplicateDiagnostics: () => sortAndDeduplicateDiagnostics,
2081
2083
  sourceFileAffectingCompilerOptions: () => sourceFileAffectingCompilerOptions,
@@ -2084,7 +2086,6 @@ __export(typescript_exports, {
2084
2086
  sourceMapCommentRegExpDontCareLineStart: () => sourceMapCommentRegExpDontCareLineStart,
2085
2087
  spacePart: () => spacePart,
2086
2088
  spanMap: () => spanMap,
2087
- stableSort: () => stableSort,
2088
2089
  startEndContainsRange: () => startEndContainsRange,
2089
2090
  startEndOverlapsWithStartEnd: () => startEndOverlapsWithStartEnd,
2090
2091
  startOnNewLine: () => startOnNewLine,
@@ -2143,6 +2144,7 @@ __export(typescript_exports, {
2143
2144
  toFileNameLowerCase: () => toFileNameLowerCase,
2144
2145
  toPath: () => toPath,
2145
2146
  toProgramEmitPending: () => toProgramEmitPending,
2147
+ toSorted: () => toSorted,
2146
2148
  tokenIsIdentifierOrKeyword: () => tokenIsIdentifierOrKeyword,
2147
2149
  tokenIsIdentifierOrKeywordOrGreaterThan: () => tokenIsIdentifierOrKeywordOrGreaterThan,
2148
2150
  tokenToString: () => tokenToString,
@@ -2257,7 +2259,7 @@ module.exports = __toCommonJS(typescript_exports);
2257
2259
 
2258
2260
  // src/compiler/corePublic.ts
2259
2261
  var versionMajorMinor = "5.6";
2260
- var version = `${versionMajorMinor}.0-dev.20240722`;
2262
+ var version = `${versionMajorMinor}.0-dev.20240724`;
2261
2263
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2262
2264
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2263
2265
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -2765,7 +2767,7 @@ function insertSorted(array, insert, compare, equalityComparer, allowDuplicates)
2765
2767
  return false;
2766
2768
  }
2767
2769
  function sortAndDeduplicate(array, comparer, equalityComparer) {
2768
- return deduplicateSorted(sort(array, comparer), equalityComparer ?? comparer ?? compareStringsCaseSensitive);
2770
+ return deduplicateSorted(toSorted(array, comparer), equalityComparer ?? comparer ?? compareStringsCaseSensitive);
2769
2771
  }
2770
2772
  function arrayIsEqualTo(array1, array2, equalityComparer = equateValues) {
2771
2773
  if (array1 === void 0 || array2 === void 0) {
@@ -2869,19 +2871,14 @@ function appendIfUnique(array, toAdd, equalityComparer) {
2869
2871
  function stableSortIndices(array, indices, comparer) {
2870
2872
  indices.sort((x, y) => comparer(array[x], array[y]) || compareValues(x, y));
2871
2873
  }
2872
- function sort(array, comparer) {
2873
- return array.length === 0 ? array : array.slice().sort(comparer);
2874
+ function toSorted(array, comparer) {
2875
+ return array.length === 0 ? emptyArray : array.slice().sort(comparer);
2874
2876
  }
2875
2877
  function* arrayReverseIterator(array) {
2876
2878
  for (let i = array.length - 1; i >= 0; i--) {
2877
2879
  yield array[i];
2878
2880
  }
2879
2881
  }
2880
- function stableSort(array, comparer) {
2881
- const indices = indicesOf(array);
2882
- stableSortIndices(array, indices, comparer);
2883
- return indices.map((i) => array[i]);
2884
- }
2885
2882
  function rangeEquals(array1, array2, pos, end) {
2886
2883
  while (pos < end) {
2887
2884
  if (array1[pos] !== array2[pos]) {
@@ -4026,7 +4023,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
4026
4023
  result.push([value, name]);
4027
4024
  }
4028
4025
  }
4029
- const sorted = stableSort(result, (x, y) => compareValues(x[0], y[0]));
4026
+ const sorted = toSorted(result, (x, y) => compareValues(x[0], y[0]));
4030
4027
  enumMemberCache.set(enumObject, sorted);
4031
4028
  return sorted;
4032
4029
  }
@@ -5994,6 +5991,13 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
5994
5991
  RelationComparisonResult3[RelationComparisonResult3["Overflow"] = 96] = "Overflow";
5995
5992
  return RelationComparisonResult3;
5996
5993
  })(RelationComparisonResult || {});
5994
+ var PredicateSemantics = /* @__PURE__ */ ((PredicateSemantics2) => {
5995
+ PredicateSemantics2[PredicateSemantics2["None"] = 0] = "None";
5996
+ PredicateSemantics2[PredicateSemantics2["Always"] = 1] = "Always";
5997
+ PredicateSemantics2[PredicateSemantics2["Never"] = 2] = "Never";
5998
+ PredicateSemantics2[PredicateSemantics2["Sometimes"] = 3] = "Sometimes";
5999
+ return PredicateSemantics2;
6000
+ })(PredicateSemantics || {});
5997
6001
  var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
5998
6002
  GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["None"] = 0] = "None";
5999
6003
  GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Auto"] = 1] = "Auto";
@@ -8337,7 +8341,7 @@ var sys = (() => {
8337
8341
  setTimeout,
8338
8342
  clearTimeout,
8339
8343
  clearScreen: () => {
8340
- process.stdout.write("\x1Bc");
8344
+ process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
8341
8345
  },
8342
8346
  setBlocking: () => {
8343
8347
  var _a;
@@ -9512,6 +9516,18 @@ var Diagnostics = {
9512
9516
  Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
9513
9517
  Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1538, 1 /* Error */, "Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_se_1538", "Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
9514
9518
  A_bigint_literal_cannot_be_used_as_a_property_name: diag(1539, 1 /* Error */, "A_bigint_literal_cannot_be_used_as_a_property_name_1539", "A 'bigint' literal cannot be used as a property name."),
9519
+ A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead: diag(
9520
+ 1540,
9521
+ 2 /* Suggestion */,
9522
+ "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540",
9523
+ "A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.",
9524
+ /*reportsUnnecessary*/
9525
+ void 0,
9526
+ /*elidedInCompatabilityPyramid*/
9527
+ void 0,
9528
+ /*reportsDeprecated*/
9529
+ true
9530
+ ),
9515
9531
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
9516
9532
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
9517
9533
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -10078,6 +10094,11 @@ var Diagnostics = {
10078
10094
  Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
10079
10095
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun: diag(2867, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2867", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`."),
10080
10096
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig: diag(2868, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2868", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig."),
10097
+ Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish: diag(2869, 1 /* Error */, "Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish_2869", "Right operand of ?? is unreachable because the left operand is never nullish."),
10098
+ This_binary_expression_is_never_nullish_Are_you_missing_parentheses: diag(2870, 1 /* Error */, "This_binary_expression_is_never_nullish_Are_you_missing_parentheses_2870", "This binary expression is never nullish. Are you missing parentheses?"),
10099
+ This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
10100
+ This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
10101
+ This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
10081
10102
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10082
10103
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10083
10104
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -16443,6 +16464,13 @@ function getNonDecoratorTokenPosOfNode(node, sourceFile) {
16443
16464
  }
16444
16465
  return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastDecorator.end);
16445
16466
  }
16467
+ function getNonModifierTokenPosOfNode(node, sourceFile) {
16468
+ const lastModifier = !nodeIsMissing(node) && canHaveModifiers(node) && node.modifiers ? last(node.modifiers) : void 0;
16469
+ if (!lastModifier) {
16470
+ return getTokenPosOfNode(node, sourceFile);
16471
+ }
16472
+ return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastModifier.end);
16473
+ }
16446
16474
  function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia = false) {
16447
16475
  return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia);
16448
16476
  }
@@ -22082,7 +22110,7 @@ function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNa
22082
22110
  if (visited.has(canonicalPath)) return;
22083
22111
  visited.set(canonicalPath, true);
22084
22112
  const { files, directories } = getFileSystemEntries(path2);
22085
- for (const current of sort(files, compareStringsCaseSensitive)) {
22113
+ for (const current of toSorted(files, compareStringsCaseSensitive)) {
22086
22114
  const name = combinePaths(path2, current);
22087
22115
  const absoluteName = combinePaths(absolutePath, current);
22088
22116
  if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
@@ -22102,7 +22130,7 @@ function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNa
22102
22130
  return;
22103
22131
  }
22104
22132
  }
22105
- for (const current of sort(directories, compareStringsCaseSensitive)) {
22133
+ for (const current of toSorted(directories, compareStringsCaseSensitive)) {
22106
22134
  const name = combinePaths(path2, current);
22107
22135
  const absoluteName = combinePaths(absolutePath, current);
22108
22136
  if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) {
@@ -45053,7 +45081,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
45053
45081
  moduleName
45054
45082
  );
45055
45083
  }
45056
- const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => hasOneAsterisk(k) || endsWith(k, "/")), comparePatternKeys);
45084
+ const expandingKeys = toSorted(filter(getOwnKeys(lookupTable), (k) => hasOneAsterisk(k) || endsWith(k, "/")), comparePatternKeys);
45057
45085
  for (const potentialTarget of expandingKeys) {
45058
45086
  if (state.features & 16 /* ExportsPatternTrailers */ && matchesPatternWithTrailer(potentialTarget, moduleName)) {
45059
45087
  const target = lookupTable[potentialTarget];
@@ -82295,7 +82323,7 @@ function createTypeChecker(host) {
82295
82323
  setLastResult(state, checkExpression(node.right, checkMode));
82296
82324
  return state;
82297
82325
  }
82298
- checkGrammarNullishCoalesceWithLogicalExpression(node);
82326
+ checkNullishCoalesceOperands(node);
82299
82327
  const operator = node.operatorToken.kind;
82300
82328
  if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) {
82301
82329
  state.skip = true;
@@ -82328,7 +82356,9 @@ function createTypeChecker(host) {
82328
82356
  if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) {
82329
82357
  checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
82330
82358
  }
82331
- checkTruthinessOfType(leftType, node.left);
82359
+ if (isBinaryLogicalOperator(operator)) {
82360
+ checkTruthinessOfType(leftType, node.left);
82361
+ }
82332
82362
  }
82333
82363
  }
82334
82364
  }
@@ -82385,7 +82415,7 @@ function createTypeChecker(host) {
82385
82415
  state.typeStack[state.stackIndex + 1] = type;
82386
82416
  }
82387
82417
  }
82388
- function checkGrammarNullishCoalesceWithLogicalExpression(node) {
82418
+ function checkNullishCoalesceOperands(node) {
82389
82419
  const { left, operatorToken, right } = node;
82390
82420
  if (operatorToken.kind === 61 /* QuestionQuestionToken */) {
82391
82421
  if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
@@ -82394,7 +82424,54 @@ function createTypeChecker(host) {
82394
82424
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
82395
82425
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
82396
82426
  }
82427
+ const leftTarget = skipOuterExpressions(left, 15 /* All */);
82428
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
82429
+ if (nullishSemantics !== 3 /* Sometimes */) {
82430
+ if (node.parent.kind === 226 /* BinaryExpression */) {
82431
+ error2(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
82432
+ } else {
82433
+ if (nullishSemantics === 1 /* Always */) {
82434
+ error2(leftTarget, Diagnostics.This_expression_is_always_nullish);
82435
+ } else {
82436
+ error2(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
82437
+ }
82438
+ }
82439
+ }
82440
+ }
82441
+ }
82442
+ function getSyntacticNullishnessSemantics(node) {
82443
+ node = skipOuterExpressions(node);
82444
+ switch (node.kind) {
82445
+ case 223 /* AwaitExpression */:
82446
+ case 213 /* CallExpression */:
82447
+ case 212 /* ElementAccessExpression */:
82448
+ case 214 /* NewExpression */:
82449
+ case 211 /* PropertyAccessExpression */:
82450
+ case 229 /* YieldExpression */:
82451
+ return 3 /* Sometimes */;
82452
+ case 226 /* BinaryExpression */:
82453
+ switch (node.operatorToken.kind) {
82454
+ case 64 /* EqualsToken */:
82455
+ case 61 /* QuestionQuestionToken */:
82456
+ case 78 /* QuestionQuestionEqualsToken */:
82457
+ case 57 /* BarBarToken */:
82458
+ case 76 /* BarBarEqualsToken */:
82459
+ case 56 /* AmpersandAmpersandToken */:
82460
+ case 77 /* AmpersandAmpersandEqualsToken */:
82461
+ return 3 /* Sometimes */;
82462
+ }
82463
+ return 2 /* Never */;
82464
+ case 227 /* ConditionalExpression */:
82465
+ return getSyntacticNullishnessSemantics(node.whenTrue) | getSyntacticNullishnessSemantics(node.whenFalse);
82466
+ case 106 /* NullKeyword */:
82467
+ return 1 /* Always */;
82468
+ case 80 /* Identifier */:
82469
+ if (getResolvedSymbol(node) === undefinedSymbol) {
82470
+ return 1 /* Always */;
82471
+ }
82472
+ return 3 /* Sometimes */;
82397
82473
  }
82474
+ return 2 /* Never */;
82398
82475
  }
82399
82476
  function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
82400
82477
  const operator = operatorToken.kind;
@@ -82402,7 +82479,7 @@ function createTypeChecker(host) {
82402
82479
  return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */);
82403
82480
  }
82404
82481
  let leftType;
82405
- if (isLogicalOrCoalescingBinaryOperator(operator)) {
82482
+ if (isBinaryLogicalOperator(operator)) {
82406
82483
  leftType = checkTruthinessExpression(left, checkMode);
82407
82484
  } else {
82408
82485
  leftType = checkExpression(left, checkMode);
@@ -86008,9 +86085,51 @@ function createTypeChecker(host) {
86008
86085
  function checkTruthinessOfType(type, node) {
86009
86086
  if (type.flags & 16384 /* Void */) {
86010
86087
  error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
86088
+ } else {
86089
+ const semantics = getSyntacticTruthySemantics(node);
86090
+ if (semantics !== 3 /* Sometimes */) {
86091
+ error2(
86092
+ node,
86093
+ semantics === 1 /* Always */ ? Diagnostics.This_kind_of_expression_is_always_truthy : Diagnostics.This_kind_of_expression_is_always_falsy
86094
+ );
86095
+ }
86011
86096
  }
86012
86097
  return type;
86013
86098
  }
86099
+ function getSyntacticTruthySemantics(node) {
86100
+ node = skipOuterExpressions(node);
86101
+ switch (node.kind) {
86102
+ case 9 /* NumericLiteral */:
86103
+ if (node.text === "0" || node.text === "1") {
86104
+ return 3 /* Sometimes */;
86105
+ }
86106
+ return 1 /* Always */;
86107
+ case 209 /* ArrayLiteralExpression */:
86108
+ case 219 /* ArrowFunction */:
86109
+ case 10 /* BigIntLiteral */:
86110
+ case 231 /* ClassExpression */:
86111
+ case 218 /* FunctionExpression */:
86112
+ case 284 /* JsxElement */:
86113
+ case 285 /* JsxSelfClosingElement */:
86114
+ case 210 /* ObjectLiteralExpression */:
86115
+ case 14 /* RegularExpressionLiteral */:
86116
+ return 1 /* Always */;
86117
+ case 222 /* VoidExpression */:
86118
+ case 106 /* NullKeyword */:
86119
+ return 2 /* Never */;
86120
+ case 15 /* NoSubstitutionTemplateLiteral */:
86121
+ case 11 /* StringLiteral */:
86122
+ return !!node.text ? 1 /* Always */ : 2 /* Never */;
86123
+ case 227 /* ConditionalExpression */:
86124
+ return getSyntacticTruthySemantics(node.whenTrue) | getSyntacticTruthySemantics(node.whenFalse);
86125
+ case 80 /* Identifier */:
86126
+ if (getResolvedSymbol(node) === undefinedSymbol) {
86127
+ return 2 /* Never */;
86128
+ }
86129
+ return 3 /* Sometimes */;
86130
+ }
86131
+ return 3 /* Sometimes */;
86132
+ }
86014
86133
  function checkTruthinessExpression(node, checkMode) {
86015
86134
  return checkTruthinessOfType(checkExpression(node, checkMode), node);
86016
86135
  }
@@ -87994,6 +88113,14 @@ function createTypeChecker(host) {
87994
88113
  }
87995
88114
  if (isIdentifier(node.name)) {
87996
88115
  checkCollisionsForDeclarationName(node, node.name);
88116
+ if (!(node.flags & (32 /* Namespace */ | 2048 /* GlobalAugmentation */))) {
88117
+ const sourceFile = getSourceFileOfNode(node);
88118
+ const pos = getNonModifierTokenPosOfNode(node);
88119
+ const span = getSpanOfTokenAtPosition(sourceFile, pos);
88120
+ suggestionDiagnostics.add(
88121
+ createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead)
88122
+ );
88123
+ }
87997
88124
  }
87998
88125
  checkExportsOnMergedDeclarations(node);
87999
88126
  const symbol = getSymbolOfDeclaration(node);
@@ -90167,11 +90294,14 @@ function createTypeChecker(host) {
90167
90294
  }
90168
90295
  function checkSingleIdentifier(node2) {
90169
90296
  const nodeLinks2 = getNodeLinks(node2);
90170
- nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
90171
- if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
90172
- const s = getResolvedSymbol(node2);
90173
- if (s && s !== unknownSymbol) {
90174
- checkIdentifierCalculateNodeCheckFlags(node2, s);
90297
+ nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */;
90298
+ if (isIdentifier(node2)) {
90299
+ nodeLinks2.calculatedFlags |= 32768 /* BlockScopedBindingInLoop */ | 16384 /* CapturedBlockScopedBinding */;
90300
+ if (isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
90301
+ const s = getResolvedSymbol(node2);
90302
+ if (s && s !== unknownSymbol) {
90303
+ checkIdentifierCalculateNodeCheckFlags(node2, s);
90304
+ }
90175
90305
  }
90176
90306
  }
90177
90307
  }
@@ -94637,7 +94767,7 @@ function collectExternalModuleInfo(context, sourceFile) {
94637
94767
  }
94638
94768
  }
94639
94769
  function addExportedFunctionDeclaration(node, name, isDefault) {
94640
- exportedFunctions.add(node);
94770
+ exportedFunctions.add(getOriginalNode(node, isFunctionDeclaration));
94641
94771
  if (isDefault) {
94642
94772
  if (!hasExportDefault) {
94643
94773
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name ?? context.factory.getDeclarationName(node));
@@ -99050,6 +99180,7 @@ function transformClassFields(context) {
99050
99180
  addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset));
99051
99181
  }
99052
99182
  function transformConstructorBody(node, constructor, isDerivedClass) {
99183
+ var _a;
99053
99184
  const instanceProperties = getProperties(
99054
99185
  node,
99055
99186
  /*requireInitializer*/
@@ -99143,12 +99274,12 @@ function transformClassFields(context) {
99143
99274
  setTextRange(
99144
99275
  factory2.createNodeArray(statements),
99145
99276
  /*location*/
99146
- constructor ? constructor.body.statements : node.members
99277
+ ((_a = constructor == null ? void 0 : constructor.body) == null ? void 0 : _a.statements) ?? node.members
99147
99278
  ),
99148
99279
  multiLine
99149
99280
  ),
99150
99281
  /*location*/
99151
- constructor ? constructor.body : void 0
99282
+ constructor == null ? void 0 : constructor.body
99152
99283
  );
99153
99284
  }
99154
99285
  function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
@@ -112582,7 +112713,7 @@ function transformModule(context) {
112582
112713
  return factory2.updateLabeledStatement(
112583
112714
  node,
112584
112715
  node.label,
112585
- Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
112716
+ visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createExpressionStatement(factory2.createIdentifier(""))
112586
112717
  );
112587
112718
  }
112588
112719
  function visitWithStatement(node) {
@@ -112596,7 +112727,7 @@ function transformModule(context) {
112596
112727
  return factory2.updateIfStatement(
112597
112728
  node,
112598
112729
  visitNode(node.expression, visitor, isExpression),
112599
- Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
112730
+ visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createBlock([]),
112600
112731
  visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
112601
112732
  );
112602
112733
  }
@@ -114699,7 +114830,7 @@ function transformSystemModule(context) {
114699
114830
  return factory2.updateLabeledStatement(
114700
114831
  node,
114701
114832
  node.label,
114702
- Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
114833
+ visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createExpressionStatement(factory2.createIdentifier(""))
114703
114834
  );
114704
114835
  }
114705
114836
  function visitWithStatement(node) {
@@ -114713,7 +114844,7 @@ function transformSystemModule(context) {
114713
114844
  return factory2.updateIfStatement(
114714
114845
  node,
114715
114846
  visitNode(node.expression, visitor, isExpression),
114716
- Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
114847
+ visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createBlock([]),
114717
114848
  visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
114718
114849
  );
114719
114850
  }
@@ -118417,6 +118548,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118417
118548
  forEachChild(node, collectLinkedAliases);
118418
118549
  }
118419
118550
  function markLinkedReferences(file) {
118551
+ if (isSourceFileJS(file)) return;
118420
118552
  forEachChildRecursively(file, (n) => {
118421
118553
  if (isImportEqualsDeclaration(n) && !(getSyntacticModifierFlags(n) & 32 /* Export */)) return "skip";
118422
118554
  if (isImportDeclaration(n)) return "skip";
@@ -119400,7 +119532,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119400
119532
  }
119401
119533
  function getSortedEmitHelpers(node) {
119402
119534
  const helpers = getEmitHelpers(node);
119403
- return helpers && stableSort(helpers, compareEmitHelpers);
119535
+ return helpers && toSorted(helpers, compareEmitHelpers);
119404
119536
  }
119405
119537
  function emitNumericOrBigIntLiteral(node) {
119406
119538
  emitLiteral(
@@ -124529,7 +124661,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124529
124661
  });
124530
124662
  }
124531
124663
  }
124532
- files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
124664
+ files = toSorted(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
124533
124665
  processingDefaultLibFiles = void 0;
124534
124666
  processingOtherFiles = void 0;
124535
124667
  filesWithReferencesProcessed = void 0;
@@ -133794,7 +133926,7 @@ function shouldBePretty(sys2, options) {
133794
133926
  return options.pretty;
133795
133927
  }
133796
133928
  function getOptionsForHelp(commandLine) {
133797
- return !!commandLine.options.all ? sort(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.slice(), (v) => !!v.showInSimplifiedHelpView);
133929
+ return !!commandLine.options.all ? toSorted(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.slice(), (v) => !!v.showInSimplifiedHelpView);
133798
133930
  }
133799
133931
  function printVersion(sys2) {
133800
133932
  sys2.write(getDiagnosticText(Diagnostics.Version_0, version) + sys2.newLine);
@@ -137473,7 +137605,7 @@ function insertImports(changes, sourceFile, imports, blankLineBetween, preferenc
137473
137605
  const importKindPredicate = decl.kind === 243 /* VariableStatement */ ? isRequireVariableStatement : isAnyImportSyntax;
137474
137606
  const existingImportStatements = filter(sourceFile.statements, importKindPredicate);
137475
137607
  const { comparer, isSorted } = ts_OrganizeImports_exports.getOrganizeImportsStringComparerWithDetection(existingImportStatements, preferences);
137476
- const sortedNewImports = isArray(imports) ? stableSort(imports, (a, b) => ts_OrganizeImports_exports.compareImportsOrRequireStatements(a, b, comparer)) : [imports];
137608
+ const sortedNewImports = isArray(imports) ? toSorted(imports, (a, b) => ts_OrganizeImports_exports.compareImportsOrRequireStatements(a, b, comparer)) : [imports];
137477
137609
  if (!(existingImportStatements == null ? void 0 : existingImportStatements.length)) {
137478
137610
  if (isFullSourceFile(sourceFile)) {
137479
137611
  changes.insertNodesAtTopOfFile(sourceFile, sortedNewImports, blankLineBetween);
@@ -140232,10 +140364,8 @@ var DocumentHighlights;
140232
140364
  return [...nodes, container];
140233
140365
  }
140234
140366
  return nodes;
140235
- case 210 /* ObjectLiteralExpression */:
140236
- return void 0;
140237
140367
  default:
140238
- Debug.assertNever(container, "Invalid container kind.");
140368
+ return void 0;
140239
140369
  }
140240
140370
  }
140241
140371
  function pushKeywordIf(keywordList, token, ...expected) {
@@ -155496,7 +155626,7 @@ function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
155496
155626
  }
155497
155627
  function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) {
155498
155628
  const _toPath = (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
155499
- return sort(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, preferences, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
155629
+ return toSorted(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, preferences, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
155500
155630
  }
155501
155631
  function getFixInfosWithoutDiagnostic(context, symbolToken, useAutoImportProvider) {
155502
155632
  const info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
@@ -155942,7 +156072,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
155942
156072
  }
155943
156073
  if (namedImports.length) {
155944
156074
  const { specifierComparer, isSorted } = ts_OrganizeImports_exports.getNamedImportSpecifierComparerWithDetection(clause.parent, preferences, sourceFile);
155945
- const newSpecifiers = stableSort(
156075
+ const newSpecifiers = toSorted(
155946
156076
  namedImports.map(
155947
156077
  (namedImport) => factory.createImportSpecifier(
155948
156078
  (!clause.isTypeOnly || promoteFromTypeOnly2) && shouldUseTypeOnly(namedImport, preferences),
@@ -155959,7 +156089,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
155959
156089
  clause.namedBindings,
155960
156090
  factory.updateNamedImports(
155961
156091
  clause.namedBindings,
155962
- stableSort([...existingSpecifiers.filter((s) => !removeExistingImportSpecifiers.has(s)), ...newSpecifiers], specifierComparer)
156092
+ toSorted([...existingSpecifiers.filter((s) => !removeExistingImportSpecifiers.has(s)), ...newSpecifiers], specifierComparer)
155963
156093
  )
155964
156094
  );
155965
156095
  } else if ((existingSpecifiers == null ? void 0 : existingSpecifiers.length) && isSorted !== false) {
@@ -162895,6 +163025,7 @@ __export(ts_Completions_exports, {
162895
163025
  getCompletionEntryDetails: () => getCompletionEntryDetails,
162896
163026
  getCompletionEntrySymbol: () => getCompletionEntrySymbol,
162897
163027
  getCompletionsAtPosition: () => getCompletionsAtPosition,
163028
+ getDefaultCommitCharacters: () => getDefaultCommitCharacters,
162898
163029
  getPropertiesForObjectExpression: () => getPropertiesForObjectExpression,
162899
163030
  moduleSpecifierResolutionCacheAttemptLimit: () => moduleSpecifierResolutionCacheAttemptLimit,
162900
163031
  moduleSpecifierResolutionLimit: () => moduleSpecifierResolutionLimit
@@ -163027,6 +163158,12 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
163027
163158
  return result2 || (needsFullResolution ? "failed" : "skipped");
163028
163159
  }
163029
163160
  }
163161
+ function getDefaultCommitCharacters(isNewIdentifierLocation) {
163162
+ if (isNewIdentifierLocation) {
163163
+ return [];
163164
+ }
163165
+ return [".", ",", ";"];
163166
+ }
163030
163167
  function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
163031
163168
  var _a;
163032
163169
  const { previousToken } = getRelevantTokens(position, sourceFile);
@@ -163035,7 +163172,17 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
163035
163172
  }
163036
163173
  if (triggerCharacter === " ") {
163037
163174
  if (preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
163038
- return { isGlobalCompletion: true, isMemberCompletion: false, isNewIdentifierLocation: true, isIncomplete: true, entries: [] };
163175
+ return {
163176
+ isGlobalCompletion: true,
163177
+ isMemberCompletion: false,
163178
+ isNewIdentifierLocation: true,
163179
+ isIncomplete: true,
163180
+ entries: [],
163181
+ defaultCommitCharacters: getDefaultCommitCharacters(
163182
+ /*isNewIdentifierLocation*/
163183
+ true
163184
+ )
163185
+ };
163039
163186
  }
163040
163187
  return void 0;
163041
163188
  }
@@ -163189,7 +163336,16 @@ function continuePreviousIncompleteResponse(cache, file, location, program, host
163189
163336
  return previousResponse;
163190
163337
  }
163191
163338
  function jsdocCompletionInfo(entries) {
163192
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries };
163339
+ return {
163340
+ isGlobalCompletion: false,
163341
+ isMemberCompletion: false,
163342
+ isNewIdentifierLocation: false,
163343
+ entries,
163344
+ defaultCommitCharacters: getDefaultCommitCharacters(
163345
+ /*isNewIdentifierLocation*/
163346
+ false
163347
+ )
163348
+ };
163193
163349
  }
163194
163350
  function getJSDocParameterCompletions(sourceFile, position, checker, options, preferences, tagNameOnly) {
163195
163351
  const currentToken = getTokenAtPosition(sourceFile, position);
@@ -163462,7 +163618,8 @@ function specificKeywordCompletionInfo(entries, isNewIdentifierLocation) {
163462
163618
  isGlobalCompletion: false,
163463
163619
  isMemberCompletion: false,
163464
163620
  isNewIdentifierLocation,
163465
- entries: entries.slice()
163621
+ entries: entries.slice(),
163622
+ defaultCommitCharacters: getDefaultCommitCharacters(isNewIdentifierLocation)
163466
163623
  };
163467
163624
  }
163468
163625
  function keywordCompletionData(keywordFilters, filterOutTsOnlyKeywords, isNewIdentifierLocation) {
@@ -163620,7 +163777,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
163620
163777
  isMemberCompletion: isMemberCompletionKind(completionKind),
163621
163778
  isNewIdentifierLocation,
163622
163779
  optionalReplacementSpan: getOptionalReplacementSpan(location),
163623
- entries
163780
+ entries,
163781
+ defaultCommitCharacters: getDefaultCommitCharacters(isNewIdentifierLocation)
163624
163782
  };
163625
163783
  }
163626
163784
  function isCheckedFile(sourceFile, compilerOptions) {
@@ -163786,7 +163944,17 @@ function getJsxClosingTagCompletion(location, sourceFile) {
163786
163944
  kindModifiers: void 0,
163787
163945
  sortText: SortText.LocationPriority
163788
163946
  };
163789
- return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, optionalReplacementSpan: replacementSpan, entries: [entry] };
163947
+ return {
163948
+ isGlobalCompletion: false,
163949
+ isMemberCompletion: true,
163950
+ isNewIdentifierLocation: false,
163951
+ optionalReplacementSpan: replacementSpan,
163952
+ entries: [entry],
163953
+ defaultCommitCharacters: getDefaultCommitCharacters(
163954
+ /*isNewIdentifierLocation*/
163955
+ false
163956
+ )
163957
+ };
163790
163958
  }
163791
163959
  return;
163792
163960
  }
@@ -163803,7 +163971,8 @@ function getJSCompletionEntries(sourceFile, position, uniqueNames, target, entri
163803
163971
  kind: "warning" /* warning */,
163804
163972
  kindModifiers: "",
163805
163973
  sortText: SortText.JavascriptIdentifiers,
163806
- isFromUncheckedFile: true
163974
+ isFromUncheckedFile: true,
163975
+ commitCharacters: []
163807
163976
  }, compareCompletionEntries);
163808
163977
  }
163809
163978
  });
@@ -163812,7 +163981,13 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
163812
163981
  return typeof literal === "object" ? pseudoBigIntToString(literal) + "n" : isString(literal) ? quote(sourceFile, preferences, literal) : JSON.stringify(literal);
163813
163982
  }
163814
163983
  function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
163815
- return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
163984
+ return {
163985
+ name: completionNameForLiteral(sourceFile, preferences, literal),
163986
+ kind: "string" /* string */,
163987
+ kindModifiers: "" /* none */,
163988
+ sortText: SortText.LocationPriority,
163989
+ commitCharacters: []
163990
+ };
163816
163991
  }
163817
163992
  function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
163818
163993
  var _a, _b;
@@ -163949,9 +164124,11 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163949
164124
  }
163950
164125
  }
163951
164126
  }
164127
+ const kind = ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location);
164128
+ const commitCharacters = kind === "warning" /* warning */ || kind === "string" /* string */ ? [] : void 0;
163952
164129
  return {
163953
164130
  name,
163954
- kind: ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location),
164131
+ kind,
163955
164132
  kindModifiers: ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol),
163956
164133
  sortText,
163957
164134
  source,
@@ -163966,6 +164143,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163966
164143
  isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
163967
164144
  isImportStatementCompletion: !!importStatementCompletion || void 0,
163968
164145
  data,
164146
+ commitCharacters,
163969
164147
  ...includeSymbol ? { symbol } : void 0
163970
164148
  };
163971
164149
  }
@@ -164348,7 +164526,7 @@ function createSnippetPrinter(printerOptions) {
164348
164526
  { ...formatContext, options: formatOptions }
164349
164527
  );
164350
164528
  });
164351
- const allChanges = escapes ? stableSort(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
164529
+ const allChanges = escapes ? toSorted(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
164352
164530
  return ts_textChanges_exports.applyChanges(syntheticFile.text, allChanges);
164353
164531
  }
164354
164532
  function printNode(hint, node, sourceFile) {
@@ -164384,7 +164562,7 @@ function createSnippetPrinter(printerOptions) {
164384
164562
  0,
164385
164563
  { ...formatContext, options: formatOptions }
164386
164564
  );
164387
- const allChanges = escapes ? stableSort(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
164565
+ const allChanges = escapes ? toSorted(concatenate(changes, escapes), (a, b) => compareTextSpans(a.span, b.span)) : changes;
164388
164566
  return ts_textChanges_exports.applyChanges(syntheticFile.text, allChanges);
164389
164567
  }
164390
164568
  }
@@ -164596,7 +164774,16 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
164596
164774
  function getLabelCompletionAtPosition(node) {
164597
164775
  const entries = getLabelStatementCompletions(node);
164598
164776
  if (entries.length) {
164599
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries };
164777
+ return {
164778
+ isGlobalCompletion: false,
164779
+ isMemberCompletion: false,
164780
+ isNewIdentifierLocation: false,
164781
+ entries,
164782
+ defaultCommitCharacters: getDefaultCommitCharacters(
164783
+ /*isNewIdentifierLocation*/
164784
+ false
164785
+ )
164786
+ };
164600
164787
  }
164601
164788
  }
164602
164789
  function getLabelStatementCompletions(node) {
@@ -166885,7 +167072,14 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
166885
167072
  void 0,
166886
167073
  includeSymbol
166887
167074
  );
166888
- return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
167075
+ return {
167076
+ isGlobalCompletion: false,
167077
+ isMemberCompletion: true,
167078
+ isNewIdentifierLocation: completion.hasIndexSignature,
167079
+ optionalReplacementSpan,
167080
+ entries,
167081
+ defaultCommitCharacters: getDefaultCommitCharacters(completion.hasIndexSignature)
167082
+ };
166889
167083
  }
166890
167084
  case 2 /* Types */: {
166891
167085
  const quoteChar = contextToken.kind === 15 /* NoSubstitutionTemplateLiteral */ ? 96 /* backtick */ : startsWith(getTextOfNode(contextToken), "'") ? 39 /* singleQuote */ : 34 /* doubleQuote */;
@@ -166894,9 +167088,17 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
166894
167088
  kindModifiers: "" /* none */,
166895
167089
  kind: "string" /* string */,
166896
167090
  sortText: SortText.LocationPriority,
166897
- replacementSpan: getReplacementSpanForContextToken(contextToken, position)
167091
+ replacementSpan: getReplacementSpanForContextToken(contextToken, position),
167092
+ commitCharacters: []
166898
167093
  }));
166899
- return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan, entries };
167094
+ return {
167095
+ isGlobalCompletion: false,
167096
+ isMemberCompletion: false,
167097
+ isNewIdentifierLocation: completion.isNewIdentifier,
167098
+ optionalReplacementSpan,
167099
+ entries,
167100
+ defaultCommitCharacters: getDefaultCommitCharacters(completion.isNewIdentifier)
167101
+ };
166900
167102
  }
166901
167103
  default:
166902
167104
  return Debug.assertNever(completion);
@@ -166927,7 +167129,13 @@ function convertPathCompletions(pathCompletions) {
166927
167129
  const isGlobalCompletion = false;
166928
167130
  const isNewIdentifierLocation = true;
166929
167131
  const entries = pathCompletions.map(({ name, kind, span, extension }) => ({ name, kind, kindModifiers: kindModifiersFromExtension(extension), sortText: SortText.LocationPriority, replacementSpan: span }));
166930
- return { isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation, entries };
167132
+ return {
167133
+ isGlobalCompletion,
167134
+ isMemberCompletion: false,
167135
+ isNewIdentifierLocation,
167136
+ entries,
167137
+ defaultCommitCharacters: getDefaultCommitCharacters(isNewIdentifierLocation)
167138
+ };
166931
167139
  }
166932
167140
  function kindModifiersFromExtension(extension) {
166933
167141
  switch (extension) {
@@ -172118,7 +172326,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
172118
172326
  }
172119
172327
  setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */);
172120
172328
  const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
172121
- const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer.moduleSpecifierComparer ?? defaultComparer)) : oldImportGroups;
172329
+ const sortedImportGroups = shouldSort ? toSorted(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer.moduleSpecifierComparer ?? defaultComparer)) : oldImportGroups;
172122
172330
  const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
172123
172331
  if (newImportDecls.length === 0) {
172124
172332
  changeTracker.deleteNodes(
@@ -172153,7 +172361,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
172153
172361
  const processImportsOfSameModuleSpecifier = (importGroup) => {
172154
172362
  if (shouldRemove) importGroup = removeUnusedImports(importGroup, sourceFile, program);
172155
172363
  if (shouldCombine) importGroup = coalesceImportsWorker(importGroup, detectedModuleCaseComparer, specifierComparer, sourceFile);
172156
- if (shouldSort) importGroup = stableSort(importGroup, (s1, s2) => compareImportsOrRequireStatements(s1, s2, detectedModuleCaseComparer));
172364
+ if (shouldSort) importGroup = toSorted(importGroup, (s1, s2) => compareImportsOrRequireStatements(s1, s2, detectedModuleCaseComparer));
172157
172365
  return importGroup;
172158
172366
  };
172159
172367
  organizeDeclsWorker(oldImportDecls, processImportsOfSameModuleSpecifier);
@@ -172329,7 +172537,7 @@ function coalesceImportsWorker(importGroup, comparer, specifierComparer, sourceF
172329
172537
  const importGroupsByAttributes = groupBy(importGroup, (decl) => {
172330
172538
  if (decl.attributes) {
172331
172539
  let attrs = decl.attributes.token + " ";
172332
- for (const x of sort(decl.attributes.elements, (x2, y) => compareStringsCaseSensitive(x2.name.text, y.name.text))) {
172540
+ for (const x of toSorted(decl.attributes.elements, (x2, y) => compareStringsCaseSensitive(x2.name.text, y.name.text))) {
172333
172541
  attrs += x.name.text + ":";
172334
172542
  attrs += isStringLiteralLike(x.value) ? `"${x.value.text}"` : x.value.getText() + " ";
172335
172543
  }
@@ -172354,7 +172562,7 @@ function coalesceImportsWorker(importGroup, comparer, specifierComparer, sourceF
172354
172562
  );
172355
172563
  continue;
172356
172564
  }
172357
- const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
172565
+ const sortedNamespaceImports = toSorted(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
172358
172566
  for (const namespaceImport of sortedNamespaceImports) {
172359
172567
  coalescedImports.push(
172360
172568
  updateImportDeclarationAndClause(
@@ -172389,7 +172597,7 @@ function coalesceImportsWorker(importGroup, comparer, specifierComparer, sourceF
172389
172597
  }
172390
172598
  newImportSpecifiers.push(...getNewImportSpecifiers(namedImports));
172391
172599
  const sortedImportSpecifiers = factory.createNodeArray(
172392
- stableSort(newImportSpecifiers, specifierComparer),
172600
+ toSorted(newImportSpecifiers, specifierComparer),
172393
172601
  firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings.elements.hasTrailingComma
172394
172602
  );
172395
172603
  const newNamedImports = sortedImportSpecifiers.length === 0 ? newDefaultImport ? void 0 : factory.createNamedImports(emptyArray) : firstNamedImport ? factory.updateNamedImports(firstNamedImport.importClause.namedBindings, sortedImportSpecifiers) : factory.createNamedImports(sortedImportSpecifiers);
@@ -172437,7 +172645,7 @@ function coalesceExportsWorker(exportGroup, specifierComparer) {
172437
172645
  }
172438
172646
  const newExportSpecifiers = [];
172439
172647
  newExportSpecifiers.push(...flatMap(exportGroup2, (i) => i.exportClause && isNamedExports(i.exportClause) ? i.exportClause.elements : emptyArray));
172440
- const sortedExportSpecifiers = stableSort(newExportSpecifiers, specifierComparer);
172648
+ const sortedExportSpecifiers = toSorted(newExportSpecifiers, specifierComparer);
172441
172649
  const exportDecl = exportGroup2[0];
172442
172650
  coalescedExports.push(
172443
172651
  factory.updateExportDeclaration(
@@ -175453,7 +175661,7 @@ var changesToText;
175453
175661
  function getTextChangesFromChanges(changes, newLineCharacter, formatContext, validate) {
175454
175662
  return mapDefined(group(changes, (c) => c.sourceFile.path), (changesInFile) => {
175455
175663
  const sourceFile = changesInFile[0].sourceFile;
175456
- const normalized = stableSort(changesInFile, (a, b) => a.range.pos - b.range.pos || a.range.end - b.range.end);
175664
+ const normalized = toSorted(changesInFile, (a, b) => a.range.pos - b.range.pos || a.range.end - b.range.end);
175457
175665
  for (let i = 0; i < normalized.length - 1; i++) {
175458
175666
  Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", () => `${JSON.stringify(normalized[i].range)} and ${JSON.stringify(normalized[i + 1].range)}`);
175459
175667
  }
@@ -178879,6 +179087,7 @@ __export(ts_exports2, {
178879
179087
  PollingInterval: () => PollingInterval,
178880
179088
  PollingWatchKind: () => PollingWatchKind,
178881
179089
  PragmaKindFlags: () => PragmaKindFlags,
179090
+ PredicateSemantics: () => PredicateSemantics,
178882
179091
  PrivateIdentifierKind: () => PrivateIdentifierKind,
178883
179092
  ProcessLevel: () => ProcessLevel,
178884
179093
  ProgramUpdateLevel: () => ProgramUpdateLevel,
@@ -179635,6 +179844,7 @@ __export(ts_exports2, {
179635
179844
  getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
179636
179845
  getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
179637
179846
  getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots,
179847
+ getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode,
179638
179848
  getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
179639
179849
  getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
179640
179850
  getNormalizedPathComponents: () => getNormalizedPathComponents,
@@ -179915,6 +180125,7 @@ __export(ts_exports2, {
179915
180125
  isAwaitKeyword: () => isAwaitKeyword,
179916
180126
  isBigIntLiteral: () => isBigIntLiteral,
179917
180127
  isBinaryExpression: () => isBinaryExpression,
180128
+ isBinaryLogicalOperator: () => isBinaryLogicalOperator,
179918
180129
  isBinaryOperatorToken: () => isBinaryOperatorToken,
179919
180130
  isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
179920
180131
  isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
@@ -180812,7 +181023,6 @@ __export(ts_exports2, {
180812
181023
  skipWhile: () => skipWhile,
180813
181024
  sliceAfter: () => sliceAfter,
180814
181025
  some: () => some,
180815
- sort: () => sort,
180816
181026
  sortAndDeduplicate: () => sortAndDeduplicate,
180817
181027
  sortAndDeduplicateDiagnostics: () => sortAndDeduplicateDiagnostics,
180818
181028
  sourceFileAffectingCompilerOptions: () => sourceFileAffectingCompilerOptions,
@@ -180821,7 +181031,6 @@ __export(ts_exports2, {
180821
181031
  sourceMapCommentRegExpDontCareLineStart: () => sourceMapCommentRegExpDontCareLineStart,
180822
181032
  spacePart: () => spacePart,
180823
181033
  spanMap: () => spanMap,
180824
- stableSort: () => stableSort,
180825
181034
  startEndContainsRange: () => startEndContainsRange,
180826
181035
  startEndOverlapsWithStartEnd: () => startEndOverlapsWithStartEnd,
180827
181036
  startOnNewLine: () => startOnNewLine,
@@ -180880,6 +181089,7 @@ __export(ts_exports2, {
180880
181089
  toFileNameLowerCase: () => toFileNameLowerCase,
180881
181090
  toPath: () => toPath,
180882
181091
  toProgramEmitPending: () => toProgramEmitPending,
181092
+ toSorted: () => toSorted,
180883
181093
  tokenIsIdentifierOrKeyword: () => tokenIsIdentifierOrKeyword,
180884
181094
  tokenIsIdentifierOrKeywordOrGreaterThan: () => tokenIsIdentifierOrKeywordOrGreaterThan,
180885
181095
  tokenToString: () => tokenToString,
@@ -183132,7 +183342,7 @@ var Project2 = class _Project {
183132
183342
  return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
183133
183343
  }
183134
183344
  getExternalFiles(updateLevel) {
183135
- return sort(flatMap(this.plugins, (plugin) => {
183345
+ return toSorted(flatMap(this.plugins, (plugin) => {
183136
183346
  if (typeof plugin.module.getExternalFiles !== "function") return;
183137
183347
  try {
183138
183348
  return plugin.module.getExternalFiles(this, updateLevel || 0 /* Update */);
@@ -183469,7 +183679,7 @@ var Project2 = class _Project {
183469
183679
  typeAcquisition,
183470
183680
  unresolvedImports
183471
183681
  };
183472
- const typingFiles = !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : sort(newTypings);
183682
+ const typingFiles = !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : toSorted(newTypings);
183473
183683
  if (enumerateInsertsAndDeletes(
183474
183684
  typingFiles,
183475
183685
  this.typingFiles,
@@ -184183,13 +184393,13 @@ var Project2 = class _Project {
184183
184393
  var _a, _b, _c, _d;
184184
184394
  const originalProgram = this.program;
184185
184395
  const rootSourceFile = Debug.checkDefined((_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile), "Expected file to be part of program");
184186
- const originalText = Debug.checkDefined(rootSourceFile.getText());
184396
+ const originalText = Debug.checkDefined(rootSourceFile.getFullText());
184187
184397
  (_b = this.getScriptInfo(rootFile)) == null ? void 0 : _b.editContent(0, originalText.length, updatedText);
184188
184398
  this.updateGraph();
184189
184399
  try {
184190
184400
  cb(this.program, originalProgram, (_c = this.program) == null ? void 0 : _c.getSourceFile(rootFile));
184191
184401
  } finally {
184192
- (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
184402
+ (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, updatedText.length, originalText);
184193
184403
  }
184194
184404
  }
184195
184405
  getCompilerOptionsForNoDtsResolutionProject() {
@@ -193244,6 +193454,7 @@ if (typeof console !== "undefined") {
193244
193454
  PollingInterval,
193245
193455
  PollingWatchKind,
193246
193456
  PragmaKindFlags,
193457
+ PredicateSemantics,
193247
193458
  PrivateIdentifierKind,
193248
193459
  ProcessLevel,
193249
193460
  ProgramUpdateLevel,
@@ -194000,6 +194211,7 @@ if (typeof console !== "undefined") {
194000
194211
  getNonAugmentationDeclaration,
194001
194212
  getNonDecoratorTokenPosOfNode,
194002
194213
  getNonIncrementalBuildInfoRoots,
194214
+ getNonModifierTokenPosOfNode,
194003
194215
  getNormalizedAbsolutePath,
194004
194216
  getNormalizedAbsolutePathWithoutRoot,
194005
194217
  getNormalizedPathComponents,
@@ -194280,6 +194492,7 @@ if (typeof console !== "undefined") {
194280
194492
  isAwaitKeyword,
194281
194493
  isBigIntLiteral,
194282
194494
  isBinaryExpression,
194495
+ isBinaryLogicalOperator,
194283
194496
  isBinaryOperatorToken,
194284
194497
  isBindableObjectDefinePropertyCall,
194285
194498
  isBindableStaticAccessExpression,
@@ -195177,7 +195390,6 @@ if (typeof console !== "undefined") {
195177
195390
  skipWhile,
195178
195391
  sliceAfter,
195179
195392
  some,
195180
- sort,
195181
195393
  sortAndDeduplicate,
195182
195394
  sortAndDeduplicateDiagnostics,
195183
195395
  sourceFileAffectingCompilerOptions,
@@ -195186,7 +195398,6 @@ if (typeof console !== "undefined") {
195186
195398
  sourceMapCommentRegExpDontCareLineStart,
195187
195399
  spacePart,
195188
195400
  spanMap,
195189
- stableSort,
195190
195401
  startEndContainsRange,
195191
195402
  startEndOverlapsWithStartEnd,
195192
195403
  startOnNewLine,
@@ -195245,6 +195456,7 @@ if (typeof console !== "undefined") {
195245
195456
  toFileNameLowerCase,
195246
195457
  toPath,
195247
195458
  toProgramEmitPending,
195459
+ toSorted,
195248
195460
  tokenIsIdentifierOrKeyword,
195249
195461
  tokenIsIdentifierOrKeywordOrGreaterThan,
195250
195462
  tokenToString,