@typescript-deploys/pr-build 5.2.0-pr-55267-8 → 5.3.0-pr-55319-8

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/tsserver.js CHANGED
@@ -2330,8 +2330,8 @@ __export(server_exports, {
2330
2330
  module.exports = __toCommonJS(server_exports);
2331
2331
 
2332
2332
  // src/compiler/corePublic.ts
2333
- var versionMajorMinor = "5.2";
2334
- var version = `${versionMajorMinor}.0-insiders.20230804`;
2333
+ var versionMajorMinor = "5.3";
2334
+ var version = `${versionMajorMinor}.0-insiders.20230809`;
2335
2335
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2336
2336
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2337
2337
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6625,15 +6625,13 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
6625
6625
  NodeCheckFlags2[NodeCheckFlags2["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding";
6626
6626
  NodeCheckFlags2[NodeCheckFlags2["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding";
6627
6627
  NodeCheckFlags2[NodeCheckFlags2["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop";
6628
- NodeCheckFlags2[NodeCheckFlags2["ClassWithBodyScopedClassBinding"] = 65536] = "ClassWithBodyScopedClassBinding";
6629
- NodeCheckFlags2[NodeCheckFlags2["BodyScopedClassBinding"] = 131072] = "BodyScopedClassBinding";
6630
- NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 262144] = "NeedsLoopOutParameter";
6631
- NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 524288] = "AssignmentsMarked";
6632
- NodeCheckFlags2[NodeCheckFlags2["ClassWithConstructorReference"] = 1048576] = "ClassWithConstructorReference";
6633
- NodeCheckFlags2[NodeCheckFlags2["ConstructorReferenceInClass"] = 2097152] = "ConstructorReferenceInClass";
6634
- NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 4194304] = "ContainsClassWithPrivateIdentifiers";
6635
- NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 8388608] = "ContainsSuperPropertyInStaticInitializer";
6636
- NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 16777216] = "InCheckIdentifier";
6628
+ NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter";
6629
+ NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 131072] = "AssignmentsMarked";
6630
+ NodeCheckFlags2[NodeCheckFlags2["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference";
6631
+ NodeCheckFlags2[NodeCheckFlags2["ConstructorReference"] = 536870912] = "ConstructorReference";
6632
+ NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
6633
+ NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
6634
+ NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
6637
6635
  return NodeCheckFlags2;
6638
6636
  })(NodeCheckFlags || {});
6639
6637
  var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
@@ -22935,8 +22933,10 @@ function createNodeFactory(flags, baseFactory2) {
22935
22933
  return update(updated, original);
22936
22934
  }
22937
22935
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
22936
+ const text = typeof value === "number" ? value + "" : value;
22937
+ Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
22938
22938
  const node = createBaseDeclaration(9 /* NumericLiteral */);
22939
- node.text = typeof value === "number" ? value + "" : value;
22939
+ node.text = text;
22940
22940
  node.numericLiteralFlags = numericLiteralFlags;
22941
22941
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
22942
22942
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -29939,7 +29939,7 @@ function createAccessorPropertyBackingField(factory2, node, modifiers, initializ
29939
29939
  initializer
29940
29940
  );
29941
29941
  }
29942
- function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
29942
+ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
29943
29943
  return factory2.createGetAccessorDeclaration(
29944
29944
  modifiers,
29945
29945
  name,
@@ -29949,7 +29949,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
29949
29949
  factory2.createBlock([
29950
29950
  factory2.createReturnStatement(
29951
29951
  factory2.createPropertyAccessExpression(
29952
- factory2.createThis(),
29952
+ receiver,
29953
29953
  factory2.getGeneratedPrivateNameForNode(
29954
29954
  node.name,
29955
29955
  /*prefix*/
@@ -29961,7 +29961,7 @@ function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) {
29961
29961
  ])
29962
29962
  );
29963
29963
  }
29964
- function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
29964
+ function createAccessorPropertySetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) {
29965
29965
  return factory2.createSetAccessorDeclaration(
29966
29966
  modifiers,
29967
29967
  name,
@@ -29976,7 +29976,7 @@ function createAccessorPropertySetRedirector(factory2, node, modifiers, name) {
29976
29976
  factory2.createExpressionStatement(
29977
29977
  factory2.createAssignment(
29978
29978
  factory2.createPropertyAccessExpression(
29979
- factory2.createThis(),
29979
+ receiver,
29980
29980
  factory2.getGeneratedPrivateNameForNode(
29981
29981
  node.name,
29982
29982
  /*prefix*/
@@ -53872,7 +53872,7 @@ function createTypeChecker(host) {
53872
53872
  return factory.createStringLiteral(name, !!singleQuote);
53873
53873
  }
53874
53874
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
53875
- return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
53875
+ return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
53876
53876
  }
53877
53877
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions));
53878
53878
  }
@@ -64539,6 +64539,7 @@ function createTypeChecker(host) {
64539
64539
  let expandingFlags = 0 /* None */;
64540
64540
  let overflow = false;
64541
64541
  let overrideNextErrorInfo = 0;
64542
+ let skipParentCounter = 0;
64542
64543
  let lastSkippedInfo;
64543
64544
  let incompatibleStack;
64544
64545
  Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
@@ -64604,6 +64605,7 @@ function createTypeChecker(host) {
64604
64605
  lastSkippedInfo = saved.lastSkippedInfo;
64605
64606
  incompatibleStack = saved.incompatibleStack;
64606
64607
  overrideNextErrorInfo = saved.overrideNextErrorInfo;
64608
+ skipParentCounter = saved.skipParentCounter;
64607
64609
  relatedInfo = saved.relatedInfo;
64608
64610
  }
64609
64611
  function captureErrorCalculationState() {
@@ -64612,6 +64614,7 @@ function createTypeChecker(host) {
64612
64614
  lastSkippedInfo,
64613
64615
  incompatibleStack: incompatibleStack == null ? void 0 : incompatibleStack.slice(),
64614
64616
  overrideNextErrorInfo,
64617
+ skipParentCounter,
64615
64618
  relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice()
64616
64619
  };
64617
64620
  }
@@ -64716,7 +64719,15 @@ function createTypeChecker(host) {
64716
64719
  reportIncompatibleStack();
64717
64720
  if (message.elidedInCompatabilityPyramid)
64718
64721
  return;
64719
- errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
64722
+ if (skipParentCounter === 0) {
64723
+ errorInfo = chainDiagnosticMessages(errorInfo, message, ...args);
64724
+ } else {
64725
+ skipParentCounter--;
64726
+ }
64727
+ }
64728
+ function reportParentSkippedError(message, ...args) {
64729
+ reportError(message, ...args);
64730
+ skipParentCounter++;
64720
64731
  }
64721
64732
  function associateRelatedInfo(info) {
64722
64733
  Debug.assert(!!errorInfo);
@@ -65053,14 +65064,14 @@ function createTypeChecker(host) {
65053
65064
  }
65054
65065
  }
65055
65066
  if (suggestion !== void 0) {
65056
- reportError(
65067
+ reportParentSkippedError(
65057
65068
  Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2,
65058
65069
  symbolToString(prop),
65059
65070
  typeToString(errorTarget),
65060
65071
  suggestion
65061
65072
  );
65062
65073
  } else {
65063
- reportError(
65074
+ reportParentSkippedError(
65064
65075
  Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
65065
65076
  symbolToString(prop),
65066
65077
  typeToString(errorTarget)
@@ -70858,8 +70869,8 @@ function createTypeChecker(host) {
70858
70869
  }
70859
70870
  const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
70860
70871
  const links = getNodeLinks(parent2);
70861
- if (!(links.flags & 524288 /* AssignmentsMarked */)) {
70862
- links.flags |= 524288 /* AssignmentsMarked */;
70872
+ if (!(links.flags & 131072 /* AssignmentsMarked */)) {
70873
+ links.flags |= 131072 /* AssignmentsMarked */;
70863
70874
  if (!hasParentWithAssignmentsMarked(parent2)) {
70864
70875
  markNodeAssignments(parent2);
70865
70876
  }
@@ -70867,7 +70878,7 @@ function createTypeChecker(host) {
70867
70878
  return symbol.isAssigned || false;
70868
70879
  }
70869
70880
  function hasParentWithAssignmentsMarked(node) {
70870
- return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 524288 /* AssignmentsMarked */));
70881
+ return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
70871
70882
  }
70872
70883
  function markNodeAssignments(node) {
70873
70884
  if (node.kind === 80 /* Identifier */) {
@@ -70973,11 +70984,11 @@ function createTypeChecker(host) {
70973
70984
  const parent2 = declaration.parent.parent;
70974
70985
  if (parent2.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || parent2.kind === 169 /* Parameter */) {
70975
70986
  const links = getNodeLinks(parent2);
70976
- if (!(links.flags & 16777216 /* InCheckIdentifier */)) {
70977
- links.flags |= 16777216 /* InCheckIdentifier */;
70987
+ if (!(links.flags & 4194304 /* InCheckIdentifier */)) {
70988
+ links.flags |= 4194304 /* InCheckIdentifier */;
70978
70989
  const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
70979
70990
  const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
70980
- links.flags &= ~16777216 /* InCheckIdentifier */;
70991
+ links.flags &= ~4194304 /* InCheckIdentifier */;
70981
70992
  if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
70982
70993
  const pattern = declaration.parent;
70983
70994
  const narrowedType = getFlowTypeOfReference(
@@ -71054,17 +71065,7 @@ function createTypeChecker(host) {
71054
71065
  }
71055
71066
  let declaration = localOrExportSymbol.valueDeclaration;
71056
71067
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
71057
- if (declaration.kind === 263 /* ClassDeclaration */ && nodeIsDecorated(legacyDecorators, declaration)) {
71058
- let container = getContainingClass(node);
71059
- while (container !== void 0) {
71060
- if (container === declaration && container.name !== node) {
71061
- getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
71062
- getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
71063
- break;
71064
- }
71065
- container = getContainingClass(container);
71066
- }
71067
- } else if (declaration.kind === 231 /* ClassExpression */) {
71068
+ if (isClassLike(declaration) && declaration.name !== node) {
71068
71069
  let container = getThisContainer(
71069
71070
  node,
71070
71071
  /*includeArrowFunctions*/
@@ -71072,14 +71073,7 @@ function createTypeChecker(host) {
71072
71073
  /*includeClassComputedPropertyName*/
71073
71074
  false
71074
71075
  );
71075
- while (container.kind !== 312 /* SourceFile */) {
71076
- if (container.parent === declaration) {
71077
- if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) {
71078
- getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
71079
- getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
71080
- }
71081
- break;
71082
- }
71076
+ while (container.kind !== 312 /* SourceFile */ && container.parent !== declaration) {
71083
71077
  container = getThisContainer(
71084
71078
  container,
71085
71079
  /*includeArrowFunctions*/
@@ -71088,6 +71082,11 @@ function createTypeChecker(host) {
71088
71082
  false
71089
71083
  );
71090
71084
  }
71085
+ if (container.kind !== 312 /* SourceFile */) {
71086
+ getNodeLinks(declaration).flags |= 262144 /* ContainsConstructorReference */;
71087
+ getNodeLinks(container).flags |= 262144 /* ContainsConstructorReference */;
71088
+ getNodeLinks(node).flags |= 536870912 /* ConstructorReference */;
71089
+ }
71091
71090
  }
71092
71091
  }
71093
71092
  checkNestedBlockScopedBinding(node, symbol);
@@ -71218,7 +71217,7 @@ function createTypeChecker(host) {
71218
71217
  if (isForStatement(container)) {
71219
71218
  const varDeclList = getAncestor(symbol.valueDeclaration, 261 /* VariableDeclarationList */);
71220
71219
  if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) {
71221
- getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* NeedsLoopOutParameter */;
71220
+ getNodeLinks(symbol.valueDeclaration).flags |= 65536 /* NeedsLoopOutParameter */;
71222
71221
  }
71223
71222
  }
71224
71223
  getNodeLinks(symbol.valueDeclaration).flags |= 32768 /* BlockScopedBindingInLoop */;
@@ -71496,7 +71495,7 @@ function createTypeChecker(host) {
71496
71495
  if (!isCallExpression2 && languageVersion >= 2 /* ES2015 */ && languageVersion <= 8 /* ES2021 */ && (isPropertyDeclaration(container) || isClassStaticBlockDeclaration(container))) {
71497
71496
  forEachEnclosingBlockScopeContainer(node.parent, (current) => {
71498
71497
  if (!isSourceFile(current) || isExternalOrCommonJsModule(current)) {
71499
- getNodeLinks(current).flags |= 8388608 /* ContainsSuperPropertyInStaticInitializer */;
71498
+ getNodeLinks(current).flags |= 2097152 /* ContainsSuperPropertyInStaticInitializer */;
71500
71499
  }
71501
71500
  });
71502
71501
  }
@@ -72023,7 +72022,7 @@ function createTypeChecker(host) {
72023
72022
  } else if (t.flags & 3670016 /* StructuredType */) {
72024
72023
  const prop = getPropertyOfType(t, name);
72025
72024
  if (prop) {
72026
- return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
72025
+ return isCircularMappedProperty(prop) ? void 0 : removeMissingType(getTypeOfSymbol(prop), !!(prop && prop.flags & 16777216 /* Optional */));
72027
72026
  }
72028
72027
  if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
72029
72028
  const restType = getElementTypeOfSliceOfTupleType(
@@ -72108,7 +72107,7 @@ function createTypeChecker(host) {
72108
72107
  (t) => {
72109
72108
  if (isTupleType(t)) {
72110
72109
  if ((firstSpreadIndex === void 0 || index < firstSpreadIndex) && index < t.target.fixedLength) {
72111
- return getTypeArguments(t)[index];
72110
+ return removeMissingType(getTypeArguments(t)[index], !!(t.target.elementFlags[index] && 2 /* Optional */));
72112
72111
  }
72113
72112
  const offset = length2 !== void 0 && (lastSpreadIndex === void 0 || index > lastSpreadIndex) ? length2 - index : 0;
72114
72113
  const fixedEndLength = offset > 0 && t.target.hasRestElement ? getEndElementCount(t.target, 3 /* Fixed */) : 0;
@@ -73269,13 +73268,18 @@ function createTypeChecker(host) {
73269
73268
  if (!isErrorType(intrinsicElementsType)) {
73270
73269
  if (!isIdentifier(node.tagName) && !isJsxNamespacedName(node.tagName))
73271
73270
  return Debug.fail();
73272
- const intrinsicProp = getPropertyOfType(intrinsicElementsType, isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText);
73271
+ const propName = isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText;
73272
+ const intrinsicProp = getPropertyOfType(intrinsicElementsType, propName);
73273
73273
  if (intrinsicProp) {
73274
73274
  links.jsxFlags |= 1 /* IntrinsicNamedElement */;
73275
73275
  return links.resolvedSymbol = intrinsicProp;
73276
73276
  }
73277
- const indexSignatureType = getIndexTypeOfType(intrinsicElementsType, stringType);
73278
- if (indexSignatureType) {
73277
+ const indexSymbol = getApplicableIndexSymbol(intrinsicElementsType, getStringLiteralType(unescapeLeadingUnderscores(propName)));
73278
+ if (indexSymbol) {
73279
+ links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
73280
+ return links.resolvedSymbol = indexSymbol;
73281
+ }
73282
+ if (getTypeOfPropertyOrIndexSignatureOfType(intrinsicElementsType, propName)) {
73279
73283
  links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
73280
73284
  return links.resolvedSymbol = intrinsicElementsType.symbol;
73281
73285
  }
@@ -73453,6 +73457,7 @@ function createTypeChecker(host) {
73453
73457
  }
73454
73458
  }
73455
73459
  function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) {
73460
+ var _a;
73456
73461
  Debug.assert(isJsxIntrinsicTagName(node.tagName));
73457
73462
  const links = getNodeLinks(node);
73458
73463
  if (!links.resolvedJsxElementAttributesType) {
@@ -73460,7 +73465,8 @@ function createTypeChecker(host) {
73460
73465
  if (links.jsxFlags & 1 /* IntrinsicNamedElement */) {
73461
73466
  return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol) || errorType;
73462
73467
  } else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) {
73463
- return links.resolvedJsxElementAttributesType = getIndexTypeOfType(getJsxType(JsxNames.IntrinsicElements, node), stringType) || errorType;
73468
+ const propName = isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText;
73469
+ return links.resolvedJsxElementAttributesType = ((_a = getApplicableIndexInfoForName(getJsxType(JsxNames.IntrinsicElements, node), propName)) == null ? void 0 : _a.type) || errorType;
73464
73470
  } else {
73465
73471
  return links.resolvedJsxElementAttributesType = errorType;
73466
73472
  }
@@ -75038,7 +75044,7 @@ function createTypeChecker(host) {
75038
75044
  }
75039
75045
  }
75040
75046
  function getThisArgumentOfCall(node) {
75041
- const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : void 0;
75047
+ const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0;
75042
75048
  if (expression) {
75043
75049
  const callee = skipOuterExpressions(expression);
75044
75050
  if (isAccessExpression(callee)) {
@@ -78540,6 +78546,11 @@ function createTypeChecker(host) {
78540
78546
  }
78541
78547
  leftType = checkNonNullType(leftType, left);
78542
78548
  rightType = checkNonNullType(rightType, right);
78549
+ if (leftType.flags & rightType.flags & 1024 /* EnumLiteral */) {
78550
+ if (getBaseTypeOfEnumLikeType(leftType).symbol !== getBaseTypeOfEnumLikeType(rightType).symbol) {
78551
+ error2(errorNode, Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations);
78552
+ }
78553
+ }
78543
78554
  let suggestedOperator;
78544
78555
  if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) {
78545
78556
  error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator));
@@ -79443,9 +79454,14 @@ function createTypeChecker(host) {
79443
79454
  case 15 /* NoSubstitutionTemplateLiteral */:
79444
79455
  case 11 /* StringLiteral */:
79445
79456
  return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
79446
- case 9 /* NumericLiteral */:
79457
+ case 9 /* NumericLiteral */: {
79447
79458
  checkGrammarNumericLiteral(node);
79448
- return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
79459
+ const value = +node.text;
79460
+ if (!isFinite(value)) {
79461
+ return numberType;
79462
+ }
79463
+ return getFreshTypeOfLiteralType(getNumberLiteralType(value));
79464
+ }
79449
79465
  case 10 /* BigIntLiteral */:
79450
79466
  checkGrammarBigIntLiteral(node);
79451
79467
  return getFreshTypeOfLiteralType(getBigIntLiteralType({
@@ -79945,7 +79961,7 @@ function createTypeChecker(host) {
79945
79961
  function setNodeLinksForPrivateIdentifierScope(node) {
79946
79962
  if (isPrivateIdentifier(node.name) && languageVersion < 99 /* ESNext */) {
79947
79963
  for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
79948
- getNodeLinks(lexicalScope).flags |= 4194304 /* ContainsClassWithPrivateIdentifiers */;
79964
+ getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
79949
79965
  }
79950
79966
  if (isClassExpression(node.parent)) {
79951
79967
  const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
@@ -81698,7 +81714,7 @@ function createTypeChecker(host) {
81698
81714
  }
81699
81715
  function checkWeakMapSetCollision(node) {
81700
81716
  const enclosingBlockScope = getEnclosingBlockScopeContainer(node);
81701
- if (getNodeCheckFlags(enclosingBlockScope) & 4194304 /* ContainsClassWithPrivateIdentifiers */) {
81717
+ if (getNodeCheckFlags(enclosingBlockScope) & 1048576 /* ContainsClassWithPrivateIdentifiers */) {
81702
81718
  Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier");
81703
81719
  errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText);
81704
81720
  }
@@ -81712,18 +81728,18 @@ function createTypeChecker(host) {
81712
81728
  let hasCollision = false;
81713
81729
  if (isClassExpression(node)) {
81714
81730
  for (const member of node.members) {
81715
- if (getNodeCheckFlags(member) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
81731
+ if (getNodeCheckFlags(member) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
81716
81732
  hasCollision = true;
81717
81733
  break;
81718
81734
  }
81719
81735
  }
81720
81736
  } else if (isFunctionExpression(node)) {
81721
- if (getNodeCheckFlags(node) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
81737
+ if (getNodeCheckFlags(node) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
81722
81738
  hasCollision = true;
81723
81739
  }
81724
81740
  } else {
81725
81741
  const container = getEnclosingBlockScopeContainer(node);
81726
- if (container && getNodeCheckFlags(container) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
81742
+ if (container && getNodeCheckFlags(container) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) {
81727
81743
  hasCollision = true;
81728
81744
  }
81729
81745
  }
@@ -85577,31 +85593,7 @@ function createTypeChecker(host) {
85577
85593
  if (name.kind === 211 /* PropertyAccessExpression */) {
85578
85594
  checkPropertyAccessExpression(name, 0 /* Normal */);
85579
85595
  if (!links.resolvedSymbol) {
85580
- const expressionType = checkExpressionCached(name.expression);
85581
- const infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name));
85582
- if (infos.length && expressionType.members) {
85583
- const resolved = resolveStructuredTypeMembers(expressionType);
85584
- const symbol = resolved.members.get("__index" /* Index */);
85585
- if (infos === getIndexInfosOfType(expressionType)) {
85586
- links.resolvedSymbol = symbol;
85587
- } else if (symbol) {
85588
- const symbolLinks2 = getSymbolLinks(symbol);
85589
- const declarationList = mapDefined(infos, (i) => i.declaration);
85590
- const nodeListId = map(declarationList, getNodeId).join(",");
85591
- if (!symbolLinks2.filteredIndexSymbolCache) {
85592
- symbolLinks2.filteredIndexSymbolCache = /* @__PURE__ */ new Map();
85593
- }
85594
- if (symbolLinks2.filteredIndexSymbolCache.has(nodeListId)) {
85595
- links.resolvedSymbol = symbolLinks2.filteredIndexSymbolCache.get(nodeListId);
85596
- } else {
85597
- const copy = createSymbol(131072 /* Signature */, "__index" /* Index */);
85598
- copy.declarations = mapDefined(infos, (i) => i.declaration);
85599
- copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent);
85600
- symbolLinks2.filteredIndexSymbolCache.set(nodeListId, copy);
85601
- links.resolvedSymbol = symbolLinks2.filteredIndexSymbolCache.get(nodeListId);
85602
- }
85603
- }
85604
- }
85596
+ links.resolvedSymbol = getApplicableIndexSymbol(checkExpressionCached(name.expression), getLiteralTypeFromPropertyName(name.name));
85605
85597
  }
85606
85598
  } else {
85607
85599
  checkQualifiedName(name, 0 /* Normal */);
@@ -85634,6 +85626,31 @@ function createTypeChecker(host) {
85634
85626
  }
85635
85627
  return void 0;
85636
85628
  }
85629
+ function getApplicableIndexSymbol(type, keyType) {
85630
+ const infos = getApplicableIndexInfos(type, keyType);
85631
+ if (infos.length && type.members) {
85632
+ const symbol = getIndexSymbolFromSymbolTable(resolveStructuredTypeMembers(type).members);
85633
+ if (infos === getIndexInfosOfType(type)) {
85634
+ return symbol;
85635
+ } else if (symbol) {
85636
+ const symbolLinks2 = getSymbolLinks(symbol);
85637
+ const declarationList = mapDefined(infos, (i) => i.declaration);
85638
+ const nodeListId = map(declarationList, getNodeId).join(",");
85639
+ if (!symbolLinks2.filteredIndexSymbolCache) {
85640
+ symbolLinks2.filteredIndexSymbolCache = /* @__PURE__ */ new Map();
85641
+ }
85642
+ if (symbolLinks2.filteredIndexSymbolCache.has(nodeListId)) {
85643
+ return symbolLinks2.filteredIndexSymbolCache.get(nodeListId);
85644
+ } else {
85645
+ const copy = createSymbol(131072 /* Signature */, "__index" /* Index */);
85646
+ copy.declarations = mapDefined(infos, (i) => i.declaration);
85647
+ copy.parent = type.aliasSymbol ? type.aliasSymbol : type.symbol ? type.symbol : getSymbolAtLocation(copy.declarations[0].parent);
85648
+ symbolLinks2.filteredIndexSymbolCache.set(nodeListId, copy);
85649
+ return copy;
85650
+ }
85651
+ }
85652
+ }
85653
+ }
85637
85654
  function resolveJSDocMemberName(name, ignoreErrors, container) {
85638
85655
  if (isEntityName(name)) {
85639
85656
  const meaning = 788968 /* Type */ | 1920 /* Namespace */ | 111551 /* Value */;
@@ -86462,7 +86479,7 @@ function createTypeChecker(host) {
86462
86479
  if (enumResult)
86463
86480
  return enumResult;
86464
86481
  const literalValue = type.value;
86465
- return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
86482
+ return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue);
86466
86483
  }
86467
86484
  function createLiteralConstValue(node, tracker) {
86468
86485
  const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
@@ -93058,7 +93075,7 @@ function transformTypeScript(context) {
93058
93075
  function transformEnumMemberDeclarationValue(member) {
93059
93076
  const value = resolver.getConstantValue(member);
93060
93077
  if (value !== void 0) {
93061
- return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
93078
+ return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value);
93062
93079
  } else {
93063
93080
  enableSubstitutionForNonQualifiedEnumMembers();
93064
93081
  if (member.initializer) {
@@ -94013,6 +94030,11 @@ function transformClassFields(context) {
94013
94030
  }
94014
94031
  }
94015
94032
  }
94033
+ function getClassThis() {
94034
+ const lex = getClassLexicalEnvironment();
94035
+ const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
94036
+ return Debug.checkDefined(classThis);
94037
+ }
94016
94038
  function transformAutoAccessor(node) {
94017
94039
  const commentRange = getCommentRange(node);
94018
94040
  const sourceMapRange = getSourceMapRange(node);
@@ -94039,11 +94061,13 @@ function transformClassFields(context) {
94039
94061
  setOriginalNode(backingField, node);
94040
94062
  setEmitFlags(backingField, 3072 /* NoComments */);
94041
94063
  setSourceMapRange(backingField, sourceMapRange);
94042
- const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName);
94064
+ const receiver = isStatic(node) ? getClassThis() : factory2.createThis();
94065
+ const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
94043
94066
  setOriginalNode(getter, node);
94044
94067
  setCommentRange(getter, commentRange);
94045
94068
  setSourceMapRange(getter, sourceMapRange);
94046
- const setter = createAccessorPropertySetRedirector(factory2, node, modifiers, setterName);
94069
+ const setterModifiers = factory2.createModifiersFromModifierFlags(modifiersToFlags(modifiers));
94070
+ const setter = createAccessorPropertySetRedirector(factory2, node, setterModifiers, setterName, receiver);
94047
94071
  setOriginalNode(setter, node);
94048
94072
  setEmitFlags(setter, 3072 /* NoComments */);
94049
94073
  setSourceMapRange(setter, sourceMapRange);
@@ -94600,6 +94624,7 @@ function transformClassFields(context) {
94600
94624
  return filter(node.members, isNonStaticMethodOrAccessorWithPrivateName);
94601
94625
  }
94602
94626
  function getClassFacts(node) {
94627
+ var _a;
94603
94628
  let facts = 0 /* None */;
94604
94629
  const original = getOriginalNode(node);
94605
94630
  if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
@@ -94616,6 +94641,8 @@ function transformClassFields(context) {
94616
94641
  if (isStatic(member)) {
94617
94642
  if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) {
94618
94643
  facts |= 2 /* NeedsClassConstructorReference */;
94644
+ } else if (isAutoAccessorPropertyDeclaration(member) && shouldTransformAutoAccessors === -1 /* True */ && !node.name && !((_a = node.emitNode) == null ? void 0 : _a.classThis)) {
94645
+ facts |= 2 /* NeedsClassConstructorReference */;
94619
94646
  }
94620
94647
  if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) {
94621
94648
  if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) {
@@ -94636,6 +94663,9 @@ function transformClassFields(context) {
94636
94663
  containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member));
94637
94664
  } else if (isPrivateIdentifierClassElementDeclaration(member)) {
94638
94665
  containsInstancePrivateElements = true;
94666
+ if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) {
94667
+ facts |= 2 /* NeedsClassConstructorReference */;
94668
+ }
94639
94669
  } else if (isPropertyDeclaration(member)) {
94640
94670
  containsPublicInstanceFields = true;
94641
94671
  containsInitializedPublicInstanceFields || (containsInitializedPublicInstanceFields = !!member.initializer);
@@ -94736,10 +94766,11 @@ function transformClassFields(context) {
94736
94766
  getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp);
94737
94767
  pendingClassReferenceAssignment = factory2.createAssignment(temp, factory2.getInternalName(node));
94738
94768
  }
94739
- if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
94740
- getClassLexicalEnvironment().classThis = node.emitNode.classThis;
94741
- }
94742
94769
  }
94770
+ if ((_b = node.emitNode) == null ? void 0 : _b.classThis) {
94771
+ getClassLexicalEnvironment().classThis = node.emitNode.classThis;
94772
+ }
94773
+ const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */;
94743
94774
  const isExport = hasSyntacticModifier(node, 1 /* Export */);
94744
94775
  const isDefault = hasSyntacticModifier(node, 1024 /* Default */);
94745
94776
  let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
@@ -94774,6 +94805,11 @@ function transformClassFields(context) {
94774
94805
  )
94775
94806
  ));
94776
94807
  }
94808
+ const alias = getClassLexicalEnvironment().classConstructor;
94809
+ if (isClassWithConstructorReference && alias) {
94810
+ enableSubstitutionForClassAliases();
94811
+ classAliases[getOriginalNodeId(node)] = alias;
94812
+ }
94777
94813
  const classDecl = factory2.updateClassDeclaration(
94778
94814
  node,
94779
94815
  modifiers,
@@ -94796,14 +94832,14 @@ function transformClassFields(context) {
94796
94832
  var _a, _b, _c;
94797
94833
  const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
94798
94834
  const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
94799
- const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */;
94835
+ const classCheckFlags = resolver.getNodeCheckFlags(node);
94836
+ const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */;
94800
94837
  let temp;
94801
94838
  function createClassTempVar() {
94802
94839
  var _a2;
94803
94840
  if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) {
94804
94841
  return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
94805
94842
  }
94806
- const classCheckFlags = resolver.getNodeCheckFlags(node);
94807
94843
  const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
94808
94844
  const temp2 = factory2.createTempVariable(
94809
94845
  requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
@@ -95770,7 +95806,7 @@ function transformClassFields(context) {
95770
95806
  }
95771
95807
  function trySubstituteClassAlias(node) {
95772
95808
  if (enabledSubstitutions & 1 /* ClassAliases */) {
95773
- if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) {
95809
+ if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
95774
95810
  const declaration = resolver.getReferencedValueDeclaration(node);
95775
95811
  if (declaration) {
95776
95812
  const classAlias = classAliases[declaration.id];
@@ -96624,7 +96660,7 @@ function transformLegacyDecorators(context) {
96624
96660
  }
96625
96661
  }
96626
96662
  function getClassAliasIfNeeded(node) {
96627
- if (resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */) {
96663
+ if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) {
96628
96664
  enableSubstitutionForClassAliases();
96629
96665
  const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
96630
96666
  classAliases[getOriginalNodeId(node)] = classAlias;
@@ -96657,7 +96693,7 @@ function transformLegacyDecorators(context) {
96657
96693
  }
96658
96694
  function trySubstituteClassAlias(node) {
96659
96695
  if (classAliases) {
96660
- if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) {
96696
+ if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) {
96661
96697
  const declaration = resolver.getReferencedValueDeclaration(node);
96662
96698
  if (declaration) {
96663
96699
  const classAlias = classAliases[declaration.id];
@@ -96683,6 +96719,7 @@ function transformESDecorators(context) {
96683
96719
  endLexicalEnvironment,
96684
96720
  hoistVariableDeclaration
96685
96721
  } = context;
96722
+ const languageVersion = getEmitScriptTarget(context.getCompilerOptions());
96686
96723
  let top;
96687
96724
  let classInfo;
96688
96725
  let classThis;
@@ -98184,6 +98221,17 @@ function transformESDecorators(context) {
98184
98221
  function transformDecorator(decorator) {
98185
98222
  const expression = visitNode(decorator.expression, visitor, isExpression);
98186
98223
  setEmitFlags(expression, 3072 /* NoComments */);
98224
+ const innerExpression = skipOuterExpressions(expression);
98225
+ if (isAccessExpression(innerExpression)) {
98226
+ const { target, thisArg } = factory2.createCallBinding(
98227
+ expression,
98228
+ hoistVariableDeclaration,
98229
+ languageVersion,
98230
+ /*cacheIdentifiers*/
98231
+ true
98232
+ );
98233
+ return factory2.restoreOuterExpressions(expression, factory2.createFunctionBindCall(target, thisArg, []));
98234
+ }
98187
98235
  return expression;
98188
98236
  }
98189
98237
  function createDescriptorMethod(original, name, modifiers, asteriskToken, kind, parameters, body) {
@@ -104827,10 +104875,10 @@ function transformES2015(context) {
104827
104875
  name
104828
104876
  ));
104829
104877
  const checkFlags = resolver.getNodeCheckFlags(decl);
104830
- if (checkFlags & 262144 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
104878
+ if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
104831
104879
  const outParamName = factory2.createUniqueName("out_" + idText(name));
104832
104880
  let flags = 0 /* None */;
104833
- if (checkFlags & 262144 /* NeedsLoopOutParameter */) {
104881
+ if (checkFlags & 65536 /* NeedsLoopOutParameter */) {
104834
104882
  flags |= 1 /* Body */;
104835
104883
  }
104836
104884
  if (isForStatement(container)) {
@@ -107038,7 +107086,7 @@ function transformGenerators(context) {
107038
107086
  if (labelExpressions === void 0) {
107039
107087
  labelExpressions = [];
107040
107088
  }
107041
- const expression = factory2.createNumericLiteral(-1);
107089
+ const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER);
107042
107090
  if (labelExpressions[label] === void 0) {
107043
107091
  labelExpressions[label] = [expression];
107044
107092
  } else {
@@ -112896,7 +112944,8 @@ function transformDeclarations(context) {
112896
112944
  if (shouldStripInternal(m))
112897
112945
  return;
112898
112946
  const constValue = resolver.getConstantValue(m);
112899
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
112947
+ const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
112948
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
112900
112949
  }))));
112901
112950
  }
112902
112951
  }
@@ -164745,8 +164794,10 @@ function provideInlayHints(context) {
164745
164794
  }
164746
164795
  function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
164747
164796
  let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
164797
+ let displayParts;
164748
164798
  if (shouldUseInteractiveInlayHints(preferences)) {
164749
- hintText = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
164799
+ displayParts = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
164800
+ hintText = "";
164750
164801
  } else {
164751
164802
  hintText += ":";
164752
164803
  }
@@ -164754,7 +164805,8 @@ function provideInlayHints(context) {
164754
164805
  text: hintText,
164755
164806
  position,
164756
164807
  kind: "Parameter" /* Parameter */,
164757
- whitespaceAfter: true
164808
+ whitespaceAfter: true,
164809
+ displayParts
164758
164810
  });
164759
164811
  }
164760
164812
  function addTypeHints(text, position) {
@@ -183642,19 +183694,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183642
183694
  const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
183643
183695
  const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
183644
183696
  return hints.map((hint) => {
183645
- const { text, position } = hint;
183646
- const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
183647
- text: text2,
183648
- span: span && {
183649
- start: scriptInfo.positionToLineOffset(span.start),
183650
- end: scriptInfo.positionToLineOffset(span.start + span.length),
183651
- file: file2
183652
- }
183653
- }));
183697
+ const { position, displayParts } = hint;
183654
183698
  return {
183655
183699
  ...hint,
183656
183700
  position: scriptInfo.positionToLineOffset(position),
183657
- text: hintText
183701
+ displayParts: displayParts == null ? void 0 : displayParts.map(({ text, span, file: file2 }) => ({
183702
+ text,
183703
+ span: span && {
183704
+ start: scriptInfo.positionToLineOffset(span.start),
183705
+ end: scriptInfo.positionToLineOffset(span.start + span.length),
183706
+ file: file2
183707
+ }
183708
+ }))
183658
183709
  };
183659
183710
  });
183660
183711
  }