@typescript-deploys/pr-build 5.2.0-pr-54316-2 → 5.2.0-pr-54052-23

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
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-insiders.20230518`;
38
+ version = `${versionMajorMinor}.0-insiders.20230526`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -37258,6 +37258,7 @@ ${lanes.join("\n")}
37258
37258
  ["es2015.symbol", "lib.es2015.symbol.d.ts"],
37259
37259
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
37260
37260
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
37261
+ ["es2017.date", "lib.es2017.date.d.ts"],
37261
37262
  ["es2017.object", "lib.es2017.object.d.ts"],
37262
37263
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
37263
37264
  ["es2017.string", "lib.es2017.string.d.ts"],
@@ -50343,32 +50344,34 @@ ${lanes.join("\n")}
50343
50344
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
50344
50345
  typeElements.push(preserveCommentsOn(methodDeclaration));
50345
50346
  }
50347
+ if (signatures.length || !optionalToken) {
50348
+ return;
50349
+ }
50350
+ }
50351
+ let propertyTypeNode;
50352
+ if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
50353
+ propertyTypeNode = createElidedInformationPlaceholder(context);
50346
50354
  } else {
50347
- let propertyTypeNode;
50348
- if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
50349
- propertyTypeNode = createElidedInformationPlaceholder(context);
50350
- } else {
50351
- if (propertyIsReverseMapped) {
50352
- context.reverseMappedStack || (context.reverseMappedStack = []);
50353
- context.reverseMappedStack.push(propertySymbol);
50354
- }
50355
- propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
50356
- if (propertyIsReverseMapped) {
50357
- context.reverseMappedStack.pop();
50358
- }
50355
+ if (propertyIsReverseMapped) {
50356
+ context.reverseMappedStack || (context.reverseMappedStack = []);
50357
+ context.reverseMappedStack.push(propertySymbol);
50359
50358
  }
50360
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
50361
- if (modifiers) {
50362
- context.approximateLength += 9;
50359
+ propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
50360
+ if (propertyIsReverseMapped) {
50361
+ context.reverseMappedStack.pop();
50363
50362
  }
50364
- const propertySignature = factory.createPropertySignature(
50365
- modifiers,
50366
- propertyName,
50367
- optionalToken,
50368
- propertyTypeNode
50369
- );
50370
- typeElements.push(preserveCommentsOn(propertySignature));
50371
50363
  }
50364
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
50365
+ if (modifiers) {
50366
+ context.approximateLength += 9;
50367
+ }
50368
+ const propertySignature = factory.createPropertySignature(
50369
+ modifiers,
50370
+ propertyName,
50371
+ optionalToken,
50372
+ propertyTypeNode
50373
+ );
50374
+ typeElements.push(preserveCommentsOn(propertySignature));
50372
50375
  function preserveCommentsOn(node) {
50373
50376
  var _a2;
50374
50377
  if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
@@ -56431,7 +56434,7 @@ ${lanes.join("\n")}
56431
56434
  } else if (type !== firstType) {
56432
56435
  checkFlags |= 64 /* HasNonUniformType */;
56433
56436
  }
56434
- if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
56437
+ if (isLiteralType(type) || isPatternLiteralType(type)) {
56435
56438
  checkFlags |= 128 /* HasLiteralType */;
56436
56439
  }
56437
56440
  if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
@@ -58658,31 +58661,28 @@ ${lanes.join("\n")}
58658
58661
  return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
58659
58662
  }
58660
58663
  function getUnionOrIntersectionTypePredicate(signatures, kind) {
58661
- let first2;
58664
+ let last2;
58662
58665
  const types = [];
58663
58666
  for (const sig of signatures) {
58664
58667
  const pred = getTypePredicateOfSignature(sig);
58665
- if (!pred || pred.kind === 2 /* AssertsThis */ || pred.kind === 3 /* AssertsIdentifier */) {
58666
- if (kind !== 2097152 /* Intersection */) {
58667
- continue;
58668
- } else {
58669
- return;
58670
- }
58671
- }
58672
- if (first2) {
58673
- if (!typePredicateKindsMatch(first2, pred)) {
58668
+ if (pred) {
58669
+ if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
58674
58670
  return void 0;
58675
58671
  }
58672
+ last2 = pred;
58673
+ types.push(pred.type);
58676
58674
  } else {
58677
- first2 = pred;
58675
+ const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
58676
+ if (returnType !== falseType && returnType !== regularFalseType) {
58677
+ return void 0;
58678
+ }
58678
58679
  }
58679
- types.push(pred.type);
58680
58680
  }
58681
- if (!first2) {
58681
+ if (!last2) {
58682
58682
  return void 0;
58683
58683
  }
58684
58684
  const compositeType = getUnionOrIntersectionType(types, kind);
58685
- return createTypePredicate(first2.kind, first2.parameterName, first2.parameterIndex, compositeType);
58685
+ return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
58686
58686
  }
58687
58687
  function typePredicateKindsMatch(a, b) {
58688
58688
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
@@ -59724,9 +59724,9 @@ ${lanes.join("\n")}
59724
59724
  );
59725
59725
  if (freshMapper) {
59726
59726
  const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
59727
- for (const p of freshParams) {
59728
- if (root.inferTypeParameters.indexOf(p) === -1) {
59729
- p.mapper = freshCombinedMapper;
59727
+ for (let i = 0; i < freshParams.length; i++) {
59728
+ if (freshParams[i] !== root.inferTypeParameters[i]) {
59729
+ freshParams[i].mapper = freshCombinedMapper;
59730
59730
  }
59731
59731
  }
59732
59732
  }
@@ -60563,18 +60563,19 @@ ${lanes.join("\n")}
60563
60563
  case 185 /* TypeQuery */:
60564
60564
  const entityName = node2.exprName;
60565
60565
  const firstIdentifier = getFirstIdentifier(entityName);
60566
- const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
60567
- const tpDeclaration = tp.symbol.declarations[0];
60568
- let tpScope;
60569
- if (tpDeclaration.kind === 167 /* TypeParameter */) {
60570
- tpScope = tpDeclaration.parent;
60571
- } else if (tp.isThisType) {
60572
- tpScope = tpDeclaration;
60573
- } else {
60574
- return true;
60575
- }
60576
- if (firstIdentifierSymbol.declarations) {
60577
- return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
60566
+ if (!isThisIdentifier(firstIdentifier)) {
60567
+ const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
60568
+ const tpDeclaration = tp.symbol.declarations[0];
60569
+ const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
60570
+ // Type parameter is a regular type parameter, e.g. foo<T>
60571
+ tp.isThisType ? tpDeclaration : (
60572
+ // Type parameter is the this type, and its declaration is the class declaration.
60573
+ void 0
60574
+ )
60575
+ );
60576
+ if (firstIdentifierSymbol.declarations && tpScope) {
60577
+ return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
60578
+ }
60578
60579
  }
60579
60580
  return true;
60580
60581
  case 173 /* MethodDeclaration */:
@@ -60628,6 +60629,9 @@ ${lanes.join("\n")}
60628
60629
  const elementFlags = tupleType.target.elementFlags;
60629
60630
  const elementTypes = map(getElementTypes(tupleType), (t, i) => {
60630
60631
  const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
60632
+ if (singleton === typeVariable) {
60633
+ return mappedType;
60634
+ }
60631
60635
  return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
60632
60636
  });
60633
60637
  const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
@@ -60965,6 +60969,10 @@ ${lanes.join("\n")}
60965
60969
  return true;
60966
60970
  }
60967
60971
  switch (node.kind) {
60972
+ case 233 /* AsExpression */:
60973
+ if (!isConstAssertion(node)) {
60974
+ break;
60975
+ }
60968
60976
  case 293 /* JsxExpression */:
60969
60977
  case 216 /* ParenthesizedExpression */:
60970
60978
  return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
@@ -64212,7 +64220,7 @@ ${lanes.join("\n")}
64212
64220
  }
64213
64221
  }
64214
64222
  }
64215
- const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target;
64223
+ const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i]), 0 /* None */) : target;
64216
64224
  return filtered.flags & 131072 /* Never */ ? target : filtered;
64217
64225
  }
64218
64226
  function isWeakType(type) {
@@ -64416,7 +64424,7 @@ ${lanes.join("\n")}
64416
64424
  }
64417
64425
  function getRecursionIdentity(type) {
64418
64426
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
64419
- if (getObjectFlags(type) && 4 /* Reference */ && type.node) {
64427
+ if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
64420
64428
  return type.node;
64421
64429
  }
64422
64430
  if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
@@ -67243,7 +67251,7 @@ ${lanes.join("\n")}
67243
67251
  target.antecedents = saveAntecedents;
67244
67252
  } else if (flags & 2 /* Start */) {
67245
67253
  const container = flow.node;
67246
- if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind !== 110 /* ThisKeyword */) {
67254
+ if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 218 /* ArrowFunction */)) {
67247
67255
  flow = container.flowNode;
67248
67256
  continue;
67249
67257
  }
@@ -75730,7 +75738,7 @@ ${lanes.join("\n")}
75730
75738
  Debug.assertIsDefined(leftType);
75731
75739
  const rightType = getLastResult(state);
75732
75740
  Debug.assertIsDefined(rightType);
75733
- result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, node);
75741
+ result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, state.checkMode, node);
75734
75742
  }
75735
75743
  state.skip = false;
75736
75744
  setLeftType(
@@ -75792,9 +75800,9 @@ ${lanes.join("\n")}
75792
75800
  leftType = checkExpression(left, checkMode);
75793
75801
  }
75794
75802
  const rightType = checkExpression(right, checkMode);
75795
- return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode);
75803
+ return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode);
75796
75804
  }
75797
- function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) {
75805
+ function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode) {
75798
75806
  const operator = operatorToken.kind;
75799
75807
  switch (operator) {
75800
75808
  case 42 /* AsteriskToken */:
@@ -75951,12 +75959,14 @@ ${lanes.join("\n")}
75951
75959
  case 36 /* ExclamationEqualsToken */:
75952
75960
  case 37 /* EqualsEqualsEqualsToken */:
75953
75961
  case 38 /* ExclamationEqualsEqualsToken */:
75954
- if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
75955
- const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
75956
- error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
75962
+ if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
75963
+ if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
75964
+ const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
75965
+ error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
75966
+ }
75967
+ checkNaNEquality(errorNode, operator, left, right);
75968
+ reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
75957
75969
  }
75958
- checkNaNEquality(errorNode, operator, left, right);
75959
- reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
75960
75970
  return booleanType;
75961
75971
  case 104 /* InstanceOfKeyword */:
75962
75972
  return checkInstanceOfExpression(left, right, leftType, rightType);
@@ -76267,7 +76277,7 @@ ${lanes.join("\n")}
76267
76277
  }
76268
76278
  }
76269
76279
  function checkConditionalExpression(node, checkMode) {
76270
- const type = checkTruthinessExpression(node.condition);
76280
+ const type = checkTruthinessExpression(node.condition, checkMode);
76271
76281
  checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
76272
76282
  const type1 = checkExpression(node.whenTrue, checkMode);
76273
76283
  const type2 = checkExpression(node.whenFalse, checkMode);
@@ -76608,7 +76618,7 @@ ${lanes.join("\n")}
76608
76618
  }
76609
76619
  }
76610
76620
  const startInvocationCount = flowInvocationCount;
76611
- const type = checkExpression(node);
76621
+ const type = checkExpression(node, 128 /* TypeOnly */);
76612
76622
  if (flowInvocationCount !== startInvocationCount) {
76613
76623
  const cache = flowTypeCache || (flowTypeCache = []);
76614
76624
  cache[getNodeId(node)] = type;
@@ -76684,7 +76694,7 @@ ${lanes.join("\n")}
76684
76694
  if (getIsolatedModules(compilerOptions)) {
76685
76695
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
76686
76696
  const constEnumDeclaration = type.symbol.valueDeclaration;
76687
- if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
76697
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
76688
76698
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
76689
76699
  }
76690
76700
  }
@@ -77113,6 +77123,9 @@ ${lanes.join("\n")}
77113
77123
  case "length":
77114
77124
  case "caller":
77115
77125
  case "arguments":
77126
+ if (compilerOptions.useDefineForClassFields) {
77127
+ break;
77128
+ }
77116
77129
  case "prototype":
77117
77130
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
77118
77131
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -84119,7 +84132,7 @@ ${lanes.join("\n")}
84119
84132
  if (requestedExternalEmitHelperNames.has(name))
84120
84133
  continue;
84121
84134
  requestedExternalEmitHelperNames.add(name);
84122
- const symbol = getSymbol2(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */);
84135
+ const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
84123
84136
  if (!symbol) {
84124
84137
  error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
84125
84138
  } else if (helper & 524288 /* ClassPrivateFieldGet */) {
@@ -85815,6 +85828,7 @@ ${lanes.join("\n")}
85815
85828
  CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
85816
85829
  CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
85817
85830
  CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
85831
+ CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
85818
85832
  return CheckMode3;
85819
85833
  })(CheckMode || {});
85820
85834
  SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -121831,7 +121845,7 @@ ${lanes.join("\n")}
121831
121845
  let filesWithChangedSetOfUnresolvedImports;
121832
121846
  let filesWithInvalidatedResolutions;
121833
121847
  let filesWithInvalidatedNonRelativeUnresolvedImports;
121834
- const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
121848
+ const nonRelativeExternalModuleResolutions = createMultiMap();
121835
121849
  const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
121836
121850
  const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
121837
121851
  const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -121965,7 +121979,8 @@ ${lanes.join("\n")}
121965
121979
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
121966
121980
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
121967
121981
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
121968
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
121982
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
121983
+ nonRelativeExternalModuleResolutions.clear();
121969
121984
  }
121970
121985
  function cleanupLibResolutionWatching(newProgram) {
121971
121986
  resolvedLibraries.forEach((resolution, libFileName) => {
@@ -121983,7 +121998,8 @@ ${lanes.join("\n")}
121983
121998
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
121984
121999
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
121985
122000
  allModuleAndTypeResolutionsAreInvalidated = false;
121986
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
122001
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
122002
+ nonRelativeExternalModuleResolutions.clear();
121987
122003
  if (newProgram !== oldProgram) {
121988
122004
  cleanupLibResolutionWatching(newProgram);
121989
122005
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
@@ -122264,7 +122280,7 @@ ${lanes.join("\n")}
122264
122280
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
122265
122281
  watchFailedLookupLocationOfResolution(resolution);
122266
122282
  } else {
122267
- nonRelativeExternalModuleResolutions.add(resolution);
122283
+ nonRelativeExternalModuleResolutions.add(name, resolution);
122268
122284
  }
122269
122285
  const resolved = getResolutionWithResolvedFileName(resolution);
122270
122286
  if (resolved && resolved.resolvedFileName) {
@@ -122394,9 +122410,17 @@ ${lanes.join("\n")}
122394
122410
  paths.add(affectingLocation);
122395
122411
  }
122396
122412
  }
122397
- function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
122398
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
122399
- nonRelativeExternalModuleResolutions.clear();
122413
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
122414
+ const program = resolutionHost.getCurrentProgram();
122415
+ if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
122416
+ resolutions.forEach(watchFailedLookupLocationOfResolution);
122417
+ } else {
122418
+ resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
122419
+ resolution,
122420
+ /*addToResolutionsWithOnlyAffectingLocations*/
122421
+ true
122422
+ ));
122423
+ }
122400
122424
  }
122401
122425
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
122402
122426
  const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
@@ -134184,12 +134208,12 @@ ${lanes.join("\n")}
134184
134208
  refactorName = "Convert export";
134185
134209
  defaultToNamedAction = {
134186
134210
  name: "Convert default export to named export",
134187
- description: Diagnostics.Convert_default_export_to_named_export.message,
134211
+ description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export),
134188
134212
  kind: "refactor.rewrite.export.named"
134189
134213
  };
134190
134214
  namedToDefaultAction = {
134191
134215
  name: "Convert named export to default export",
134192
- description: Diagnostics.Convert_named_export_to_default_export.message,
134216
+ description: getLocaleSpecificMessage(Diagnostics.Convert_named_export_to_default_export),
134193
134217
  kind: "refactor.rewrite.export.default"
134194
134218
  };
134195
134219
  registerRefactor(refactorName, {
@@ -134207,7 +134231,7 @@ ${lanes.join("\n")}
134207
134231
  }
134208
134232
  if (context.preferences.provideRefactorNotApplicableReason) {
134209
134233
  return [
134210
- { name: refactorName, description: Diagnostics.Convert_default_export_to_named_export.message, actions: [
134234
+ { name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export), actions: [
134211
134235
  { ...defaultToNamedAction, notApplicableReason: info.error },
134212
134236
  { ...namedToDefaultAction, notApplicableReason: info.error }
134213
134237
  ] }
@@ -134409,17 +134433,17 @@ ${lanes.join("\n")}
134409
134433
  actions = {
134410
134434
  [0 /* Named */]: {
134411
134435
  name: "Convert namespace import to named imports",
134412
- description: Diagnostics.Convert_namespace_import_to_named_imports.message,
134436
+ description: getLocaleSpecificMessage(Diagnostics.Convert_namespace_import_to_named_imports),
134413
134437
  kind: "refactor.rewrite.import.named"
134414
134438
  },
134415
134439
  [2 /* Namespace */]: {
134416
134440
  name: "Convert named imports to namespace import",
134417
- description: Diagnostics.Convert_named_imports_to_namespace_import.message,
134441
+ description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_namespace_import),
134418
134442
  kind: "refactor.rewrite.import.namespace"
134419
134443
  },
134420
134444
  [1 /* Default */]: {
134421
134445
  name: "Convert named imports to default import",
134422
- description: Diagnostics.Convert_named_imports_to_default_import.message,
134446
+ description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_default_import),
134423
134447
  kind: "refactor.rewrite.import.default"
134424
134448
  }
134425
134449
  };
@@ -134888,10 +134912,9 @@ ${lanes.join("\n")}
134888
134912
 
134889
134913
  // src/services/refactors/moveToFile.ts
134890
134914
  function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
134891
- var _a;
134892
134915
  const checker = program.getTypeChecker();
134893
134916
  const usage = getUsageInfo(oldFile, toMove.all, checker);
134894
- if (!host.fileExists(targetFile) || host.fileExists(targetFile) && ((_a = program.getSourceFile(targetFile)) == null ? void 0 : _a.statements.length) === 0) {
134917
+ if (!host.fileExists(targetFile)) {
134895
134918
  changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
134896
134919
  addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
134897
134920
  } else {
@@ -134929,6 +134952,13 @@ ${lanes.join("\n")}
134929
134952
  if (typeof targetFile !== "string") {
134930
134953
  if (targetFile.statements.length > 0) {
134931
134954
  changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
134955
+ } else {
134956
+ changes.insertNodesAtEndOfFile(
134957
+ targetFile,
134958
+ body,
134959
+ /*blankLineBetween*/
134960
+ false
134961
+ );
134932
134962
  }
134933
134963
  if (imports.length > 0) {
134934
134964
  insertImports(
@@ -135515,6 +135545,10 @@ ${lanes.join("\n")}
135515
135545
  if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
135516
135546
  return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
135517
135547
  }
135548
+ const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
135549
+ if (overloadRangeToMove) {
135550
+ return overloadRangeToMove;
135551
+ }
135518
135552
  if (range.pos > startStatement.getStart(file))
135519
135553
  return void 0;
135520
135554
  const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
@@ -135710,6 +135744,19 @@ ${lanes.join("\n")}
135710
135744
  return false;
135711
135745
  }
135712
135746
  }
135747
+ function getOverloadRangeToMove(sourceFile, statement) {
135748
+ if (isFunctionLikeDeclaration(statement)) {
135749
+ const declarations = statement.symbol.declarations;
135750
+ if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
135751
+ return void 0;
135752
+ }
135753
+ const lastDecl = declarations[length(declarations) - 1];
135754
+ const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
135755
+ const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
135756
+ return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
135757
+ }
135758
+ return void 0;
135759
+ }
135713
135760
  var refactorNameForMoveToFile, description2, moveToFileAction;
135714
135761
  var init_moveToFile = __esm({
135715
135762
  "src/services/refactors/moveToFile.ts"() {
@@ -135964,7 +136011,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
135964
136011
  init_ts4();
135965
136012
  init_ts_refactor();
135966
136013
  refactorName5 = "Convert overload list to single signature";
135967
- refactorDescription = Diagnostics.Convert_overload_list_to_single_signature.message;
136014
+ refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
135968
136015
  functionOverloadAction = {
135969
136016
  name: refactorName5,
135970
136017
  description: refactorDescription,
@@ -136094,15 +136141,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136094
136141
  init_ts4();
136095
136142
  init_ts_refactor();
136096
136143
  refactorName6 = "Add or remove braces in an arrow function";
136097
- refactorDescription2 = Diagnostics.Add_or_remove_braces_in_an_arrow_function.message;
136144
+ refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
136098
136145
  addBracesAction = {
136099
136146
  name: "Add braces to arrow function",
136100
- description: Diagnostics.Add_braces_to_arrow_function.message,
136147
+ description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
136101
136148
  kind: "refactor.rewrite.arrow.braces.add"
136102
136149
  };
136103
136150
  removeBracesAction = {
136104
136151
  name: "Remove braces from arrow function",
136105
- description: Diagnostics.Remove_braces_from_arrow_function.message,
136152
+ description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
136106
136153
  kind: "refactor.rewrite.arrow.braces.remove"
136107
136154
  };
136108
136155
  registerRefactor(refactorName6, {
@@ -136973,7 +137020,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136973
137020
  }
136974
137021
  }
136975
137022
  function isNotEqualsOperator(node) {
136976
- return node.operatorToken.kind !== 64 /* EqualsToken */;
137023
+ return !(node.operatorToken.kind === 64 /* EqualsToken */ || node.operatorToken.kind === 65 /* PlusEqualsToken */);
136977
137024
  }
136978
137025
  function getParentBinaryExpression(expr) {
136979
137026
  const container = findAncestor(expr.parent, (n) => {
@@ -139008,7 +139055,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139008
139055
  init_ts4();
139009
139056
  init_ts_refactor();
139010
139057
  actionName = "Generate 'get' and 'set' accessors";
139011
- actionDescription = Diagnostics.Generate_get_and_set_accessors.message;
139058
+ actionDescription = getLocaleSpecificMessage(Diagnostics.Generate_get_and_set_accessors);
139012
139059
  generateGetSetAction = {
139013
139060
  name: actionName,
139014
139061
  description: actionDescription,
@@ -139160,7 +139207,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139160
139207
  init_ts4();
139161
139208
  init_ts_refactor();
139162
139209
  refactorName12 = "Infer function return type";
139163
- refactorDescription6 = Diagnostics.Infer_function_return_type.message;
139210
+ refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
139164
139211
  inferReturnTypeAction = {
139165
139212
  name: refactorName12,
139166
139213
  description: refactorDescription6,
@@ -139831,7 +139878,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139831
139878
  onUnRecoverableConfigFileDiagnostic: noop
139832
139879
  };
139833
139880
  const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
139881
+ let releasedScriptKinds = /* @__PURE__ */ new Set();
139834
139882
  if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
139883
+ compilerHost = void 0;
139884
+ parsedCommandLines = void 0;
139885
+ releasedScriptKinds = void 0;
139835
139886
  return;
139836
139887
  }
139837
139888
  const options = {
@@ -139844,6 +139895,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139844
139895
  program = createProgram(options);
139845
139896
  compilerHost = void 0;
139846
139897
  parsedCommandLines = void 0;
139898
+ releasedScriptKinds = void 0;
139847
139899
  sourceMapper.clearCache();
139848
139900
  program.getTypeChecker();
139849
139901
  return;
@@ -139898,10 +139950,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139898
139950
  if (!shouldCreateNewSourceFile) {
139899
139951
  const oldSourceFile = program && program.getSourceFileByPath(path);
139900
139952
  if (oldSourceFile) {
139901
- if (scriptKind === oldSourceFile.scriptKind) {
139953
+ if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) {
139902
139954
  return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
139903
139955
  } else {
139904
139956
  documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
139957
+ releasedScriptKinds.add(oldSourceFile.resolvedPath);
139905
139958
  }
139906
139959
  }
139907
139960
  }
@@ -149197,9 +149250,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149197
149250
  if (call === void 0) {
149198
149251
  return void 0;
149199
149252
  }
149200
- if (isPrivateIdentifier(token)) {
149201
- return void 0;
149202
- }
149203
149253
  const methodName = token.text;
149204
149254
  const addMethodDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addMethodDeclaration(context, t, call, token, modifierFlags2, parentDeclaration, declSourceFile));
149205
149255
  const actions2 = [createCodeFixAction(fixMissingMember, addMethodDeclarationChanges(modifierFlags & 32 /* Static */), [modifierFlags & 32 /* Static */ ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, methodName], fixMissingMember, Diagnostics.Add_all_missing_members)];
@@ -152536,6 +152586,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
152536
152586
  type === void 0 ? factory.createKeywordTypeNode(159 /* UnknownKeyword */) : type
152537
152587
  );
152538
152588
  case 261 /* FunctionDeclaration */:
152589
+ Debug.assert(typeof name === "string" || isIdentifier(name), "Unexpected name");
152539
152590
  return factory.createFunctionDeclaration(
152540
152591
  modifiers,
152541
152592
  asteriskToken,
@@ -160821,9 +160872,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160821
160872
  if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) {
160822
160873
  getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2);
160823
160874
  }
160824
- const containingClass = getContainingClassIfInHeritageClause(refNode);
160825
- if (containingClass) {
160826
- addReference2(containingClass);
160875
+ const containingNode = getContainingNodeIfInHeritageClause(refNode);
160876
+ if (containingNode) {
160877
+ addReference2(containingNode);
160827
160878
  return;
160828
160879
  }
160829
160880
  const typeNode = findAncestor(refNode, (a) => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent));
@@ -160850,8 +160901,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160850
160901
  addReference2(e);
160851
160902
  }
160852
160903
  }
160853
- function getContainingClassIfInHeritageClause(node) {
160854
- return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingClassIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, isClassLike) : void 0;
160904
+ function getContainingNodeIfInHeritageClause(node) {
160905
+ return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration)) : void 0;
160855
160906
  }
160856
160907
  function isImplementationExpression(node) {
160857
160908
  switch (node.kind) {
@@ -162363,7 +162414,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162363
162414
  const tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : "");
162364
162415
  const openComment = "/**";
162365
162416
  const closeComment = " */";
162366
- const hasTag = (commentOwnerJsDoc || []).some((jsDoc) => !!jsDoc.tags);
162417
+ const hasTag = length(getJSDocTags(commentOwner)) > 0;
162367
162418
  if (tags && !hasTag) {
162368
162419
  const preamble = openComment + newLine + indentationStr + " * ";
162369
162420
  const endLine = tokenStart === position ? newLine + indentationStr : "";
@@ -165884,6 +165935,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
165884
165935
  this.insertNodeAt(sourceFile, pos, insert, options);
165885
165936
  }
165886
165937
  }
165938
+ insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
165939
+ this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
165940
+ }
165941
+ insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
165942
+ const pos = sourceFile.end + 1;
165943
+ const options = {
165944
+ prefix: this.newLineCharacter,
165945
+ suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
165946
+ };
165947
+ this.insertNodesAt(sourceFile, pos, insert, options);
165948
+ }
165887
165949
  insertStatementsInNewFile(fileName, statements, oldFile) {
165888
165950
  if (!this.newFileChanges) {
165889
165951
  this.newFileChanges = createMultiMap();
@@ -167916,7 +167978,8 @@ ${options.prefix}` : "\n" : options.prefix
167916
167978
  }
