typescript 5.2.0-dev.20230803 → 5.2.0-dev.20230805

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/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-dev.20230803`;
21
+ var version = `${versionMajorMinor}.0-dev.20230805`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -25552,7 +25552,7 @@ function createAccessorPropertyBackingField(factory2, node, modifiers, initializ
25552
25552
  initializer
25553
25553
  );
25554
25554
  }
25555
- function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
25555
+ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
25556
25556
  return factory2.createGetAccessorDeclaration(
25557
25557
  modifiers,
25558
25558
  name,
@@ -25562,7 +25562,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
25562
25562
  factory2.createBlock([
25563
25563
  factory2.createReturnStatement(
25564
25564
  factory2.createPropertyAccessExpression(
25565
- factory2.createThis(),
25565
+ receiver,
25566
25566
  factory2.getGeneratedPrivateNameForNode(
25567
25567
  node.name,
25568
25568
  /*prefix*/
@@ -25574,7 +25574,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
25574
25574
  ])
25575
25575
  );
25576
25576
  }
25577
- function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
25577
+ function createAccessorPropertySetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
25578
25578
  return factory2.createSetAccessorDeclaration(
25579
25579
  modifiers,
25580
25580
  name,
@@ -25589,7 +25589,7 @@ function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
25589
25589
  factory2.createExpressionStatement(
25590
25590
  factory2.createAssignment(
25591
25591
  factory2.createPropertyAccessExpression(
25592
- factory2.createThis(),
25592
+ receiver,
25593
25593
  factory2.getGeneratedPrivateNameForNode(
25594
25594
  node.name,
25595
25595
  /*prefix*/
@@ -44357,7 +44357,7 @@ function createTypeChecker(host) {
44357
44357
  return symbol;
44358
44358
  }
44359
44359
  if (symbol.flags & 2097152 /* Alias */) {
44360
- const targetFlags = getAllSymbolFlags(symbol);
44360
+ const targetFlags = getSymbolFlags(symbol);
44361
44361
  if (targetFlags & meaning) {
44362
44362
  return symbol;
44363
44363
  }
@@ -45117,7 +45117,7 @@ function createTypeChecker(host) {
45117
45117
  /*isUse*/
45118
45118
  false
45119
45119
  ));
45120
- const allFlags = symbol && getAllSymbolFlags(symbol);
45120
+ const allFlags = symbol && getSymbolFlags(symbol);
45121
45121
  if (symbol && allFlags !== void 0 && !(allFlags & 111551 /* Value */)) {
45122
45122
  const rawName = unescapeLeadingUnderscores(name);
45123
45123
  if (isES2015OrLaterConstructorName(name)) {
@@ -45853,11 +45853,23 @@ function createTypeChecker(host) {
45853
45853
  }
45854
45854
  return void 0;
45855
45855
  }
45856
- function getAllSymbolFlags(symbol) {
45857
- let flags = symbol.flags;
45856
+ function getSymbolFlags(symbol, excludeTypeOnlyMeanings, excludeLocalMeanings) {
45857
+ const typeOnlyDeclaration = excludeTypeOnlyMeanings && getTypeOnlyAliasDeclaration(symbol);
45858
+ const typeOnlyDeclarationIsExportStar = typeOnlyDeclaration && isExportDeclaration(typeOnlyDeclaration);
45859
+ const typeOnlyResolution = typeOnlyDeclaration && (typeOnlyDeclarationIsExportStar ? resolveExternalModuleName(
45860
+ typeOnlyDeclaration.moduleSpecifier,
45861
+ typeOnlyDeclaration.moduleSpecifier,
45862
+ /*ignoreErrors*/
45863
+ true
45864
+ ) : resolveAlias(typeOnlyDeclaration.symbol));
45865
+ const typeOnlyExportStarTargets = typeOnlyDeclarationIsExportStar && typeOnlyResolution ? getExportsOfModule(typeOnlyResolution) : void 0;
45866
+ let flags = excludeLocalMeanings ? 0 /* None */ : symbol.flags;
45858
45867
  let seenSymbols;
45859
45868
  while (symbol.flags & 2097152 /* Alias */) {
45860
- const target = resolveAlias(symbol);
45869
+ const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol));
45870
+ if (!typeOnlyDeclarationIsExportStar && target === typeOnlyResolution || (typeOnlyExportStarTargets == null ? void 0 : typeOnlyExportStarTargets.get(target.escapedName)) === target) {
45871
+ break;
45872
+ }
45861
45873
  if (target === unknownSymbol) {
45862
45874
  return 67108863 /* All */;
45863
45875
  }
@@ -45915,7 +45927,7 @@ function createTypeChecker(host) {
45915
45927
  }
45916
45928
  if (links.typeOnlyDeclaration) {
45917
45929
  const resolved = links.typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol.escapedName)) : resolveAlias(links.typeOnlyDeclaration.symbol);
45918
- return getAllSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0;
45930
+ return getSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0;
45919
45931
  }
45920
45932
  return void 0;
45921
45933
  }
@@ -45926,7 +45938,11 @@ function createTypeChecker(host) {
45926
45938
  const symbol = getSymbolOfDeclaration(node);
45927
45939
  const target = resolveAlias(symbol);
45928
45940
  if (target) {
45929
- const markAlias = target === unknownSymbol || getAllSymbolFlags(target) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* Value */);
45941
+ const markAlias = target === unknownSymbol || getSymbolFlags(
45942
+ symbol,
45943
+ /*excludeTypeOnlyMeanings*/
45944
+ true
45945
+ ) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
45930
45946
  if (markAlias) {
45931
45947
  markAliasSymbolAsReferenced(symbol);
45932
45948
  }
@@ -45941,7 +45957,7 @@ function createTypeChecker(host) {
45941
45957
  if (!node)
45942
45958
  return Debug.fail();
45943
45959
  if (isInternalModuleImportEqualsDeclaration(node)) {
45944
- if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
45960
+ if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
45945
45961
  checkExpressionCached(node.moduleReference);
45946
45962
  }
45947
45963
  }
@@ -46792,7 +46808,7 @@ function createTypeChecker(host) {
46792
46808
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
46793
46809
  }
46794
46810
  function symbolIsValue(symbol, includeTypeOnlyMembers) {
46795
- return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getAllSymbolFlags(symbol) & 111551 /* Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
46811
+ return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
46796
46812
  }
46797
46813
  function findConstructorDeclaration(node) {
46798
46814
  const members = node.members;
@@ -47059,7 +47075,7 @@ function createTypeChecker(host) {
47059
47075
  }
47060
47076
  const shouldResolveAlias = symbolFromSymbolTable.flags & 2097152 /* Alias */ && !getDeclarationOfKind(symbolFromSymbolTable, 281 /* ExportSpecifier */);
47061
47077
  symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
47062
- const flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
47078
+ const flags = shouldResolveAlias ? getSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags;
47063
47079
  if (flags & meaning) {
47064
47080
  qualify = true;
47065
47081
  return true;
@@ -49921,7 +49937,7 @@ function createTypeChecker(host) {
49921
49937
  return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
49922
49938
  }
49923
49939
  function isTypeOnlyNamespace(symbol) {
49924
- return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
49940
+ return every(getNamespaceMembersForSerialization(symbol), (m) => !(getSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
49925
49941
  }
49926
49942
  function serializeModule(symbol, symbolName2, modifierFlags) {
49927
49943
  const members = getNamespaceMembersForSerialization(symbol);
@@ -52193,7 +52209,7 @@ function createTypeChecker(host) {
52193
52209
  true
52194
52210
  );
52195
52211
  const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0);
52196
- links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getAllSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType;
52212
+ links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType;
52197
52213
  }
52198
52214
  return links.type;
52199
52215
  }
@@ -59803,6 +59819,7 @@ function createTypeChecker(host) {
59803
59819
  let errorInfo;
59804
59820
  let relatedInfo;
59805
59821
  let maybeKeys;
59822
+ let maybeKeysSet;
59806
59823
  let sourceStack;
59807
59824
  let targetStack;
59808
59825
  let maybeCount = 0;
@@ -60672,9 +60689,13 @@ function createTypeChecker(host) {
60672
60689
  }
60673
60690
  if (!maybeKeys) {
60674
60691
  maybeKeys = [];
60692
+ maybeKeysSet = /* @__PURE__ */ new Set();
60675
60693
  sourceStack = [];
60676
60694
  targetStack = [];
60677
60695
  } else {
60696
+ if (maybeKeysSet.has(id)) {
60697
+ return 3 /* Maybe */;
60698
+ }
60678
60699
  const broadestEquivalentId = id.startsWith("*") ? getRelationKey(
60679
60700
  source2,
60680
60701
  target2,
@@ -60683,10 +60704,8 @@ function createTypeChecker(host) {
60683
60704
  /*ignoreConstraints*/
60684
60705
  true
60685
60706
  ) : void 0;
60686
- for (let i = 0; i < maybeCount; i++) {
60687
- if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
60688
- return 3 /* Maybe */;
60689
- }
60707
+ if (broadestEquivalentId && maybeKeysSet.has(broadestEquivalentId)) {
60708
+ return 3 /* Maybe */;
60690
60709
  }
60691
60710
  if (sourceDepth === 100 || targetDepth === 100) {
60692
60711
  overflow = true;
@@ -60695,6 +60714,7 @@ function createTypeChecker(host) {
60695
60714
  }
60696
60715
  const maybeStart = maybeCount;
60697
60716
  maybeKeys[maybeCount] = id;
60717
+ maybeKeysSet.add(id);
60698
60718
  maybeCount++;
60699
60719
  const saveExpandingFlags = expandingFlags;
60700
60720
  if (recursionFlags & 1 /* Source */) {
@@ -60747,17 +60767,34 @@ function createTypeChecker(host) {
60747
60767
  if (result2) {
60748
60768
  if (result2 === -1 /* True */ || sourceDepth === 0 && targetDepth === 0) {
60749
60769
  if (result2 === -1 /* True */ || result2 === 3 /* Maybe */) {
60750
- for (let i = maybeStart; i < maybeCount; i++) {
60751
- relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags);
60752
- }
60770
+ resetMaybeStack(
60771
+ /*markAllAsSucceeded*/
60772
+ true
60773
+ );
60774
+ } else {
60775
+ resetMaybeStack(
60776
+ /*markAllAsSucceeded*/
60777
+ false
60778
+ );
60753
60779
  }
60754
- maybeCount = maybeStart;
60755
60780
  }
60756
60781
  } else {
60757
60782
  relation.set(id, (reportErrors2 ? 4 /* Reported */ : 0) | 2 /* Failed */ | propagatingVarianceFlags);
60758
- maybeCount = maybeStart;
60783
+ resetMaybeStack(
60784
+ /*markAllAsSucceeded*/
60785
+ false
60786
+ );
60759
60787
  }
60760
60788
  return result2;
60789
+ function resetMaybeStack(markAllAsSucceeded) {
60790
+ for (let i = maybeStart; i < maybeCount; i++) {
60791
+ maybeKeysSet.delete(maybeKeys[i]);
60792
+ if (markAllAsSucceeded) {
60793
+ relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags);
60794
+ }
60795
+ }
60796
+ maybeCount = maybeStart;
60797
+ }
60761
60798
  }
60762
60799
  function structuredTypeRelatedTo(source2, target2, reportErrors2, intersectionState) {
60763
60800
  const saveErrorInfo = captureErrorCalculationState();
@@ -66110,8 +66147,8 @@ function createTypeChecker(host) {
66110
66147
  }
66111
66148
  const parent = getRootDeclaration(symbol.valueDeclaration).parent;
66112
66149
  const links = getNodeLinks(parent);
66113
- if (!(links.flags & 524288 /* AssignmentsMarked */)) {
66114
- links.flags |= 524288 /* AssignmentsMarked */;
66150
+ if (!(links.flags & 131072 /* AssignmentsMarked */)) {
66151
+ links.flags |= 131072 /* AssignmentsMarked */;
66115
66152
  if (!hasParentWithAssignmentsMarked(parent)) {
66116
66153
  markNodeAssignments(parent);
66117
66154
  }
@@ -66119,7 +66156,7 @@ function createTypeChecker(host) {
66119
66156
  return symbol.isAssigned || false;
66120
66157
  }
66121
66158
  function hasParentWithAssignmentsMarked(node) {
66122
- return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 524288 /* AssignmentsMarked */));
66159
+ return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
66123
66160
  }
66124
66161
  function markNodeAssignments(node) {
66125
66162
  if (node.kind === 80 /* Identifier */) {
@@ -66201,9 +66238,13 @@ function createTypeChecker(host) {
66201
66238
  symbol,
66202
66239
  /*excludes*/
66203
66240
  111551 /* Value */
66204
- ) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* Value */)) {
66241
+ ) && !isInTypeQuery(location)) {
66205
66242
  const target = resolveAlias(symbol);
66206
- if (getAllSymbolFlags(target) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
66243
+ if (getSymbolFlags(
66244
+ symbol,
66245
+ /*excludeTypeOnlyMeanings*/
66246
+ true
66247
+ ) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
66207
66248
  if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
66208
66249
  markAliasSymbolAsReferenced(symbol);
66209
66250
  } else {
@@ -66221,11 +66262,11 @@ function createTypeChecker(host) {
66221
66262
  const parent = declaration.parent.parent;
66222
66263
  if (parent.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || parent.kind === 169 /* Parameter */) {
66223
66264
  const links = getNodeLinks(parent);
66224
- if (!(links.flags & 16777216 /* InCheckIdentifier */)) {
66225
- links.flags |= 16777216 /* InCheckIdentifier */;
66265
+ if (!(links.flags & 4194304 /* InCheckIdentifier */)) {
66266
+ links.flags |= 4194304 /* InCheckIdentifier */;
66226
66267
  const parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
66227
66268
  const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
66228
- links.flags &= ~16777216 /* InCheckIdentifier */;
66269
+ links.flags &= ~4194304 /* InCheckIdentifier */;
66229
66270
  if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
66230
66271
  const pattern = declaration.parent;
66231
66272
  const narrowedType = getFlowTypeOfReference(
@@ -66302,17 +66343,7 @@ function createTypeChecker(host) {
66302
66343
  }
66303
66344
  let declaration = localOrExportSymbol.valueDeclaration;
66304
66345
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
66305
- if (declaration.kind === 263 /* ClassDeclaration */ && nodeIsDecorated(legacyDecorators, declaration)) {
66306
- let container = getContainingClass(node);
66307
- while (container !== void 0) {
66308
- if (container === declaration && container.name !== node) {
66309
- getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
66310
- getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
66311
- break;
66312
- }
66313
- container = getContainingClass(container);
66314
- }
66315
- } else if (declaration.kind === 231 /* ClassExpression */) {
66346
+ if (isClassLike(declaration) && declaration.name !== node) {
66316
66347
  let container = getThisContainer(
66317
66348
  node,
66318
66349
  /*includeArrowFunctions*/
@@ -66320,14 +66351,7 @@ function createTypeChecker(host) {
66320
66351
  /*includeClassComputedPropertyName*/
66321
66352
  false
66322
66353
  );
66323
- while (container.kind !== 312 /* SourceFile */) {
66324
- if (container.parent === declaration) {
66325
- if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) {
66326
- getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
66327
- getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
66328
- }
66329
- break;
66330
- }
66354
+ while (container.kind !== 312 /* SourceFile */ && container.parent !== declaration) {
66331
66355
  container = getThisContainer(
66332
66356
  container,
66333
66357
  /*includeArrowFunctions*/
@@ -66336,6 +66360,11 @@ function createTypeChecker(host) {
66336
66360
  false
66337
66361
  );
66338
66362
  }
66363
+ if (container.kind !== 312 /* SourceFile */) {
66364
+ getNodeLinks(declaration).flags |= 262144 /* ContainsConstructorReference */;
66365
+ getNodeLinks(container).flags |= 262144 /* ContainsConstructorReference */;
66366
+ getNodeLinks(node).flags |= 536870912 /* ConstructorReference */;
66367
+ }
66339
66368
  }
66340
66369
  }
66341
66370
  checkNestedBlockScopedBinding(node, symbol);
@@ -66466,7 +66495,7 @@ function createTypeChecker(host) {
66466
66495
  if (isForStatement(container)) {
66467
66496
  const varDeclList = getAncestor(symbol.valueDeclaration, 261 /* VariableDeclarationList */);
66468
66497
  if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) {
66469
- getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* NeedsLoopOutParameter */;
66498
+ getNodeLinks(symbol.valueDeclaration).flags |= 65536 /* NeedsLoopOutParameter */;
66470
66499
  }
66471
66500
  }
66472
66501
  getNodeLinks(symbol.valueDeclaration).flags |= 32768 /* BlockScopedBindingInLoop */;
@@ -66744,7 +66773,7 @@ function createTypeChecker(host) {
66744
66773
  if (!isCallExpression2 && languageVersion >= 2 /* ES2015 */ && languageVersion <= 8 /* ES2021 */ && (isPropertyDeclaration(container) || isClassStaticBlockDeclaration(container))) {
66745
66774
  forEachEnclosingBlockScopeContainer(node.parent, (current) => {
66746
66775
  if (!isSourceFile(current) || isExternalOrCommonJsModule(current)) {
66747
- getNodeLinks(current).flags |= 8388608 /* ContainsSuperPropertyInStaticInitializer */;
66776
+ getNodeLinks(current).flags |= 2097152 /* ContainsSuperPropertyInStaticInitializer */;
66748
66777
  }
66749
66778
  });
66750
66779
  }
@@ -70286,7 +70315,7 @@ function createTypeChecker(host) {
70286
70315
  }
70287
70316
  }
70288
70317
  function getThisArgumentOfCall(node) {
70289
- const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : void 0;
70318
+ const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
70290
70319
  if (expression) {
70291
70320
  const callee = skipOuterExpressions(expression);
70292
70321
  if (isAccessExpression(callee)) {
@@ -75193,7 +75222,7 @@ function createTypeChecker(host) {
75193
75222
  function setNodeLinksForPrivateIdentifierScope(node) {
75194
75223
  if (isPrivateIdentifier(node.name) && languageVersion < 99 /* ESNext */) {
75195
75224
  for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
75196
- getNodeLinks(lexicalScope).flags |= 4194304 /* ContainsClassWithPrivateIdentifiers */;
75225
+ getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
75197
75226
  }
75198
75227
  if (isClassExpression(node.parent)) {
75199
75228
  const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
@@ -76946,7 +76975,7 @@ function createTypeChecker(host) {
76946
76975
  }
76947
76976
  function checkWeakMapSetCollision(node) {
76948
76977
  const enclosingBlockScope = getEnclosingBlockScopeContainer(node);
76949
- if (getNodeCheckFlags(enclosingBlockScope) & 4194304 /* ContainsClassWithPrivateIdentifiers */) {
76978
+ if (getNodeCheckFlags(enclosingBlockScope) & 1048576 /* ContainsClassWithPrivateIdentifiers */) {
76950
76979
  Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier");
76951
76980
  errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText);
76952
76981
  }
@@ -76960,18 +76989,18 @@ function createTypeChecker(host) {
76960
76989
  let hasCollision = false;
76961
76990
  if (isClassExpression(node)) {
76962
76991
  for (const member of node.members) {
76963
- if (getNodeCheckFlags(member) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
76992
+ if (getNodeCheckFlags(member) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
76964
76993
  hasCollision = true;
76965
76994
  break;
76966
76995
  }
76967
76996
  }
76968
76997
  } else if (isFunctionExpression(node)) {
76969
- if (getNodeCheckFlags(node) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
76998
+ if (getNodeCheckFlags(node) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
76970
76999
  hasCollision = true;
76971
77000
  }
76972
77001
  } else {
76973
77002
  const container = getEnclosingBlockScopeContainer(node);
76974
- if (container && getNodeCheckFlags(container) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
77003
+ if (container && getNodeCheckFlags(container) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
76975
77004
  hasCollision = true;
76976
77005
  }
76977
77006
  }
@@ -77006,9 +77035,6 @@ function createTypeChecker(host) {
77006
77035
  if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) {
77007
77036
  return;
77008
77037
  }
77009
- if (node.kind === 260 /* VariableDeclaration */ && !node.initializer) {
77010
- return;
77011
- }
77012
77038
  const symbol = getSymbolOfDeclaration(node);
77013
77039
  if (symbol.flags & 1 /* FunctionScopedVariable */) {
77014
77040
  if (!isIdentifier(node.name))
@@ -79630,7 +79656,7 @@ function createTypeChecker(host) {
79630
79656
  }
79631
79657
  return;
79632
79658
  }
79633
- const targetFlags = getAllSymbolFlags(target);
79659
+ const targetFlags = getSymbolFlags(target);
79634
79660
  const excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) | (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
79635
79661
  if (targetFlags & excludedMeanings) {
79636
79662
  const message = node.kind === 281 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
@@ -79788,7 +79814,7 @@ function createTypeChecker(host) {
79788
79814
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
79789
79815
  const target = resolveAlias(getSymbolOfDeclaration(node));
79790
79816
  if (target !== unknownSymbol) {
79791
- const targetFlags = getAllSymbolFlags(target);
79817
+ const targetFlags = getSymbolFlags(target);
79792
79818
  if (targetFlags & 111551 /* Value */) {
79793
79819
  const moduleName = getFirstIdentifier(node.moduleReference);
79794
79820
  if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) {
@@ -79928,7 +79954,7 @@ function createTypeChecker(host) {
79928
79954
  markExportAsReferenced(node);
79929
79955
  }
79930
79956
  const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
79931
- if (!target || getAllSymbolFlags(target) & 111551 /* Value */) {
79957
+ if (!target || getSymbolFlags(target) & 111551 /* Value */) {
79932
79958
  checkExpressionCached(node.propertyName || node.name);
79933
79959
  }
79934
79960
  }
@@ -79973,7 +79999,7 @@ function createTypeChecker(host) {
79973
79999
  ));
79974
80000
  if (sym) {
79975
80001
  markAliasReferenced(sym, id);
79976
- if (getAllSymbolFlags(sym) & 111551 /* Value */) {
80002
+ if (getSymbolFlags(sym) & 111551 /* Value */) {
79977
80003
  checkExpressionCached(id);
79978
80004
  if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
79979
80005
  error(
@@ -81220,7 +81246,7 @@ function createTypeChecker(host) {
81220
81246
  return symbolLinks2.exportsSomeValue;
81221
81247
  function isValue(s) {
81222
81248
  s = resolveSymbol(s);
81223
- return s && !!(getAllSymbolFlags(s) & 111551 /* Value */);
81249
+ return s && !!(getSymbolFlags(s) & 111551 /* Value */);
81224
81250
  }
81225
81251
  }
81226
81252
  function isNameOfModuleOrEnumDeclaration(node) {
@@ -81350,7 +81376,11 @@ function createTypeChecker(host) {
81350
81376
  case 276 /* ImportSpecifier */:
81351
81377
  case 281 /* ExportSpecifier */:
81352
81378
  const symbol = getSymbolOfDeclaration(node);
81353
- return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* Value */);
81379
+ return !!symbol && isAliasResolvedToValue(
81380
+ symbol,
81381
+ /*excludeTypeOnlyValues*/
81382
+ true
81383
+ );
81354
81384
  case 278 /* ExportDeclaration */:
81355
81385
  const exportClause = node.exportClause;
81356
81386
  return !!exportClause && (isNamespaceExport(exportClause) || some(exportClause.elements, isValueAliasDeclaration));
@@ -81367,7 +81397,7 @@ function createTypeChecker(host) {
81367
81397
  const isValue = isAliasResolvedToValue(getSymbolOfDeclaration(node));
81368
81398
  return isValue && node.moduleReference && !nodeIsMissing(node.moduleReference);
81369
81399
  }
81370
- function isAliasResolvedToValue(symbol) {
81400
+ function isAliasResolvedToValue(symbol, excludeTypeOnlyValues) {
81371
81401
  if (!symbol) {
81372
81402
  return false;
81373
81403
  }
@@ -81375,7 +81405,12 @@ function createTypeChecker(host) {
81375
81405
  if (target === unknownSymbol) {
81376
81406
  return true;
81377
81407
  }
81378
- return !!((getAllSymbolFlags(target) ?? -1) & 111551 /* Value */) && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
81408
+ return !!(getSymbolFlags(
81409
+ symbol,
81410
+ excludeTypeOnlyValues,
81411
+ /*excludeLocalMeanings*/
81412
+ true
81413
+ ) & 111551 /* Value */) && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target));
81379
81414
  }
81380
81415
  function isConstEnumOrConstEnumOnlyModule(s) {
81381
81416
  return isConstEnumSymbol(s) || !!s.constEnumOnlyModule;
@@ -81389,7 +81424,7 @@ function createTypeChecker(host) {
81389
81424
  return true;
81390
81425
  }
81391
81426
  const target = getSymbolLinks(symbol).aliasTarget;
81392
- if (target && getEffectiveModifierFlags(node) & 1 /* Export */ && getAllSymbolFlags(target) & 111551 /* Value */ && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
81427
+ if (target && getEffectiveModifierFlags(node) & 1 /* Export */ && getSymbolFlags(target) & 111551 /* Value */ && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
81393
81428
  return true;
81394
81429
  }
81395
81430
  }
@@ -89084,6 +89119,11 @@ function transformClassFields(context) {
89084
89119
  }
89085
89120
  }
89086
89121
  }
89122
+ function getClassThis() {
89123
+ const lex = getClassLexicalEnvironment();
89124
+ const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
89125
+ return Debug.checkDefined(classThis);
89126
+ }
89087
89127
  function transformAutoAccessor(node) {
89088
89128
  const commentRange = getCommentRange(node);
89089
89129
  const sourceMapRange = getSourceMapRange(node);
@@ -89110,11 +89150,13 @@ function transformClassFields(context) {
89110
89150
  setOriginalNode(backingField, node);
89111
89151
  setEmitFlags(backingField, 3072 /* NoComments */);
89112
89152
  setSourceMapRange(backingField, sourceMapRange);
89113
- const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName);
89153
+ const receiver = isStatic(node) ? getClassThis() : factory2.createThis();
89154
+ const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
89114
89155
  setOriginalNode(getter, node);
89115
89156
  setCommentRange(getter, commentRange);
89116
89157
  setSourceMapRange(getter, sourceMapRange);
89117
- const setter = createAccessorPropertySetRedirector(factory2, node, modifiers, setterName);
89158
+ const setterModifiers = factory2.createModifiersFromModifierFlags(modifiersToFlags(modifiers));
89159
+ const setter = createAccessorPropertySetRedirector(factory2, node, setterModifiers, setterName, receiver);
89118
89160
  setOriginalNode(setter, node);
89119
89161
  setEmitFlags(setter, 3072 /* NoComments */);
89120
89162
  setSourceMapRange(setter, sourceMapRange);
@@ -89671,6 +89713,7 @@ function transformClassFields(context) {
89671
89713
  return filter(node.members, isNonStaticMethodOrAccessorWithPrivateName);
89672
89714
  }
89673
89715
  function getClassFacts(node) {
89716
+ var _a;
89674
89717
  let facts = 0 /* None */;
89675
89718
  const original = getOriginalNode(node);
89676
89719
  if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
@@ -89687,6 +89730,8 @@ function transformClassFields(context) {
89687
89730
  if (isStatic(member)) {
89688
89731
  if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) {
89689
89732
  facts |= 2 /* NeedsClassConstructorReference */;
89733
+ } else if (isAutoAccessorPropertyDeclaration(member) && shouldTransformAutoAccessors === -1 /* True */ && !node.name && !((_a = node.emitNode) == null ? void 0 : _a.classThis)) {
89734
+ facts |= 2 /* NeedsClassConstructorReference */;
89690
89735
  }
89691
89736
  if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) {
89692
89737
  if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) {
@@ -89707,6 +89752,9 @@ function transformClassFields(context) {
89707
89752
  containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
89708
89753
  } else if (isPrivateIdentifierClassElementDeclaration(member)) {
89709
89754
  containsInstancePrivateElements = true;
89755
+ if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) {
89756
+ facts |= 2 /* NeedsClassConstructorReference */;
89757
+ }
89710
89758
  } else if (isPropertyDeclaration(member)) {
89711
89759
  containsPublicInstanceFields = true;
89712
89760
  containsInitializedPublicInstanceFields || (containsInitializedPublicInstanceFields = !!member.initializer);
@@ -89807,10 +89855,11 @@ function transformClassFields(context) {
89807
89855
  getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp);
89808
89856
  pendingClassReferenceAssignment = factory2.createAssignment(temp, factory2.getInternalName(node));
89809
89857
  }
89810
- if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
89811
- getClassLexicalEnvironment().classThis = node.emitNode.classThis;
89812
- }
89813
89858
  }
89859
+ if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
89860
+ getClassLexicalEnvironment().classThis = node.emitNode.classThis;
89861
+ }
89862
+ const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
89814
89863
  const isExport = hasSyntacticModifier(node, 1 /* Export */);
89815
89864
  const isDefault = hasSyntacticModifier(node, 1024 /* Default */);
89816
89865
  let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
@@ -89845,6 +89894,11 @@ function transformClassFields(context) {
89845
89894
  )
89846
89895
  ));
89847
89896
  }
89897
+ const alias = getClassLexicalEnvironment().classConstructor;
89898
+ if (isClassWithConstructorReference && alias) {
89899
+ enableSubstitutionForClassAliases();
89900
+ classAliases[getOriginalNodeId(node)] = alias;
89901
+ }
89848
89902
  const classDecl = factory2.updateClassDeclaration(
89849
89903
  node,
89850
89904
  modifiers,
@@ -89867,14 +89921,14 @@ function transformClassFields(context) {
89867
89921
  var _a, _b, _c;
89868
89922
  const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
89869
89923
  const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
89870
- const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */;
89924
+ const classCheckFlags = resolver.getNodeCheckFlags(node);
89925
+ const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */;
89871
89926
  let temp;
89872
89927
  function createClassTempVar() {
89873
89928
  var _a2;
89874
89929
  if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
89875
89930
  return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
89876
89931
  }
89877
- const classCheckFlags = resolver.getNodeCheckFlags(node);
89878
89932
  const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
89879
89933
  const temp2 = factory2.createTempVariable(
89880
89934
  requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
@@ -90841,7 +90895,7 @@ function transformClassFields(context) {
90841
90895
  }
90842
90896
  function trySubstituteClassAlias(node) {
90843
90897
  if (enabledSubstitutions & 1 /* ClassAliases */) {
90844
- if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) {
90898
+ if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
90845
90899
  const declaration = resolver.getReferencedValueDeclaration(node);
90846
90900
  if (declaration) {
90847
90901
  const classAlias = classAliases[declaration.id];
@@ -91695,7 +91749,7 @@ function transformLegacyDecorators(context) {
91695
91749
  }
91696
91750
  }
91697
91751
  function getClassAliasIfNeeded(node) {
91698
- if (resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */) {
91752
+ if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) {
91699
91753
  enableSubstitutionForClassAliases();
91700
91754
  const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
91701
91755
  classAliases[getOriginalNodeId(node)] = classAlias;
@@ -91728,7 +91782,7 @@ function transformLegacyDecorators(context) {
91728
91782
  }
91729
91783
  function trySubstituteClassAlias(node) {
91730
91784
  if (classAliases) {
91731
- if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) {
91785
+ if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
91732
91786
  const declaration = resolver.getReferencedValueDeclaration(node);
91733
91787
  if (declaration) {
91734
91788
  const classAlias = classAliases[declaration.id];
@@ -91754,6 +91808,7 @@ function transformESDecorators(context) {
91754
91808
  endLexicalEnvironment,
91755
91809
  hoistVariableDeclaration
91756
91810
  } = context;
91811
+ const languageVersion = getEmitScriptTarget(context.getCompilerOptions());
91757
91812
  let top;
91758
91813
  let classInfo;
91759
91814
  let classThis;
@@ -93255,6 +93310,17 @@ function transformESDecorators(context) {
93255
93310
  function transformDecorator(decorator) {
93256
93311
  const expression = visitNode(decorator.expression, visitor, isExpression);
93257
93312
  setEmitFlags(expression, 3072 /* NoComments */);
93313
+ const innerExpression = skipOuterExpressions(expression);
93314
+ if (isAccessExpression(innerExpression)) {
93315
+ const { target, thisArg } = factory2.createCallBinding(
93316
+ expression,
93317
+ hoistVariableDeclaration,
93318
+ languageVersion,
93319
+ /*cacheIdentifiers*/
93320
+ true
93321
+ );
93322
+ return factory2.restoreOuterExpressions(expression, factory2.createFunctionBindCall(target, thisArg, []));
93323
+ }
93258
93324
  return expression;
93259
93325
  }
93260
93326
  function createDescriptorMethod(original, name, modifiers, asteriskToken, kind, parameters, body) {
@@ -99898,10 +99964,10 @@ function transformES2015(context) {
99898
99964
  name
99899
99965
  ));
99900
99966
  const checkFlags = resolver.getNodeCheckFlags(decl);
99901
- if (checkFlags & 262144 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
99967
+ if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
99902
99968
  const outParamName = factory2.createUniqueName("out_" + idText(name));
99903
99969
  let flags = 0 /* None */;
99904
- if (checkFlags & 262144 /* NeedsLoopOutParameter */) {
99970
+ if (checkFlags & 65536 /* NeedsLoopOutParameter */) {
99905
99971
  flags |= 1 /* Body */;
99906
99972
  }
99907
99973
  if (isForStatement(container)) {