typescript 5.2.0-dev.20230524 → 5.2.0-dev.20230527

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-dev.20230524`;
38
+ version = `${versionMajorMinor}.0-dev.20230527`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -50344,32 +50344,34 @@ ${lanes.join("\n")}
50344
50344
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
50345
50345
  typeElements.push(preserveCommentsOn(methodDeclaration));
50346
50346
  }
50347
+ if (signatures.length || !optionalToken) {
50348
+ return;
50349
+ }
50350
+ }
50351
+ let propertyTypeNode;
50352
+ if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
50353
+ propertyTypeNode = createElidedInformationPlaceholder(context);
50347
50354
  } else {
50348
- let propertyTypeNode;
50349
- if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
50350
- propertyTypeNode = createElidedInformationPlaceholder(context);
50351
- } else {
50352
- if (propertyIsReverseMapped) {
50353
- context.reverseMappedStack || (context.reverseMappedStack = []);
50354
- context.reverseMappedStack.push(propertySymbol);
50355
- }
50356
- propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
50357
- if (propertyIsReverseMapped) {
50358
- context.reverseMappedStack.pop();
50359
- }
50355
+ if (propertyIsReverseMapped) {
50356
+ context.reverseMappedStack || (context.reverseMappedStack = []);
50357
+ context.reverseMappedStack.push(propertySymbol);
50360
50358
  }
50361
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
50362
- if (modifiers) {
50363
- context.approximateLength += 9;
50359
+ propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
50360
+ if (propertyIsReverseMapped) {
50361
+ context.reverseMappedStack.pop();
50364
50362
  }
50365
- const propertySignature = factory.createPropertySignature(
50366
- modifiers,
50367
- propertyName,
50368
- optionalToken,
50369
- propertyTypeNode
50370
- );
50371
- typeElements.push(preserveCommentsOn(propertySignature));
50372
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));
50373
50375
  function preserveCommentsOn(node) {
50374
50376
  var _a2;
50375
50377
  if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
@@ -59722,9 +59724,9 @@ ${lanes.join("\n")}
59722
59724
  );
59723
59725
  if (freshMapper) {
59724
59726
  const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
59725
- for (const p of freshParams) {
59726
- if (root.inferTypeParameters.indexOf(p) === -1) {
59727
- p.mapper = freshCombinedMapper;
59727
+ for (let i = 0; i < freshParams.length; i++) {
59728
+ if (freshParams[i] !== root.inferTypeParameters[i]) {
59729
+ freshParams[i].mapper = freshCombinedMapper;
59728
59730
  }
59729
59731
  }
59730
59732
  }
@@ -60627,6 +60629,9 @@ ${lanes.join("\n")}
60627
60629
  const elementFlags = tupleType.target.elementFlags;
60628
60630
  const elementTypes = map(getElementTypes(tupleType), (t, i) => {
60629
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
+ }
60630
60635
  return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
60631
60636
  });
60632
60637
  const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
@@ -60964,6 +60969,10 @@ ${lanes.join("\n")}
60964
60969
  return true;
60965
60970
  }
60966
60971
  switch (node.kind) {
60972
+ case 233 /* AsExpression */:
60973
+ if (!isConstAssertion(node)) {
60974
+ break;
60975
+ }
60967
60976
  case 293 /* JsxExpression */:
60968
60977
  case 216 /* ParenthesizedExpression */:
60969
60978
  return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer);
@@ -67242,7 +67251,7 @@ ${lanes.join("\n")}
67242
67251
  target.antecedents = saveAntecedents;
67243
67252
  } else if (flags & 2 /* Start */) {
67244
67253
  const container = flow.node;
67245
- 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 */)) {
67246
67255
  flow = container.flowNode;
67247
67256
  continue;
67248
67257
  }
@@ -75729,7 +75738,7 @@ ${lanes.join("\n")}
75729
75738
  Debug.assertIsDefined(leftType);
75730
75739
  const rightType = getLastResult(state);
75731
75740
  Debug.assertIsDefined(rightType);
75732
- 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);
75733
75742
  }
75734
75743
  state.skip = false;
75735
75744
  setLeftType(
@@ -75791,9 +75800,9 @@ ${lanes.join("\n")}
75791
75800
  leftType = checkExpression(left, checkMode);
75792
75801
  }
75793
75802
  const rightType = checkExpression(right, checkMode);
75794
- return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode);
75803
+ return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode);
75795
75804
  }
75796
- function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) {
75805
+ function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode) {
75797
75806
  const operator = operatorToken.kind;
75798
75807
  switch (operator) {
75799
75808
  case 42 /* AsteriskToken */:
@@ -75950,12 +75959,14 @@ ${lanes.join("\n")}
75950
75959
  case 36 /* ExclamationEqualsToken */:
75951
75960
  case 37 /* EqualsEqualsEqualsToken */:
75952
75961
  case 38 /* ExclamationEqualsEqualsToken */:
75953
- if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
75954
- const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
75955
- 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));
75956
75969
  }
75957
- checkNaNEquality(errorNode, operator, left, right);
75958
- reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2));
75959
75970
  return booleanType;
75960
75971
  case 104 /* InstanceOfKeyword */:
75961
75972
  return checkInstanceOfExpression(left, right, leftType, rightType);
@@ -76266,7 +76277,7 @@ ${lanes.join("\n")}
76266
76277
  }
76267
76278
  }
76268
76279
  function checkConditionalExpression(node, checkMode) {
76269
- const type = checkTruthinessExpression(node.condition);
76280
+ const type = checkTruthinessExpression(node.condition, checkMode);
76270
76281
  checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
76271
76282
  const type1 = checkExpression(node.whenTrue, checkMode);
76272
76283
  const type2 = checkExpression(node.whenFalse, checkMode);
@@ -76607,7 +76618,7 @@ ${lanes.join("\n")}
76607
76618
  }
76608
76619
  }
76609
76620
  const startInvocationCount = flowInvocationCount;
76610
- const type = checkExpression(node);
76621
+ const type = checkExpression(node, 128 /* TypeOnly */);
76611
76622
  if (flowInvocationCount !== startInvocationCount) {
76612
76623
  const cache = flowTypeCache || (flowTypeCache = []);
76613
76624
  cache[getNodeId(node)] = type;
@@ -76683,7 +76694,7 @@ ${lanes.join("\n")}
76683
76694
  if (getIsolatedModules(compilerOptions)) {
76684
76695
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
76685
76696
  const constEnumDeclaration = type.symbol.valueDeclaration;
76686
- if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
76697
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
76687
76698
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
76688
76699
  }
76689
76700
  }
@@ -85817,6 +85828,7 @@ ${lanes.join("\n")}
85817
85828
  CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
85818
85829
  CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
85819
85830
  CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
85831
+ CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
85820
85832
  return CheckMode3;
85821
85833
  })(CheckMode || {});
85822
85834
  SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -134196,12 +134208,12 @@ ${lanes.join("\n")}
134196
134208
  refactorName = "Convert export";
134197
134209
  defaultToNamedAction = {
134198
134210
  name: "Convert default export to named export",
134199
- description: Diagnostics.Convert_default_export_to_named_export.message,
134211
+ description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export),
134200
134212
  kind: "refactor.rewrite.export.named"
134201
134213
  };
134202
134214
  namedToDefaultAction = {
134203
134215
  name: "Convert named export to default export",
134204
- description: Diagnostics.Convert_named_export_to_default_export.message,
134216
+ description: getLocaleSpecificMessage(Diagnostics.Convert_named_export_to_default_export),
134205
134217
  kind: "refactor.rewrite.export.default"
134206
134218
  };
134207
134219
  registerRefactor(refactorName, {
@@ -134219,7 +134231,7 @@ ${lanes.join("\n")}
134219
134231
  }
134220
134232
  if (context.preferences.provideRefactorNotApplicableReason) {
134221
134233
  return [
134222
- { 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: [
134223
134235
  { ...defaultToNamedAction, notApplicableReason: info.error },
134224
134236
  { ...namedToDefaultAction, notApplicableReason: info.error }
134225
134237
  ] }
@@ -134421,17 +134433,17 @@ ${lanes.join("\n")}
134421
134433
  actions = {
134422
134434
  [0 /* Named */]: {
134423
134435
  name: "Convert namespace import to named imports",
134424
- description: Diagnostics.Convert_namespace_import_to_named_imports.message,
134436
+ description: getLocaleSpecificMessage(Diagnostics.Convert_namespace_import_to_named_imports),
134425
134437
  kind: "refactor.rewrite.import.named"
134426
134438
  },
134427
134439
  [2 /* Namespace */]: {
134428
134440
  name: "Convert named imports to namespace import",
134429
- description: Diagnostics.Convert_named_imports_to_namespace_import.message,
134441
+ description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_namespace_import),
134430
134442
  kind: "refactor.rewrite.import.namespace"
134431
134443
  },
134432
134444
  [1 /* Default */]: {
134433
134445
  name: "Convert named imports to default import",
134434
- description: Diagnostics.Convert_named_imports_to_default_import.message,
134446
+ description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_default_import),
134435
134447
  kind: "refactor.rewrite.import.default"
134436
134448
  }
134437
134449
  };
@@ -134900,10 +134912,9 @@ ${lanes.join("\n")}
134900
134912
 
134901
134913
  // src/services/refactors/moveToFile.ts
134902
134914
  function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
134903
- var _a;
134904
134915
  const checker = program.getTypeChecker();
134905
134916
  const usage = getUsageInfo(oldFile, toMove.all, checker);
134906
- if (!host.fileExists(targetFile) || host.fileExists(targetFile) && ((_a = program.getSourceFile(targetFile)) == null ? void 0 : _a.statements.length) === 0) {
134917
+ if (!host.fileExists(targetFile)) {
134907
134918
  changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
134908
134919
  addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
134909
134920
  } else {
@@ -134941,6 +134952,13 @@ ${lanes.join("\n")}
134941
134952
  if (typeof targetFile !== "string") {
134942
134953
  if (targetFile.statements.length > 0) {
134943
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
+ );
134944
134962
  }
134945
134963
  if (imports.length > 0) {
134946
134964
  insertImports(
@@ -135527,6 +135545,10 @@ ${lanes.join("\n")}
135527
135545
  if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
135528
135546
  return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
135529
135547
  }
135548
+ const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
135549
+ if (overloadRangeToMove) {
135550
+ return overloadRangeToMove;
135551
+ }
135530
135552
  if (range.pos > startStatement.getStart(file))
135531
135553
  return void 0;
135532
135554
  const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
@@ -135722,6 +135744,19 @@ ${lanes.join("\n")}
135722
135744
  return false;
135723
135745
  }
135724
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
+ }
135725
135760
  var refactorNameForMoveToFile, description2, moveToFileAction;
135726
135761
  var init_moveToFile = __esm({
135727
135762
  "src/services/refactors/moveToFile.ts"() {
@@ -135976,7 +136011,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
135976
136011
  init_ts4();
135977
136012
  init_ts_refactor();
135978
136013
  refactorName5 = "Convert overload list to single signature";
135979
- refactorDescription = Diagnostics.Convert_overload_list_to_single_signature.message;
136014
+ refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
135980
136015
  functionOverloadAction = {
135981
136016
  name: refactorName5,
135982
136017
  description: refactorDescription,
@@ -136106,15 +136141,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136106
136141
  init_ts4();
136107
136142
  init_ts_refactor();
136108
136143
  refactorName6 = "Add or remove braces in an arrow function";
136109
- refactorDescription2 = Diagnostics.Add_or_remove_braces_in_an_arrow_function.message;
136144
+ refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
136110
136145
  addBracesAction = {
136111
136146
  name: "Add braces to arrow function",
136112
- description: Diagnostics.Add_braces_to_arrow_function.message,
136147
+ description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
136113
136148
  kind: "refactor.rewrite.arrow.braces.add"
136114
136149
  };
136115
136150
  removeBracesAction = {
136116
136151
  name: "Remove braces from arrow function",
136117
- description: Diagnostics.Remove_braces_from_arrow_function.message,
136152
+ description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
136118
136153
  kind: "refactor.rewrite.arrow.braces.remove"
136119
136154
  };
136120
136155
  registerRefactor(refactorName6, {
@@ -136985,7 +137020,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136985
137020
  }
136986
137021
  }
136987
137022
  function isNotEqualsOperator(node) {
136988
- return node.operatorToken.kind !== 64 /* EqualsToken */;
137023
+ return !(node.operatorToken.kind === 64 /* EqualsToken */ || node.operatorToken.kind === 65 /* PlusEqualsToken */);
136989
137024
  }
136990
137025
  function getParentBinaryExpression(expr) {
136991
137026
  const container = findAncestor(expr.parent, (n) => {
@@ -139020,7 +139055,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139020
139055
  init_ts4();
139021
139056
  init_ts_refactor();
139022
139057
  actionName = "Generate 'get' and 'set' accessors";
139023
- actionDescription = Diagnostics.Generate_get_and_set_accessors.message;
139058
+ actionDescription = getLocaleSpecificMessage(Diagnostics.Generate_get_and_set_accessors);
139024
139059
  generateGetSetAction = {
139025
139060
  name: actionName,
139026
139061
  description: actionDescription,
@@ -139172,7 +139207,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139172
139207
  init_ts4();
139173
139208
  init_ts_refactor();
139174
139209
  refactorName12 = "Infer function return type";
139175
- refactorDescription6 = Diagnostics.Infer_function_return_type.message;
139210
+ refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
139176
139211
  inferReturnTypeAction = {
139177
139212
  name: refactorName12,
139178
139213
  description: refactorDescription6,
@@ -139843,7 +139878,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139843
139878
  onUnRecoverableConfigFileDiagnostic: noop
139844
139879
  };
139845
139880
  const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
139881
+ let releasedScriptKinds = /* @__PURE__ */ new Set();
139846
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;
139847
139886
  return;
139848
139887
  }
139849
139888
  const options = {
@@ -139856,6 +139895,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139856
139895
  program = createProgram(options);
139857
139896
  compilerHost = void 0;
139858
139897
  parsedCommandLines = void 0;
139898
+ releasedScriptKinds = void 0;
139859
139899
  sourceMapper.clearCache();
139860
139900
  program.getTypeChecker();
139861
139901
  return;
@@ -139910,10 +139950,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139910
139950
  if (!shouldCreateNewSourceFile) {
139911
139951
  const oldSourceFile = program && program.getSourceFileByPath(path);
139912
139952
  if (oldSourceFile) {
139913
- if (scriptKind === oldSourceFile.scriptKind) {
139953
+ if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) {
139914
139954
  return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
139915
139955
  } else {
139916
139956
  documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
139957
+ releasedScriptKinds.add(oldSourceFile.resolvedPath);
139917
139958
  }
139918
139959
  }
139919
139960
  }
@@ -149209,9 +149250,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149209
149250
  if (call === void 0) {
149210
149251
  return void 0;
149211
149252
  }
149212
- if (isPrivateIdentifier(token)) {
149213
- return void 0;
149214
- }
149215
149253
  const methodName = token.text;
149216
149254
  const addMethodDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addMethodDeclaration(context, t, call, token, modifierFlags2, parentDeclaration, declSourceFile));
149217
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)];
@@ -152548,6 +152586,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
152548
152586
  type === void 0 ? factory.createKeywordTypeNode(159 /* UnknownKeyword */) : type
152549
152587
  );
152550
152588
  case 261 /* FunctionDeclaration */:
152589
+ Debug.assert(typeof name === "string" || isIdentifier(name), "Unexpected name");
152551
152590
  return factory.createFunctionDeclaration(
152552
152591
  modifiers,
152553
152592
  asteriskToken,
@@ -160833,9 +160872,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160833
160872
  if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) {
160834
160873
  getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2);
160835
160874
  }
160836
- const containingClass = getContainingClassIfInHeritageClause(refNode);
160837
- if (containingClass) {
160838
- addReference2(containingClass);
160875
+ const containingNode = getContainingNodeIfInHeritageClause(refNode);
160876
+ if (containingNode) {
160877
+ addReference2(containingNode);
160839
160878
  return;
160840
160879
  }
160841
160880
  const typeNode = findAncestor(refNode, (a) => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent));
@@ -160862,8 +160901,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
160862
160901
  addReference2(e);
160863
160902
  }
160864
160903
  }
160865
- function getContainingClassIfInHeritageClause(node) {
160866
- 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;
160867
160906
  }
160868
160907
  function isImplementationExpression(node) {
160869
160908
  switch (node.kind) {
@@ -162375,7 +162414,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162375
162414
  const tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : "");
162376
162415
  const openComment = "/**";
162377
162416
  const closeComment = " */";
162378
- const hasTag = (commentOwnerJsDoc || []).some((jsDoc) => !!jsDoc.tags);
162417
+ const hasTag = length(getJSDocTags(commentOwner)) > 0;
162379
162418
  if (tags && !hasTag) {
162380
162419
  const preamble = openComment + newLine + indentationStr + " * ";
162381
162420
  const endLine = tokenStart === position ? newLine + indentationStr : "";
@@ -165896,6 +165935,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
165896
165935
  this.insertNodeAt(sourceFile, pos, insert, options);
165897
165936
  }
165898
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
+ }
165899
165949
  insertStatementsInNewFile(fileName, statements, oldFile) {
165900
165950
  if (!this.newFileChanges) {
165901
165951
  this.newFileChanges = createMultiMap();
@@ -167928,7 +167978,8 @@ ${options.prefix}` : "\n" : options.prefix
167928
167978
  }
