@typescript-deploys/pr-build 5.2.0-pr-54316-2 → 5.2.0-pr-54377-7

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.
@@ -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.20230524`;
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));
@@ -64416,7 +64420,7 @@ ${lanes.join("\n")}
64416
64420
  }
64417
64421
  function getRecursionIdentity(type) {
64418
64422
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
64419
- if (getObjectFlags(type) && 4 /* Reference */ && type.node) {
64423
+ if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
64420
64424
  return type.node;
64421
64425
  }
64422
64426
  if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
@@ -65191,6 +65195,8 @@ ${lanes.join("\n")}
65191
65195
  return context && context.mapper;
65192
65196
  }
65193
65197
  function couldContainTypeVariables(type) {
65198
+ if (type.flags & 67359327 /* Intrinsic */)
65199
+ return false;
65194
65200
  const objectFlags = getObjectFlags(type);
65195
65201
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
65196
65202
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
@@ -76684,7 +76690,7 @@ ${lanes.join("\n")}
76684
76690
  if (getIsolatedModules(compilerOptions)) {
76685
76691
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
76686
76692
  const constEnumDeclaration = type.symbol.valueDeclaration;
76687
- if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
76693
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
76688
76694
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
76689
76695
  }
76690
76696
  }
@@ -77113,6 +77119,9 @@ ${lanes.join("\n")}
77113
77119
  case "length":
77114
77120
  case "caller":
77115
77121
  case "arguments":
77122
+ if (compilerOptions.useDefineForClassFields) {
77123
+ break;
77124
+ }
77116
77125
  case "prototype":
77117
77126
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
77118
77127
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -84119,7 +84128,7 @@ ${lanes.join("\n")}
84119
84128
  if (requestedExternalEmitHelperNames.has(name))
84120
84129
  continue;
84121
84130
  requestedExternalEmitHelperNames.add(name);
84122
- const symbol = getSymbol2(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */);
84131
+ const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
84123
84132
  if (!symbol) {
84124
84133
  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
84134
  } else if (helper & 524288 /* ClassPrivateFieldGet */) {
@@ -121831,7 +121840,7 @@ ${lanes.join("\n")}
121831
121840
  let filesWithChangedSetOfUnresolvedImports;
121832
121841
  let filesWithInvalidatedResolutions;
121833
121842
  let filesWithInvalidatedNonRelativeUnresolvedImports;
121834
- const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
121843
+ const nonRelativeExternalModuleResolutions = createMultiMap();
121835
121844
  const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
121836
121845
  const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
121837
121846
  const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -121965,7 +121974,8 @@ ${lanes.join("\n")}
121965
121974
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
121966
121975
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
121967
121976
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
121968
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
121977
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
121978
+ nonRelativeExternalModuleResolutions.clear();
121969
121979
  }
121970
121980
  function cleanupLibResolutionWatching(newProgram) {
121971
121981
  resolvedLibraries.forEach((resolution, libFileName) => {
@@ -121983,7 +121993,8 @@ ${lanes.join("\n")}
121983
121993
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
121984
121994
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
121985
121995
  allModuleAndTypeResolutionsAreInvalidated = false;
121986
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
121996
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
121997
+ nonRelativeExternalModuleResolutions.clear();
121987
121998
  if (newProgram !== oldProgram) {
121988
121999
  cleanupLibResolutionWatching(newProgram);
121989
122000
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
@@ -122264,7 +122275,7 @@ ${lanes.join("\n")}
122264
122275
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
122265
122276
  watchFailedLookupLocationOfResolution(resolution);
122266
122277
  } else {
122267
- nonRelativeExternalModuleResolutions.add(resolution);
122278
+ nonRelativeExternalModuleResolutions.add(name, resolution);
122268
122279
  }
122269
122280
  const resolved = getResolutionWithResolvedFileName(resolution);
122270
122281
  if (resolved && resolved.resolvedFileName) {
@@ -122394,9 +122405,17 @@ ${lanes.join("\n")}
122394
122405
  paths.add(affectingLocation);
122395
122406
  }
122396
122407
  }
122397
- function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
122398
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
122399
- nonRelativeExternalModuleResolutions.clear();
122408
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
122409
+ const program = resolutionHost.getCurrentProgram();
122410
+ if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
122411
+ resolutions.forEach(watchFailedLookupLocationOfResolution);
122412
+ } else {
122413
+ resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
122414
+ resolution,
122415
+ /*addToResolutionsWithOnlyAffectingLocations*/
122416
+ true
122417
+ ));
122418
+ }
122400
122419
  }
122401
122420
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
122402
122421
  const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
@@ -134873,10 +134892,9 @@ ${lanes.join("\n")}
134873
134892
 
134874
134893
  // src/services/refactors/moveToFile.ts
134875
134894
  function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
134876
- var _a;
134877
134895
  const checker = program.getTypeChecker();
134878
134896
  const usage = getUsageInfo(oldFile, toMove.all, checker);
134879
- if (!host.fileExists(targetFile) || host.fileExists(targetFile) && ((_a = program.getSourceFile(targetFile)) == null ? void 0 : _a.statements.length) === 0) {
134897
+ if (!host.fileExists(targetFile)) {
134880
134898
  changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
134881
134899
  addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
134882
134900
  } else {
@@ -134914,6 +134932,13 @@ ${lanes.join("\n")}
134914
134932
  if (typeof targetFile !== "string") {
134915
134933
  if (targetFile.statements.length > 0) {
134916
134934
  changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
134935
+ } else {
134936
+ changes.insertNodesAtEndOfFile(
134937
+ targetFile,
134938
+ body,
134939
+ /*blankLineBetween*/
134940
+ false
134941
+ );
134917
134942
  }
134918
134943
  if (imports.length > 0) {
134919
134944
  insertImports(
@@ -165869,6 +165894,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
165869
165894
  this.insertNodeAt(sourceFile, pos, insert, options);
165870
165895
  }
165871
165896
  }
165897
+ insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
165898
+ this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
165899
+ }
165900
+ insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
165901
+ const pos = sourceFile.end + 1;
165902
+ const options = {
165903
+ prefix: this.newLineCharacter,
165904
+ suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
165905
+ };
165906
+ this.insertNodesAt(sourceFile, pos, insert, options);
165907
+ }
165872
165908
  insertStatementsInNewFile(fileName, statements, oldFile) {
165873
165909
  if (!this.newFileChanges) {
165874
165910
  this.newFileChanges = createMultiMap();
@@ -6227,7 +6227,7 @@ declare namespace ts {
6227
6227
  * arguments for any interactive action before offering it.
6228
6228
  */
6229
6229
  getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
6230
- getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, includeInteractiveActions?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
6230
+ getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, interactiveRefactorArguments?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
6231
6231
  getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
6232
6232
  newFileName: string;
6233
6233
  files: string[];