@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.
@@ -22,3 +22,4 @@ and limitations under the License.
22
22
  /// <reference lib="es2017.string" />
23
23
  /// <reference lib="es2017.intl" />
24
24
  /// <reference lib="es2017.typedarrays" />
25
+ /// <reference lib="es2017.date" />
@@ -0,0 +1,31 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+ /// <reference no-default-lib="true"/>
18
+
19
+ interface DateConstructor {
20
+ /**
21
+ * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
22
+ * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
23
+ * @param monthIndex The month as a number between 0 and 11 (January to December).
24
+ * @param date The date as a number between 1 and 31.
25
+ * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
26
+ * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
27
+ * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
28
+ * @param ms A number from 0 to 999 that specifies the milliseconds.
29
+ */
30
+ UTC(year: number, monthIndex?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
31
+ }
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.2";
21
- var version = `${versionMajorMinor}.0-insiders.20230518`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230524`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -33368,6 +33368,7 @@ var libEntries = [
33368
33368
  ["es2015.symbol", "lib.es2015.symbol.d.ts"],
33369
33369
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
33370
33370
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
33371
+ ["es2017.date", "lib.es2017.date.d.ts"],
33371
33372
  ["es2017.object", "lib.es2017.object.d.ts"],
33372
33373
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
33373
33374
  ["es2017.string", "lib.es2017.string.d.ts"],
@@ -47901,32 +47902,34 @@ function createTypeChecker(host) {
47901
47902
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
47902
47903
  typeElements.push(preserveCommentsOn(methodDeclaration));
47903
47904
  }
47905
+ if (signatures.length || !optionalToken) {
47906
+ return;
47907
+ }
47908
+ }
47909
+ let propertyTypeNode;
47910
+ if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
47911
+ propertyTypeNode = createElidedInformationPlaceholder(context);
47904
47912
  } else {
47905
- let propertyTypeNode;
47906
- if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
47907
- propertyTypeNode = createElidedInformationPlaceholder(context);
47908
- } else {
47909
- if (propertyIsReverseMapped) {
47910
- context.reverseMappedStack || (context.reverseMappedStack = []);
47911
- context.reverseMappedStack.push(propertySymbol);
47912
- }
47913
- propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
47914
- if (propertyIsReverseMapped) {
47915
- context.reverseMappedStack.pop();
47916
- }
47913
+ if (propertyIsReverseMapped) {
47914
+ context.reverseMappedStack || (context.reverseMappedStack = []);
47915
+ context.reverseMappedStack.push(propertySymbol);
47917
47916
  }
47918
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
47919
- if (modifiers) {
47920
- context.approximateLength += 9;
47917
+ propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
47918
+ if (propertyIsReverseMapped) {
47919
+ context.reverseMappedStack.pop();
47921
47920
  }
47922
- const propertySignature = factory.createPropertySignature(
47923
- modifiers,
47924
- propertyName,
47925
- optionalToken,
47926
- propertyTypeNode
47927
- );
47928
- typeElements.push(preserveCommentsOn(propertySignature));
47929
47921
  }
47922
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
47923
+ if (modifiers) {
47924
+ context.approximateLength += 9;
47925
+ }
47926
+ const propertySignature = factory.createPropertySignature(
47927
+ modifiers,
47928
+ propertyName,
47929
+ optionalToken,
47930
+ propertyTypeNode
47931
+ );
47932
+ typeElements.push(preserveCommentsOn(propertySignature));
47930
47933
  function preserveCommentsOn(node) {
47931
47934
  var _a2;
47932
47935
  if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
@@ -53989,7 +53992,7 @@ function createTypeChecker(host) {
53989
53992
  } else if (type !== firstType) {
53990
53993
  checkFlags |= 64 /* HasNonUniformType */;
53991
53994
  }
53992
- if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
53995
+ if (isLiteralType(type) || isPatternLiteralType(type)) {
53993
53996
  checkFlags |= 128 /* HasLiteralType */;
53994
53997
  }
53995
53998
  if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
@@ -56216,31 +56219,28 @@ function createTypeChecker(host) {
56216
56219
  return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
56217
56220
  }
56218
56221
  function getUnionOrIntersectionTypePredicate(signatures, kind) {
56219
- let first2;
56222
+ let last2;
56220
56223
  const types = [];
56221
56224
  for (const sig of signatures) {
56222
56225
  const pred = getTypePredicateOfSignature(sig);
56223
- if (!pred || pred.kind === 2 /* AssertsThis */ || pred.kind === 3 /* AssertsIdentifier */) {
56224
- if (kind !== 2097152 /* Intersection */) {
56225
- continue;
56226
- } else {
56227
- return;
56228
- }
56229
- }
56230
- if (first2) {
56231
- if (!typePredicateKindsMatch(first2, pred)) {
56226
+ if (pred) {
56227
+ if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
56232
56228
  return void 0;
56233
56229
  }
56230
+ last2 = pred;
56231
+ types.push(pred.type);
56234
56232
  } else {
56235
- first2 = pred;
56233
+ const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
56234
+ if (returnType !== falseType && returnType !== regularFalseType) {
56235
+ return void 0;
56236
+ }
56236
56237
  }
56237
- types.push(pred.type);
56238
56238
  }
56239
- if (!first2) {
56239
+ if (!last2) {
56240
56240
  return void 0;
56241
56241
  }
56242
56242
  const compositeType = getUnionOrIntersectionType(types, kind);
56243
- return createTypePredicate(first2.kind, first2.parameterName, first2.parameterIndex, compositeType);
56243
+ return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
56244
56244
  }
56245
56245
  function typePredicateKindsMatch(a, b) {
56246
56246
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
@@ -57282,9 +57282,9 @@ function createTypeChecker(host) {
57282
57282
  );
57283
57283
  if (freshMapper) {
57284
57284
  const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
57285
- for (const p of freshParams) {
57286
- if (root.inferTypeParameters.indexOf(p) === -1) {
57287
- p.mapper = freshCombinedMapper;
57285
+ for (let i = 0; i < freshParams.length; i++) {
57286
+ if (freshParams[i] !== root.inferTypeParameters[i]) {
57287
+ freshParams[i].mapper = freshCombinedMapper;
57288
57288
  }
57289
57289
  }
57290
57290
  }
@@ -58121,18 +58121,19 @@ function createTypeChecker(host) {
58121
58121
  case 185 /* TypeQuery */:
58122
58122
  const entityName = node2.exprName;
58123
58123
  const firstIdentifier = getFirstIdentifier(entityName);
58124
- const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
58125
- const tpDeclaration = tp.symbol.declarations[0];
58126
- let tpScope;
58127
- if (tpDeclaration.kind === 167 /* TypeParameter */) {
58128
- tpScope = tpDeclaration.parent;
58129
- } else if (tp.isThisType) {
58130
- tpScope = tpDeclaration;
58131
- } else {
58132
- return true;
58133
- }
58134
- if (firstIdentifierSymbol.declarations) {
58135
- return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
58124
+ if (!isThisIdentifier(firstIdentifier)) {
58125
+ const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
58126
+ const tpDeclaration = tp.symbol.declarations[0];
58127
+ const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
58128
+ // Type parameter is a regular type parameter, e.g. foo<T>
58129
+ tp.isThisType ? tpDeclaration : (
58130
+ // Type parameter is the this type, and its declaration is the class declaration.
58131
+ void 0
58132
+ )
58133
+ );
58134
+ if (firstIdentifierSymbol.declarations && tpScope) {
58135
+ return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
58136
+ }
58136
58137
  }
58137
58138
  return true;
58138
58139
  case 173 /* MethodDeclaration */:
@@ -58186,6 +58187,9 @@ function createTypeChecker(host) {
58186
58187
  const elementFlags = tupleType.target.elementFlags;
58187
58188
  const elementTypes = map(getElementTypes(tupleType), (t, i) => {
58188
58189
  const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
58190
+ if (singleton === typeVariable) {
58191
+ return mappedType;
58192
+ }
58189
58193
  return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
58190
58194
  });
58191
58195
  const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
@@ -61974,7 +61978,7 @@ function createTypeChecker(host) {
61974
61978
  }
61975
61979
  function getRecursionIdentity(type) {
61976
61980
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
61977
- if (getObjectFlags(type) && 4 /* Reference */ && type.node) {
61981
+ if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
61978
61982
  return type.node;
61979
61983
  }
61980
61984
  if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
@@ -62749,6 +62753,8 @@ function createTypeChecker(host) {
62749
62753
  return context && context.mapper;
62750
62754
  }
62751
62755
  function couldContainTypeVariables(type) {
62756
+ if (type.flags & 67359327 /* Intrinsic */)
62757
+ return false;
62752
62758
  const objectFlags = getObjectFlags(type);
62753
62759
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
62754
62760
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
@@ -74242,7 +74248,7 @@ function createTypeChecker(host) {
74242
74248
  if (getIsolatedModules(compilerOptions)) {
74243
74249
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
74244
74250
  const constEnumDeclaration = type.symbol.valueDeclaration;
74245
- if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
74251
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
74246
74252
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
74247
74253
  }
74248
74254
  }
@@ -74671,6 +74677,9 @@ function createTypeChecker(host) {
74671
74677
  case "length":
74672
74678
  case "caller":
74673
74679
  case "arguments":
74680
+ if (compilerOptions.useDefineForClassFields) {
74681
+ break;
74682
+ }
74674
74683
  case "prototype":
74675
74684
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
74676
74685
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -81677,7 +81686,7 @@ function createTypeChecker(host) {
81677
81686
  if (requestedExternalEmitHelperNames.has(name))
81678
81687
  continue;
81679
81688
  requestedExternalEmitHelperNames.add(name);
81680
- const symbol = getSymbol(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */);
81689
+ const symbol = getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
81681
81690
  if (!symbol) {
81682
81691
  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);
81683
81692
  } else if (helper & 524288 /* ClassPrivateFieldGet */) {
@@ -118755,7 +118764,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118755
118764
  let filesWithChangedSetOfUnresolvedImports;
118756
118765
  let filesWithInvalidatedResolutions;
118757
118766
  let filesWithInvalidatedNonRelativeUnresolvedImports;
118758
- const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
118767
+ const nonRelativeExternalModuleResolutions = createMultiMap();
118759
118768
  const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
118760
118769
  const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
118761
118770
  const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -118889,7 +118898,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118889
118898
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
118890
118899
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
118891
118900
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
118892
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
118901
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
118902
+ nonRelativeExternalModuleResolutions.clear();
118893
118903
  }
118894
118904
  function cleanupLibResolutionWatching(newProgram) {
118895
118905
  resolvedLibraries.forEach((resolution, libFileName) => {
@@ -118907,7 +118917,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118907
118917
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
118908
118918
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
118909
118919
  allModuleAndTypeResolutionsAreInvalidated = false;
118910
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
118920
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
118921
+ nonRelativeExternalModuleResolutions.clear();
118911
118922
  if (newProgram !== oldProgram) {
118912
118923
  cleanupLibResolutionWatching(newProgram);
118913
118924
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
@@ -119188,7 +119199,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119188
119199
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
119189
119200
  watchFailedLookupLocationOfResolution(resolution);
119190
119201
  } else {
119191
- nonRelativeExternalModuleResolutions.add(resolution);
119202
+ nonRelativeExternalModuleResolutions.add(name, resolution);
119192
119203
  }
119193
119204
  const resolved = getResolutionWithResolvedFileName(resolution);
119194
119205
  if (resolved && resolved.resolvedFileName) {
@@ -119318,9 +119329,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119318
119329
  paths.add(affectingLocation);
119319
119330
  }
119320
119331
  }
119321
- function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
119322
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
119323
- nonRelativeExternalModuleResolutions.clear();
119332
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
119333
+ const program = resolutionHost.getCurrentProgram();
119334
+ if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
119335
+ resolutions.forEach(watchFailedLookupLocationOfResolution);
119336
+ } else {
119337
+ resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
119338
+ resolution,
119339
+ /*addToResolutionsWithOnlyAffectingLocations*/
119340
+ true
119341
+ ));
119342
+ }
119324
119343
  }
119325
119344
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
119326
119345
  const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
package/lib/tsserver.js CHANGED
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
2304
2304
 
2305
2305
  // src/compiler/corePublic.ts
2306
2306
  var versionMajorMinor = "5.2";
2307
- var version = `${versionMajorMinor}.0-insiders.20230518`;
2307
+ var version = `${versionMajorMinor}.0-insiders.20230524`;
2308
2308
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2309
2309
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2310
2310
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -37753,6 +37753,7 @@ var libEntries = [
37753
37753
  ["es2015.symbol", "lib.es2015.symbol.d.ts"],
37754
37754
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
37755
37755
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
37756
+ ["es2017.date", "lib.es2017.date.d.ts"],
37756
37757
  ["es2017.object", "lib.es2017.object.d.ts"],
37757
37758
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
37758
37759
  ["es2017.string", "lib.es2017.string.d.ts"],
@@ -52552,32 +52553,34 @@ function createTypeChecker(host) {
52552
52553
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
52553
52554
  typeElements.push(preserveCommentsOn(methodDeclaration));
52554
52555
  }
52556
+ if (signatures.length || !optionalToken) {
52557
+ return;
52558
+ }
52559
+ }
52560
+ let propertyTypeNode;
52561
+ if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
52562
+ propertyTypeNode = createElidedInformationPlaceholder(context);
52555
52563
  } else {
52556
- let propertyTypeNode;
52557
- if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
52558
- propertyTypeNode = createElidedInformationPlaceholder(context);
52559
- } else {
52560
- if (propertyIsReverseMapped) {
52561
- context.reverseMappedStack || (context.reverseMappedStack = []);
52562
- context.reverseMappedStack.push(propertySymbol);
52563
- }
52564
- propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
52565
- if (propertyIsReverseMapped) {
52566
- context.reverseMappedStack.pop();
52567
- }
52564
+ if (propertyIsReverseMapped) {
52565
+ context.reverseMappedStack || (context.reverseMappedStack = []);
52566
+ context.reverseMappedStack.push(propertySymbol);
52568
52567
  }
52569
- const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
52570
- if (modifiers) {
52571
- context.approximateLength += 9;
52568
+ propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
52569
+ if (propertyIsReverseMapped) {
52570
+ context.reverseMappedStack.pop();
52572
52571
  }
52573
- const propertySignature = factory.createPropertySignature(
52574
- modifiers,
52575
- propertyName,
52576
- optionalToken,
52577
- propertyTypeNode
52578
- );
52579
- typeElements.push(preserveCommentsOn(propertySignature));
52580
52572
  }
52573
+ const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
52574
+ if (modifiers) {
52575
+ context.approximateLength += 9;
52576
+ }
52577
+ const propertySignature = factory.createPropertySignature(
52578
+ modifiers,
52579
+ propertyName,
52580
+ optionalToken,
52581
+ propertyTypeNode
52582
+ );
52583
+ typeElements.push(preserveCommentsOn(propertySignature));
52581
52584
  function preserveCommentsOn(node) {
52582
52585
  var _a2;
52583
52586
  if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
@@ -58640,7 +58643,7 @@ function createTypeChecker(host) {
58640
58643
  } else if (type !== firstType) {
58641
58644
  checkFlags |= 64 /* HasNonUniformType */;
58642
58645
  }
58643
- if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
58646
+ if (isLiteralType(type) || isPatternLiteralType(type)) {
58644
58647
  checkFlags |= 128 /* HasLiteralType */;
58645
58648
  }
58646
58649
  if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
@@ -60867,31 +60870,28 @@ function createTypeChecker(host) {
60867
60870
  return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
60868
60871
  }
60869
60872
  function getUnionOrIntersectionTypePredicate(signatures, kind) {
60870
- let first2;
60873
+ let last2;
60871
60874
  const types = [];
60872
60875
  for (const sig of signatures) {
60873
60876
  const pred = getTypePredicateOfSignature(sig);
60874
- if (!pred || pred.kind === 2 /* AssertsThis */ || pred.kind === 3 /* AssertsIdentifier */) {
60875
- if (kind !== 2097152 /* Intersection */) {
60876
- continue;
60877
- } else {
60878
- return;
60879
- }
60880
- }
60881
- if (first2) {
60882
- if (!typePredicateKindsMatch(first2, pred)) {
60877
+ if (pred) {
60878
+ if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
60883
60879
  return void 0;
60884
60880
  }
60881
+ last2 = pred;
60882
+ types.push(pred.type);
60885
60883
  } else {
60886
- first2 = pred;
60884
+ const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
60885
+ if (returnType !== falseType && returnType !== regularFalseType) {
60886
+ return void 0;
60887
+ }
60887
60888
  }
60888
- types.push(pred.type);
60889
60889
  }
60890
- if (!first2) {
60890
+ if (!last2) {
60891
60891
  return void 0;
60892
60892
  }
60893
60893
  const compositeType = getUnionOrIntersectionType(types, kind);
60894
- return createTypePredicate(first2.kind, first2.parameterName, first2.parameterIndex, compositeType);
60894
+ return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
60895
60895
  }
60896
60896
  function typePredicateKindsMatch(a, b) {
60897
60897
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
@@ -61933,9 +61933,9 @@ function createTypeChecker(host) {
61933
61933
  );
61934
61934
  if (freshMapper) {
61935
61935
  const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
61936
- for (const p of freshParams) {
61937
- if (root.inferTypeParameters.indexOf(p) === -1) {
61938
- p.mapper = freshCombinedMapper;
61936
+ for (let i = 0; i < freshParams.length; i++) {
61937
+ if (freshParams[i] !== root.inferTypeParameters[i]) {
61938
+ freshParams[i].mapper = freshCombinedMapper;
61939
61939
  }
61940
61940
  }
61941
61941
  }
@@ -62772,18 +62772,19 @@ function createTypeChecker(host) {
62772
62772
  case 185 /* TypeQuery */:
62773
62773
  const entityName = node2.exprName;
62774
62774
  const firstIdentifier = getFirstIdentifier(entityName);
62775
- const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
62776
- const tpDeclaration = tp.symbol.declarations[0];
62777
- let tpScope;
62778
- if (tpDeclaration.kind === 167 /* TypeParameter */) {
62779
- tpScope = tpDeclaration.parent;
62780
- } else if (tp.isThisType) {
62781
- tpScope = tpDeclaration;
62782
- } else {
62783
- return true;
62784
- }
62785
- if (firstIdentifierSymbol.declarations) {
62786
- return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
62775
+ if (!isThisIdentifier(firstIdentifier)) {
62776
+ const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
62777
+ const tpDeclaration = tp.symbol.declarations[0];
62778
+ const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
62779
+ // Type parameter is a regular type parameter, e.g. foo<T>
62780
+ tp.isThisType ? tpDeclaration : (
62781
+ // Type parameter is the this type, and its declaration is the class declaration.
62782
+ void 0
62783
+ )
62784
+ );
62785
+ if (firstIdentifierSymbol.declarations && tpScope) {
62786
+ return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
62787
+ }
62787
62788
  }
62788
62789
  return true;
62789
62790
  case 173 /* MethodDeclaration */:
@@ -62837,6 +62838,9 @@ function createTypeChecker(host) {
62837
62838
  const elementFlags = tupleType.target.elementFlags;
62838
62839
  const elementTypes = map(getElementTypes(tupleType), (t, i) => {
62839
62840
  const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
62841
+ if (singleton === typeVariable) {
62842
+ return mappedType;
62843
+ }
62840
62844
  return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
62841
62845
  });
62842
62846
  const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
@@ -66625,7 +66629,7 @@ function createTypeChecker(host) {
66625
66629
  }
66626
66630
  function getRecursionIdentity(type) {
66627
66631
  if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
66628
- if (getObjectFlags(type) && 4 /* Reference */ && type.node) {
66632
+ if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
66629
66633
  return type.node;
66630
66634
  }
66631
66635
  if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
@@ -67400,6 +67404,8 @@ function createTypeChecker(host) {
67400
67404
  return context && context.mapper;
67401
67405
  }
67402
67406
  function couldContainTypeVariables(type) {
67407
+ if (type.flags & 67359327 /* Intrinsic */)
67408
+ return false;
67403
67409
  const objectFlags = getObjectFlags(type);
67404
67410
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
67405
67411
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
@@ -78893,7 +78899,7 @@ function createTypeChecker(host) {
78893
78899
  if (getIsolatedModules(compilerOptions)) {
78894
78900
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
78895
78901
  const constEnumDeclaration = type.symbol.valueDeclaration;
78896
- if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
78902
+ if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
78897
78903
  error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
78898
78904
  }
78899
78905
  }
@@ -79322,6 +79328,9 @@ function createTypeChecker(host) {
79322
79328
  case "length":
79323
79329
  case "caller":
79324
79330
  case "arguments":
79331
+ if (compilerOptions.useDefineForClassFields) {
79332
+ break;
79333
+ }
79325
79334
  case "prototype":
79326
79335
  const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
79327
79336
  const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));
@@ -86328,7 +86337,7 @@ function createTypeChecker(host) {
86328
86337
  if (requestedExternalEmitHelperNames.has(name))
86329
86338
  continue;
86330
86339
  requestedExternalEmitHelperNames.add(name);
86331
- const symbol = getSymbol2(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */);
86340
+ const symbol = getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */);
86332
86341
  if (!symbol) {
86333
86342
  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);
86334
86343
  } else if (helper & 524288 /* ClassPrivateFieldGet */) {
@@ -123677,7 +123686,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123677
123686
  let filesWithChangedSetOfUnresolvedImports;
123678
123687
  let filesWithInvalidatedResolutions;
123679
123688
  let filesWithInvalidatedNonRelativeUnresolvedImports;
123680
- const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
123689
+ const nonRelativeExternalModuleResolutions = createMultiMap();
123681
123690
  const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
123682
123691
  const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
123683
123692
  const resolvedFileToResolution = /* @__PURE__ */ new Map();
@@ -123811,7 +123820,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123811
123820
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
123812
123821
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
123813
123822
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
123814
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
123823
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
123824
+ nonRelativeExternalModuleResolutions.clear();
123815
123825
  }
123816
123826
  function cleanupLibResolutionWatching(newProgram) {
123817
123827
  resolvedLibraries.forEach((resolution, libFileName) => {
@@ -123829,7 +123839,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123829
123839
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
123830
123840
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
123831
123841
  allModuleAndTypeResolutionsAreInvalidated = false;
123832
- watchFailedLookupLocationOfNonRelativeModuleResolutions();
123842
+ nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
123843
+ nonRelativeExternalModuleResolutions.clear();
123833
123844
  if (newProgram !== oldProgram) {
123834
123845
  cleanupLibResolutionWatching(newProgram);
123835
123846
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
@@ -124110,7 +124121,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
124110
124121
  if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
124111
124122
  watchFailedLookupLocationOfResolution(resolution);
124112
124123
  } else {
124113
- nonRelativeExternalModuleResolutions.add(resolution);
124124
+ nonRelativeExternalModuleResolutions.add(name, resolution);
124114
124125
  }
124115
124126
  const resolved = getResolutionWithResolvedFileName(resolution);
124116
124127
  if (resolved && resolved.resolvedFileName) {
@@ -124240,9 +124251,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
124240
124251
  paths.add(affectingLocation);
124241
124252
  }
124242
124253
  }
124243
- function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
124244
- nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
124245
- nonRelativeExternalModuleResolutions.clear();
124254
+ function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
124255
+ const program = resolutionHost.getCurrentProgram();
124256
+ if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
124257
+ resolutions.forEach(watchFailedLookupLocationOfResolution);
124258
+ } else {
124259
+ resolutions.forEach((resolution) => watchAffectingLocationsOfResolution(
124260
+ resolution,
124261
+ /*addToResolutionsWithOnlyAffectingLocations*/
124262
+ true
124263
+ ));
124264
+ }
124246
124265
  }
124247
124266
  function setDirectoryWatcher(dir, dirPath, nonRecursive) {
124248
124267
  const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
@@ -136494,10 +136513,9 @@ registerRefactor(refactorNameForMoveToFile, {
136494
136513
  }
136495
136514
  });
136496
136515
  function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
136497
- var _a;
136498
136516
  const checker = program.getTypeChecker();
136499
136517
  const usage = getUsageInfo(oldFile, toMove.all, checker);
136500
- if (!host.fileExists(targetFile) || host.fileExists(targetFile) && ((_a = program.getSourceFile(targetFile)) == null ? void 0 : _a.statements.length) === 0) {
136518
+ if (!host.fileExists(targetFile)) {
136501
136519
  changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
136502
136520
  addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
136503
136521
  } else {
@@ -136535,6 +136553,13 @@ function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, chang
136535
136553
  if (typeof targetFile !== "string") {
136536
136554
  if (targetFile.statements.length > 0) {
136537
136555
  changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
136556
+ } else {
136557
+ changes.insertNodesAtEndOfFile(
136558
+ targetFile,
136559
+ body,
136560
+ /*blankLineBetween*/
136561
+ false
136562
+ );
136538
136563
  }
136539
136564
  if (imports.length > 0) {
136540
136565
  insertImports(
@@ -165999,6 +166024,17 @@ var ChangeTracker = class {
165999
166024
  this.insertNodeAt(sourceFile, pos, insert, options);
166000
166025
  }
166001
166026
  }
166027
+ insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
166028
+ this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
166029
+ }
166030
+ insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
166031
+ const pos = sourceFile.end + 1;
166032
+ const options = {
166033
+ prefix: this.newLineCharacter,
166034
+ suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
166035
+ };
166036
+ this.insertNodesAt(sourceFile, pos, insert, options);
166037
+ }
166002
166038
  insertStatementsInNewFile(fileName, statements, oldFile) {
166003
166039
  if (!this.newFileChanges) {
166004
166040
  this.newFileChanges = createMultiMap();
@@ -10196,7 +10196,7 @@ declare namespace ts {
10196
10196
  * arguments for any interactive action before offering it.
10197
10197
  */
10198
10198
  getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
10199
- getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, includeInteractiveActions?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
10199
+ getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, interactiveRefactorArguments?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
10200
10200
  getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
10201
10201
  newFileName: string;
10202
10202
  files: string[];