167929
167979
  processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
167930
167980
  }
167931
- if (!formattingScanner.isOnToken()) {
167981
+ const remainingTrivia = formattingScanner.getCurrentLeadingTrivia();
167982
+ if (remainingTrivia) {
167932
167983
  const indentation = SmartIndenter.nodeWillIndentChild(
167933
167984
  options,
167934
167985
  enclosingNode,
@@ -167938,25 +167989,30 @@ ${options.prefix}` : "\n" : options.prefix
167938
167989
  /*indentByDefault*/
167939
167990
  false
167940
167991
  ) ? initialIndentation + options.indentSize : initialIndentation;
167941
- const leadingTrivia = formattingScanner.getCurrentLeadingTrivia();
167942
- if (leadingTrivia) {
167943
- indentTriviaItems(
167944
- leadingTrivia,
167945
- indentation,
167946
- /*indentNextTokenOrTrivia*/
167947
- false,
167948
- (item) => processRange(
167992
+ indentTriviaItems(
167993
+ remainingTrivia,
167994
+ indentation,
167995
+ /*indentNextTokenOrTrivia*/
167996
+ true,
167997
+ (item) => {
167998
+ processRange(
167949
167999
  item,
167950
168000
  sourceFile.getLineAndCharacterOfPosition(item.pos),
167951
168001
  enclosingNode,
167952
168002
  enclosingNode,
167953
168003
  /*dynamicIndentation*/
167954
168004
  void 0
167955
- )
167956
- );
167957
- if (options.trimTrailingWhitespace !== false) {
167958
- trimTrailingWhitespacesForRemainingRange(leadingTrivia);
168005
+ );
168006
+ insertIndentation(
168007
+ item.pos,
168008
+ indentation,
168009
+ /*lineAdded*/
168010
+ false
168011
+ );
167959
168012
  }
168013
+ );
168014
+ if (options.trimTrailingWhitespace !== false) {
168015
+ trimTrailingWhitespacesForRemainingRange(remainingTrivia);
167960
168016
  }
167961
168017
  }
167962
168018
  if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) {
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.2";
57
- var version = `${versionMajorMinor}.0-dev.20230524`;
57
+ var version = `${versionMajorMinor}.0-dev.20230527`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -28916,6 +28916,7 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
28916
28916
  CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
28917
28917
  CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
28918
28918
  CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
28919
+ CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
28919
28920
  return CheckMode3;
28920
28921
  })(CheckMode || {});
28921
28922
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.2.0-dev.20230524",
5
+ "version": "5.2.0-dev.20230527",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "2beeb8b93143f75cdf788d05bb3678ce3ff0e2b3"
116
+ "gitHead": "ca0fafd694f13775f7491982a83620b51c2b785d"
117
117
  }