167917
167979
  processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
167918
167980
  }
167919
- if (!formattingScanner.isOnToken()) {
167981
+ const remainingTrivia = formattingScanner.getCurrentLeadingTrivia();
167982
+ if (remainingTrivia) {
167920
167983
  const indentation = SmartIndenter.nodeWillIndentChild(
167921
167984
  options,
167922
167985
  enclosingNode,
@@ -167926,25 +167989,30 @@ ${options.prefix}` : "\n" : options.prefix
167926
167989
  /*indentByDefault*/
167927
167990
  false
167928
167991
  ) ? initialIndentation + options.indentSize : initialIndentation;
167929
- const leadingTrivia = formattingScanner.getCurrentLeadingTrivia();
167930
- if (leadingTrivia) {
167931
- indentTriviaItems(
167932
- leadingTrivia,
167933
- indentation,
167934
- /*indentNextTokenOrTrivia*/
167935
- false,
167936
- (item) => processRange(
167992
+ indentTriviaItems(
167993
+ remainingTrivia,
167994
+ indentation,
167995
+ /*indentNextTokenOrTrivia*/
167996
+ true,
167997
+ (item) => {
167998
+ processRange(
167937
167999
  item,
167938
168000
  sourceFile.getLineAndCharacterOfPosition(item.pos),
167939
168001
  enclosingNode,
167940
168002
  enclosingNode,
167941
168003
  /*dynamicIndentation*/
167942
168004
  void 0
167943
- )
167944
- );
167945
- if (options.trimTrailingWhitespace !== false) {
167946
- trimTrailingWhitespacesForRemainingRange(leadingTrivia);
168005
+ );
168006
+ insertIndentation(
168007
+ item.pos,
168008
+ indentation,
168009
+ /*lineAdded*/
168010
+ false
168011
+ );
167947
168012
  }
168013
+ );
168014
+ if (options.trimTrailingWhitespace !== false) {
168015
+ trimTrailingWhitespacesForRemainingRange(remainingTrivia);
167948
168016
  }
167949
168017
  }
167950
168018
  if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) {