@typescript-deploys/pr-build 5.2.0-pr-54581-2 → 5.2.0-pr-54281-25

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.
@@ -82,7 +82,7 @@ interface WeakMap<K extends WeakKey, V> {
82
82
  }
83
83
 
84
84
  interface WeakMapConstructor {
85
- new <K extends WeakKey = WeakKey, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
85
+ new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
86
86
  readonly prototype: WeakMap<WeakKey, any>;
87
87
  }
88
88
  declare var WeakMap: WeakMapConstructor;
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.20230609`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230612`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7729,6 +7729,9 @@ var Diagnostics = {
7729
7729
  Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
7730
7730
  Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
7731
7731
  Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"),
7732
+ Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
7733
+ Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
7734
+ Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
7732
7735
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
7733
7736
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
7734
7737
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -42681,11 +42684,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
42681
42684
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
42682
42685
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
42683
42686
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
42684
- CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
42685
- CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
42686
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
42687
- CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
42688
- CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
42687
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
42688
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
42689
+ CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
42690
+ CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
42689
42691
  return CheckMode3;
42690
42692
  })(CheckMode || {});
42691
42693
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -42965,9 +42967,9 @@ function createTypeChecker(host) {
42965
42967
  candidatesOutArray,
42966
42968
  /*argumentCount*/
42967
42969
  void 0,
42968
- 64 /* IsForStringLiteralArgumentCompletions */
42970
+ 32 /* IsForStringLiteralArgumentCompletions */
42969
42971
  )),
42970
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
42972
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
42971
42973
  getExpandedParameters,
42972
42974
  hasEffectiveRestParameter,
42973
42975
  containsArgumentsReference,
@@ -50922,7 +50924,7 @@ function createTypeChecker(host) {
50922
50924
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
50923
50925
  }
50924
50926
  function getTypeForBindingElement(declaration) {
50925
- const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
50927
+ const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
50926
50928
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
50927
50929
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
50928
50930
  }
@@ -65827,7 +65829,7 @@ function createTypeChecker(host) {
65827
65829
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
65828
65830
  }
65829
65831
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
65830
- const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
65832
+ const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
65831
65833
  node,
65832
65834
  /*contextFlags*/
65833
65835
  void 0
@@ -66474,6 +66476,25 @@ function createTypeChecker(host) {
66474
66476
  return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
66475
66477
  });
66476
66478
  }
66479
+ function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) {
66480
+ let literal = containingLiteral;
66481
+ let type = contextualType;
66482
+ while (type) {
66483
+ const thisType = getThisTypeFromContextualType(type);
66484
+ if (thisType) {
66485
+ return thisType;
66486
+ }
66487
+ if (literal.parent.kind !== 302 /* PropertyAssignment */) {
66488
+ break;
66489
+ }
66490
+ literal = literal.parent.parent;
66491
+ type = getApparentTypeOfContextualType(
66492
+ literal,
66493
+ /*contextFlags*/
66494
+ void 0
66495
+ );
66496
+ }
66497
+ }
66477
66498
  function getContextualThisParameterType(func) {
66478
66499
  if (func.kind === 218 /* ArrowFunction */) {
66479
66500
  return void 0;
@@ -66496,22 +66517,9 @@ function createTypeChecker(host) {
66496
66517
  /*contextFlags*/
66497
66518
  void 0
66498
66519
  );
66499
- let literal = containingLiteral;
66500
- let type = contextualType;
66501
- while (type) {
66502
- const thisType = getThisTypeFromContextualType(type);
66503
- if (thisType) {
66504
- return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
66505
- }
66506
- if (literal.parent.kind !== 302 /* PropertyAssignment */) {
66507
- break;
66508
- }
66509
- literal = literal.parent.parent;
66510
- type = getApparentTypeOfContextualType(
66511
- literal,
66512
- /*contextFlags*/
66513
- void 0
66514
- );
66520
+ const thisType = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
66521
+ if (thisType) {
66522
+ return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
66515
66523
  }
66516
66524
  return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
66517
66525
  }
@@ -66584,7 +66592,7 @@ function createTypeChecker(host) {
66584
66592
  function getContextualTypeForBindingElement(declaration, contextFlags) {
66585
66593
  const parent = declaration.parent.parent;
66586
66594
  const name = declaration.propertyName || declaration.name;
66587
- const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
66595
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
66588
66596
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
66589
66597
  return void 0;
66590
66598
  if (parent.name.kind === 206 /* ArrayBindingPattern */) {
@@ -67633,9 +67641,7 @@ function createTypeChecker(host) {
67633
67641
  elementTypes.push(undefinedOrMissingType);
67634
67642
  elementFlags.push(2 /* Optional */);
67635
67643
  } else {
67636
- const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
67637
- const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
67638
- const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
67644
+ const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
67639
67645
  elementTypes.push(addOptionality(
67640
67646
  type,
67641
67647
  /*isProperty*/
@@ -67643,7 +67649,7 @@ function createTypeChecker(host) {
67643
67649
  hasOmittedExpression
67644
67650
  ));
67645
67651
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
67646
- if (shouldAddAsIntraExpressionInferenceSite) {
67652
+ if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
67647
67653
  const inferenceContext = getInferenceContext(node);
67648
67654
  Debug.assert(inferenceContext);
67649
67655
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -67784,13 +67790,11 @@ function createTypeChecker(host) {
67784
67790
  let member = getSymbolOfDeclaration(memberDecl);
67785
67791
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
67786
67792
  if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
67787
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
67788
- const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
67789
- let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
67793
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
67790
67794
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
67791
67795
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
67792
67796
  // we don't want to say "could not find 'a'".
67793
- memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
67797
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
67794
67798
  );
67795
67799
  if (isInJavascript) {
67796
67800
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -67834,7 +67838,7 @@ function createTypeChecker(host) {
67834
67838
  prop.links.target = member;
67835
67839
  member = prop;
67836
67840
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
67837
- if (shouldAddAsIntraExpressionInferenceSite) {
67841
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
67838
67842
  const inferenceContext = getInferenceContext(node);
67839
67843
  Debug.assert(inferenceContext);
67840
67844
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -68007,9 +68011,7 @@ function createTypeChecker(host) {
68007
68011
  for (const attributeDecl of attributes.properties) {
68008
68012
  const member = attributeDecl.symbol;
68009
68013
  if (isJsxAttribute(attributeDecl)) {
68010
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
68011
- const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
68012
- const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
68014
+ const exprType = checkJsxAttribute(attributeDecl, checkMode);
68013
68015
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
68014
68016
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
68015
68017
  attributeSymbol.declarations = member.declarations;
@@ -68030,7 +68032,7 @@ function createTypeChecker(host) {
68030
68032
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
68031
68033
  }
68032
68034
  }
68033
- if (shouldAddAsIntraExpressionInferenceSite) {
68035
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
68034
68036
  const inferenceContext = getInferenceContext(attributes);
68035
68037
  Debug.assert(inferenceContext);
68036
68038
  const inferenceNode = attributeDecl.initializer.expression;
@@ -69648,7 +69650,7 @@ function createTypeChecker(host) {
69648
69650
  }
69649
69651
  for (let i = 0; i < argCount; i++) {
69650
69652
  const arg = args[i];
69651
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69653
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69652
69654
  const paramType = getTypeAtPosition(signature, i);
69653
69655
  if (couldContainTypeVariables(paramType)) {
69654
69656
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -70261,12 +70263,12 @@ function createTypeChecker(host) {
70261
70263
  const args = getEffectiveCallArguments(node);
70262
70264
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
70263
70265
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
70264
- argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
70266
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70265
70267
  let candidatesForArgumentError;
70266
70268
  let candidateForArgumentArityError;
70267
70269
  let candidateForTypeArgumentError;
70268
70270
  let result;
70269
- const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
70271
+ const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
70270
70272
  if (candidates.length > 1) {
70271
70273
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
70272
70274
  }
@@ -70485,7 +70487,7 @@ function createTypeChecker(host) {
70485
70487
  continue;
70486
70488
  }
70487
70489
  if (argCheckMode) {
70488
- argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
70490
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70489
70491
  if (inferenceContext) {
70490
70492
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
70491
70493
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -73563,7 +73565,7 @@ function createTypeChecker(host) {
73563
73565
  case 36 /* ExclamationEqualsToken */:
73564
73566
  case 37 /* EqualsEqualsEqualsToken */:
73565
73567
  case 38 /* ExclamationEqualsEqualsToken */:
73566
- if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
73568
+ if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
73567
73569
  if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
73568
73570
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
73569
73571
  error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
@@ -74222,7 +74224,7 @@ function createTypeChecker(host) {
74222
74224
  }
74223
74225
  }
74224
74226
  const startInvocationCount = flowInvocationCount;
74225
- const type = checkExpression(node, 256 /* TypeOnly */);
74227
+ const type = checkExpression(node, 128 /* TypeOnly */);
74226
74228
  if (flowInvocationCount !== startInvocationCount) {
74227
74229
  const cache = flowTypeCache || (flowTypeCache = []);
74228
74230
  cache[getNodeId(node)] = type;
@@ -76693,7 +76695,7 @@ function createTypeChecker(host) {
76693
76695
  checkComputedPropertyName(node.propertyName);
76694
76696
  }
76695
76697
  const parent = node.parent.parent;
76696
- const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
76698
+ const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
76697
76699
  const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
76698
76700
  const name = node.propertyName || node.name;
76699
76701
  if (parentType && !isBindingPattern(name)) {
@@ -80283,7 +80285,7 @@ function createTypeChecker(host) {
80283
80285
  /*contextFlags*/
80284
80286
  void 0
80285
80287
  );
80286
- const type = contextualType && getThisTypeFromContextualType(contextualType);
80288
+ const type = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
80287
80289
  return type && !isTypeAny(type);
80288
80290
  }
80289
80291
  }