@typescript-deploys/pr-build 5.6.0-pr-58829-3 → 5.6.0-pr-58729-60

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/lib.es5.d.ts CHANGED
@@ -1672,6 +1672,11 @@ type Uncapitalize<S extends string> = intrinsic;
1672
1672
  */
1673
1673
  type NoInfer<T> = intrinsic;
1674
1674
 
1675
+ /**
1676
+ * Marker for deferred callbacks
1677
+ */
1678
+ type Deferred<T extends (...args: any) => any> = intrinsic;
1679
+
1675
1680
  /**
1676
1681
  * Marker for contextual 'this' type
1677
1682
  */
package/lib/tsc.js CHANGED
@@ -1644,7 +1644,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1644
1644
  __tsDebuggerDisplay: {
1645
1645
  value() {
1646
1646
  const flowHeader = this.flags & 2 /* Start */ ? "FlowStart" : this.flags & 4 /* BranchLabel */ ? "FlowBranchLabel" : this.flags & 8 /* LoopLabel */ ? "FlowLoopLabel" : this.flags & 16 /* Assignment */ ? "FlowAssignment" : this.flags & 32 /* TrueCondition */ ? "FlowTrueCondition" : this.flags & 64 /* FalseCondition */ ? "FlowFalseCondition" : this.flags & 128 /* SwitchClause */ ? "FlowSwitchClause" : this.flags & 256 /* ArrayMutation */ ? "FlowArrayMutation" : this.flags & 512 /* Call */ ? "FlowCall" : this.flags & 1024 /* ReduceLabel */ ? "FlowReduceLabel" : this.flags & 1 /* Unreachable */ ? "FlowUnreachable" : "UnknownFlow";
1647
- const remainingFlags = this.flags & ~(2048 /* Referenced */ - 1);
1647
+ const remainingFlags = this.flags & ~(4096 /* Referenced */ - 1);
1648
1648
  return `${flowHeader}${remainingFlags ? ` (${formatFlowFlags(remainingFlags)})` : ""}`;
1649
1649
  }
1650
1650
  },
@@ -3451,8 +3451,9 @@ var FlowFlags = /* @__PURE__ */ ((FlowFlags2) => {
3451
3451
  FlowFlags2[FlowFlags2["ArrayMutation"] = 256] = "ArrayMutation";
3452
3452
  FlowFlags2[FlowFlags2["Call"] = 512] = "Call";
3453
3453
  FlowFlags2[FlowFlags2["ReduceLabel"] = 1024] = "ReduceLabel";
3454
- FlowFlags2[FlowFlags2["Referenced"] = 2048] = "Referenced";
3455
- FlowFlags2[FlowFlags2["Shared"] = 4096] = "Shared";
3454
+ FlowFlags2[FlowFlags2["LambdaArgs"] = 2048] = "LambdaArgs";
3455
+ FlowFlags2[FlowFlags2["Referenced"] = 4096] = "Referenced";
3456
+ FlowFlags2[FlowFlags2["Shared"] = 8192] = "Shared";
3456
3457
  FlowFlags2[FlowFlags2["Label"] = 12] = "Label";
3457
3458
  FlowFlags2[FlowFlags2["Condition"] = 96] = "Condition";
3458
3459
  return FlowFlags2;
@@ -3672,10 +3673,11 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
3672
3673
  ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
3673
3674
  ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
3674
3675
  ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
3675
- ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
3676
3676
  ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
3677
3677
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
3678
3678
  ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
3679
+ ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
3680
+ ObjectFlags3[ObjectFlags3["DeferredCallback"] = 268435456] = "DeferredCallback";
3679
3681
  ObjectFlags3[ObjectFlags3["IsGenericTypeComputed"] = 2097152] = "IsGenericTypeComputed";
3680
3682
  ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
3681
3683
  ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
@@ -7551,8 +7553,6 @@ var Diagnostics = {
7551
7553
  Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
7552
7554
  Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations: diag(9038, 1 /* Error */, "Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations_9038", "Computed property names on class or object literals cannot be inferred with --isolatedDeclarations."),
7553
7555
  Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations: diag(9039, 1 /* Error */, "Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations_9039", "Type containing private name '{0}' can't be used with --isolatedDeclarations."),
7554
- keyof_type_must_have_an_operand_type: diag(9040, 1 /* Error */, "keyof_type_must_have_an_operand_type_9040", "`keyof` type must have an operand type."),
7555
- A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_literal_type: diag(9041, 1 /* Error */, "A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_lit_9041", "A `satisfies keyof` computed property name must be exactly a single string, number, or unique symbol literal type."),
7556
7556
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
7557
7557
  JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
7558
7558
  Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
@@ -19368,8 +19368,15 @@ function hasInferredType(node) {
19368
19368
  return false;
19369
19369
  }
19370
19370
  }
19371
- function isSatisfiesKeyofExpression(node) {
19372
- return node.kind === 238 /* SatisfiesExpression */ && node.type.kind === 143 /* KeyOfKeyword */ && isEntityNameExpression(node.expression);
19371
+ function getLambdaArgument(node) {
19372
+ switch (node.kind) {
19373
+ case 218 /* FunctionExpression */:
19374
+ case 219 /* ArrowFunction */:
19375
+ return !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken ? node : void 0;
19376
+ case 217 /* ParenthesizedExpression */:
19377
+ return getLambdaArgument(node.expression);
19378
+ }
19379
+ return void 0;
19373
19380
  }
19374
19381
 
19375
19382
  // src/compiler/factory/baseNodeFactory.ts
@@ -30557,8 +30564,7 @@ var Parser;
30557
30564
  function parseTypeOperator(operator) {
30558
30565
  const pos = getNodePos();
30559
30566
  parseExpected(operator);
30560
- const arg = operator !== 143 /* KeyOfKeyword */ || isStartOfType() ? parseTypeOperatorOrHigher() : void 0;
30561
- return finishNode(arg ? factory2.createTypeOperatorNode(operator, arg) : factory2.createKeywordTypeNode(143 /* KeyOfKeyword */), pos);
30567
+ return finishNode(factory2.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos);
30562
30568
  }
30563
30569
  function tryParseConstraintOfInferType() {
30564
30570
  if (parseOptional(96 /* ExtendsKeyword */)) {
@@ -41239,6 +41245,7 @@ function createBinder() {
41239
41245
  var activeLabelList;
41240
41246
  var hasExplicitReturn;
41241
41247
  var hasFlowEffects;
41248
+ var hasFlowMutation;
41242
41249
  var emitFlags;
41243
41250
  var inStrictMode;
41244
41251
  var inAssignmentPattern = false;
@@ -41311,6 +41318,7 @@ function createBinder() {
41311
41318
  activeLabelList = void 0;
41312
41319
  hasExplicitReturn = false;
41313
41320
  hasFlowEffects = false;
41321
+ hasFlowMutation = false;
41314
41322
  inAssignmentPattern = false;
41315
41323
  emitFlags = 0 /* None */;
41316
41324
  }
@@ -41569,7 +41577,9 @@ function createBinder() {
41569
41577
  const saveExceptionTarget = currentExceptionTarget;
41570
41578
  const saveActiveLabelList = activeLabelList;
41571
41579
  const saveHasExplicitReturn = hasExplicitReturn;
41572
- const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */;
41580
+ const isRegularFunctionExpression = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken;
41581
+ const isImmediatelyInvoked = isRegularFunctionExpression && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */;
41582
+ const isLambdaArgument = isRegularFunctionExpression && walkUpParenthesizedExpressions(node.parent).kind === 213 /* CallExpression */;
41573
41583
  if (!isImmediatelyInvoked) {
41574
41584
  currentFlow = createFlowNode(
41575
41585
  2 /* Start */,
@@ -41582,7 +41592,7 @@ function createBinder() {
41582
41592
  currentFlow.node = node;
41583
41593
  }
41584
41594
  }
41585
- currentReturnTarget = isImmediatelyInvoked || node.kind === 176 /* Constructor */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */) ? createBranchLabel() : void 0;
41595
+ currentReturnTarget = isImmediatelyInvoked || isLambdaArgument || node.kind === 176 /* Constructor */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */) ? createBranchLabel() : void 0;
41586
41596
  currentExceptionTarget = void 0;
41587
41597
  currentBreakTarget = void 0;
41588
41598
  currentContinueTarget = void 0;
@@ -41602,7 +41612,7 @@ function createBinder() {
41602
41612
  if (currentReturnTarget) {
41603
41613
  addAntecedent(currentReturnTarget, currentFlow);
41604
41614
  currentFlow = finishFlowLabel(currentReturnTarget);
41605
- if (node.kind === 176 /* Constructor */ || node.kind === 175 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
41615
+ if (isLambdaArgument && hasFlowMutation || node.kind === 176 /* Constructor */ || node.kind === 175 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
41606
41616
  node.returnFlowNode = currentFlow;
41607
41617
  }
41608
41618
  }
@@ -41882,7 +41892,7 @@ function createBinder() {
41882
41892
  return createFlowNode(1024 /* ReduceLabel */, { target, antecedents }, antecedent);
41883
41893
  }
41884
41894
  function setFlowNodeReferenced(flow) {
41885
- flow.flags |= flow.flags & 2048 /* Referenced */ ? 4096 /* Shared */ : 2048 /* Referenced */;
41895
+ flow.flags |= flow.flags & 4096 /* Referenced */ ? 8192 /* Shared */ : 4096 /* Referenced */;
41886
41896
  }
41887
41897
  function addAntecedent(label, antecedent) {
41888
41898
  if (!(antecedent.flags & 1 /* Unreachable */) && !contains(label.antecedent, antecedent)) {
@@ -41913,6 +41923,7 @@ function createBinder() {
41913
41923
  function createFlowMutation(flags, antecedent, node) {
41914
41924
  setFlowNodeReferenced(antecedent);
41915
41925
  hasFlowEffects = true;
41926
+ if (node.kind !== 260 /* VariableDeclaration */ && node.kind !== 208 /* BindingElement */) hasFlowMutation = true;
41916
41927
  const result = createFlowNode(flags, node, antecedent);
41917
41928
  if (currentExceptionTarget) {
41918
41929
  addAntecedent(currentExceptionTarget, result);
@@ -41924,6 +41935,10 @@ function createBinder() {
41924
41935
  hasFlowEffects = true;
41925
41936
  return createFlowNode(512 /* Call */, node, antecedent);
41926
41937
  }
41938
+ function createFlowLambdaArgs(antecedent, node) {
41939
+ setFlowNodeReferenced(antecedent);
41940
+ return createFlowNode(2048 /* LambdaArgs */, node, antecedent);
41941
+ }
41927
41942
  function finishFlowLabel(flow) {
41928
41943
  const antecedents = flow.antecedent;
41929
41944
  if (!antecedents) {
@@ -42585,10 +42600,22 @@ function createBinder() {
42585
42600
  bindEach(node.arguments);
42586
42601
  bind(node.expression);
42587
42602
  } else {
42588
- bindEachChild(node);
42603
+ bind(node.expression);
42604
+ bindEach(node.typeArguments);
42605
+ let hasLambdaArgs = false;
42606
+ for (const arg of node.arguments) {
42607
+ const saveHasFlowMutation = hasFlowMutation;
42608
+ hasFlowMutation = false;
42609
+ bind(arg);
42610
+ hasLambdaArgs || (hasLambdaArgs = !!getLambdaArgument(arg) && hasFlowMutation);
42611
+ hasFlowMutation || (hasFlowMutation = saveHasFlowMutation);
42612
+ }
42589
42613
  if (node.expression.kind === 108 /* SuperKeyword */) {
42590
42614
  currentFlow = createFlowCall(currentFlow, node);
42591
42615
  }
42616
+ if (hasLambdaArgs) {
42617
+ currentFlow = createFlowLambdaArgs(currentFlow, node);
42618
+ }
42592
42619
  }
42593
42620
  }
42594
42621
  if (node.expression.kind === 211 /* PropertyAccessExpression */) {
@@ -45128,7 +45155,8 @@ var intrinsicTypeKinds = new Map(Object.entries({
45128
45155
  Lowercase: 1 /* Lowercase */,
45129
45156
  Capitalize: 2 /* Capitalize */,
45130
45157
  Uncapitalize: 3 /* Uncapitalize */,
45131
- NoInfer: 4 /* NoInfer */
45158
+ NoInfer: 4 /* NoInfer */,
45159
+ Deferred: 5 /* Deferred */
45132
45160
  }));
45133
45161
  var SymbolLinks = class {
45134
45162
  };
@@ -46092,6 +46120,7 @@ function createTypeChecker(host) {
46092
46120
  var flowLoopStart = 0;
46093
46121
  var flowLoopCount = 0;
46094
46122
  var sharedFlowCount = 0;
46123
+ var mutationFlowCount = 0;
46095
46124
  var flowAnalysisDisabled = false;
46096
46125
  var flowInvocationCount = 0;
46097
46126
  var lastFlowNode;
@@ -46123,6 +46152,8 @@ function createTypeChecker(host) {
46123
46152
  var flowLoopTypes = [];
46124
46153
  var sharedFlowNodes = [];
46125
46154
  var sharedFlowTypes = [];
46155
+ var mutationFlowNodes = [];
46156
+ var mutationFlowStates = [];
46126
46157
  var flowNodeReachable = [];
46127
46158
  var flowNodePostSuper = [];
46128
46159
  var potentialThisCollisions = [];
@@ -49165,7 +49196,7 @@ function createTypeChecker(host) {
49165
49196
  }
49166
49197
  function getMeaningOfEntityNameReference(entityName) {
49167
49198
  let meaning;
49168
- if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */ || entityName.parent.kind === 182 /* TypePredicate */ && entityName.parent.parameterName === entityName || isSatisfiesKeyofExpression(entityName.parent)) {
49199
+ if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */ || entityName.parent.kind === 182 /* TypePredicate */ && entityName.parent.parameterName === entityName) {
49169
49200
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
49170
49201
  } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
49171
49202
  meaning = 1920 /* Namespace */;
@@ -50278,7 +50309,7 @@ function createTypeChecker(host) {
50278
50309
  trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context);
50279
50310
  }
50280
50311
  } else {
50281
- trackComputedName(isEntityNameExpression(decl.name.expression) ? decl.name.expression : decl.name.expression.expression, saveEnclosingDeclaration, context);
50312
+ trackComputedName(decl.name.expression, saveEnclosingDeclaration, context);
50282
50313
  }
50283
50314
  }
50284
50315
  } else {
@@ -50775,7 +50806,7 @@ function createTypeChecker(host) {
50775
50806
  return elideInitializerAndSetEmitFlags(node);
50776
50807
  function elideInitializerAndSetEmitFlags(node2) {
50777
50808
  if (context.tracker.canTrackSymbol && isComputedPropertyName(node2) && isLateBindableName(node2)) {
50778
- trackComputedName(isEntityNameExpression(node2.expression) ? node2.expression : node2.expression.expression, context.enclosingDeclaration, context);
50809
+ trackComputedName(node2.expression, context.enclosingDeclaration, context);
50779
50810
  }
50780
50811
  let visited = visitEachChild(
50781
50812
  node2,
@@ -55725,10 +55756,7 @@ function createTypeChecker(host) {
55725
55756
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
55726
55757
  return false;
55727
55758
  }
55728
- let expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
55729
- if (isSatisfiesExpression(expr) && expr.type.kind === 143 /* KeyOfKeyword */) {
55730
- expr = expr.expression;
55731
- }
55759
+ const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
55732
55760
  return isEntityNameExpression(expr) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
55733
55761
  }
55734
55762
  function isLateBoundName(name) {
@@ -58299,7 +58327,7 @@ function createTypeChecker(host) {
58299
58327
  if (type === intrinsicMarkerType) {
58300
58328
  const typeKind = intrinsicTypeKinds.get(symbol.escapedName);
58301
58329
  if (typeKind !== void 0 && typeArguments && typeArguments.length === 1) {
58302
- return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : getStringMappingType(symbol, typeArguments[0]);
58330
+ return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : typeKind === 5 /* Deferred */ ? getDeferredCallbackType(typeArguments[0], aliasSymbol, aliasTypeArguments) : getStringMappingType(symbol, typeArguments[0]);
58303
58331
  }
58304
58332
  }
58305
58333
  const links = getSymbolLinks(symbol);
@@ -58311,6 +58339,25 @@ function createTypeChecker(host) {
58311
58339
  }
58312
58340
  return instantiation;
58313
58341
  }
58342
+ function getDeferredCallbackType(type, aliasSymbol, aliasTypeArguments) {
58343
+ if (type.flags & 524288 /* Object */) {
58344
+ const key = `F${getTypeId(type)}${getAliasId(aliasSymbol, aliasTypeArguments)}`;
58345
+ return getCachedType(key) ?? setCachedType(key, createDeferredCallbackType(type, aliasSymbol, aliasTypeArguments));
58346
+ }
58347
+ return type;
58348
+ }
58349
+ function createDeferredCallbackType(type, aliasSymbol, aliasTypeArguments) {
58350
+ const resolved = resolveStructuredTypeMembers(type);
58351
+ const result = createObjectType(16 /* Anonymous */ | 268435456 /* DeferredCallback */, type.symbol);
58352
+ result.members = resolved.members;
58353
+ result.properties = resolved.properties;
58354
+ result.callSignatures = resolved.callSignatures;
58355
+ result.constructSignatures = resolved.constructSignatures;
58356
+ result.indexInfos = resolved.indexInfos;
58357
+ result.aliasSymbol = aliasSymbol;
58358
+ result.aliasTypeArguments = aliasTypeArguments;
58359
+ return result;
58360
+ }
58314
58361
  function getTypeFromTypeAliasReference(node, symbol) {
58315
58362
  if (getCheckFlags(symbol) & 1048576 /* Unresolved */) {
58316
58363
  const typeArguments = typeArgumentsFromTypeReferenceNode(node);
@@ -61094,13 +61141,6 @@ function createTypeChecker(host) {
61094
61141
  type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`;
61095
61142
  return type;
61096
61143
  }
61097
- function getUniqueESSymbolTypeForSymbol(symbol) {
61098
- const links = getSymbolLinks(symbol);
61099
- if (!links.uniqueESSymbolType) {
61100
- links.uniqueESSymbolType = createUniqueESSymbolType(symbol);
61101
- }
61102
- return links.uniqueESSymbolType;
61103
- }
61104
61144
  function getESSymbolLikeTypeForNode(node) {
61105
61145
  if (isInJSFile(node) && isJSDocTypeExpression(node)) {
61106
61146
  const host2 = getJSDocHost(node);
@@ -61111,7 +61151,8 @@ function createTypeChecker(host) {
61111
61151
  if (isValidESSymbolDeclaration(node)) {
61112
61152
  const symbol = isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
61113
61153
  if (symbol) {
61114
- return getUniqueESSymbolTypeForSymbol(symbol);
61154
+ const links = getSymbolLinks(symbol);
61155
+ return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
61115
61156
  }
61116
61157
  }
61117
61158
  return esSymbolType;
@@ -61179,12 +61220,6 @@ function createTypeChecker(host) {
61179
61220
  !!node.questionToken
61180
61221
  ));
61181
61222
  }
61182
- function getTypeFromKeyofKeywordTypeNode(node) {
61183
- if (!isSatisfiesExpression(node.parent) || !isComputedPropertyName(node.parent.parent)) {
61184
- error(node, Diagnostics.keyof_type_must_have_an_operand_type);
61185
- }
61186
- return stringNumberSymbolType;
61187
- }
61188
61223
  function getTypeFromTypeNode(node) {
61189
61224
  return getConditionalFlowTypeOfType(getTypeFromTypeNodeWorker(node), node);
61190
61225
  }
@@ -61280,8 +61315,6 @@ function createTypeChecker(host) {
61280
61315
  case 211 /* PropertyAccessExpression */:
61281
61316
  const symbol = getSymbolAtLocation(node);
61282
61317
  return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
61283
- case 143 /* KeyOfKeyword */:
61284
- return getTypeFromKeyofKeywordTypeNode(node);
61285
61318
  default:
61286
61319
  return errorType;
61287
61320
  }
@@ -68138,7 +68171,7 @@ function createTypeChecker(host) {
68138
68171
  return lastFlowNodeReachable;
68139
68172
  }
68140
68173
  const flags = flow.flags;
68141
- if (flags & 4096 /* Shared */) {
68174
+ if (flags & 8192 /* Shared */) {
68142
68175
  if (!noCacheCheck) {
68143
68176
  const id = getFlowNodeId(flow);
68144
68177
  const reachable = flowNodeReachable[id];
@@ -68150,7 +68183,7 @@ function createTypeChecker(host) {
68150
68183
  }
68151
68184
  noCacheCheck = false;
68152
68185
  }
68153
- if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */)) {
68186
+ if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 2048 /* LambdaArgs */)) {
68154
68187
  flow = flow.antecedent;
68155
68188
  } else if (flags & 512 /* Call */) {
68156
68189
  const signature = getEffectsSignature(flow.node);
@@ -68205,7 +68238,7 @@ function createTypeChecker(host) {
68205
68238
  function isPostSuperFlowNode(flow, noCacheCheck) {
68206
68239
  while (true) {
68207
68240
  const flags = flow.flags;
68208
- if (flags & 4096 /* Shared */) {
68241
+ if (flags & 8192 /* Shared */) {
68209
68242
  if (!noCacheCheck) {
68210
68243
  const id = getFlowNodeId(flow);
68211
68244
  const postSuper = flowNodePostSuper[id];
@@ -68217,7 +68250,7 @@ function createTypeChecker(host) {
68217
68250
  }
68218
68251
  noCacheCheck = false;
68219
68252
  }
68220
- if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 128 /* SwitchClause */)) {
68253
+ if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 128 /* SwitchClause */ | 2048 /* LambdaArgs */)) {
68221
68254
  flow = flow.antecedent;
68222
68255
  } else if (flags & 512 /* Call */) {
68223
68256
  if (flow.node.expression.kind === 108 /* SuperKeyword */) {
@@ -68271,6 +68304,7 @@ function createTypeChecker(host) {
68271
68304
  function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((_a) => (_a = tryCast(reference, canHaveFlowNode)) == null ? void 0 : _a.flowNode)()) {
68272
68305
  let key;
68273
68306
  let isKeySet = false;
68307
+ let inLambdaArg = false;
68274
68308
  let flowDepth = 0;
68275
68309
  if (flowAnalysisDisabled) {
68276
68310
  return errorType;
@@ -68280,8 +68314,10 @@ function createTypeChecker(host) {
68280
68314
  }
68281
68315
  flowInvocationCount++;
68282
68316
  const sharedFlowStart = sharedFlowCount;
68317
+ const mutationFlowStart = mutationFlowCount;
68283
68318
  const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode));
68284
68319
  sharedFlowCount = sharedFlowStart;
68320
+ mutationFlowCount = mutationFlowStart;
68285
68321
  const resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
68286
68322
  if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 235 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
68287
68323
  return declaredType;
@@ -68306,7 +68342,7 @@ function createTypeChecker(host) {
68306
68342
  let sharedFlow;
68307
68343
  while (true) {
68308
68344
  const flags = flow.flags;
68309
- if (flags & 4096 /* Shared */) {
68345
+ if (flags & 8192 /* Shared */) {
68310
68346
  for (let i = sharedFlowStart; i < sharedFlowCount; i++) {
68311
68347
  if (sharedFlowNodes[i] === flow) {
68312
68348
  flowDepth--;
@@ -68344,6 +68380,8 @@ function createTypeChecker(host) {
68344
68380
  flow = flow.antecedent;
68345
68381
  continue;
68346
68382
  }
68383
+ } else if (flags & 2048 /* LambdaArgs */) {
68384
+ type = getTypeAtFlowLambdaArgs(flow);
68347
68385
  } else if (flags & 1024 /* ReduceLabel */) {
68348
68386
  const target = flow.node.target;
68349
68387
  const saveAntecedents = target.antecedent;
@@ -68352,13 +68390,13 @@ function createTypeChecker(host) {
68352
68390
  target.antecedent = saveAntecedents;
68353
68391
  } else if (flags & 2 /* Start */) {
68354
68392
  const container = flow.node;
68355
- if (container && container !== flowContainer && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) {
68393
+ if (container && container !== flowContainer && !inLambdaArg && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) {
68356
68394
  flow = container.flowNode;
68357
68395
  continue;
68358
68396
  }
68359
68397
  type = initialType;
68360
68398
  } else {
68361
- type = convertAutoToAny(declaredType);
68399
+ type = inLambdaArg ? initialType : convertAutoToAny(declaredType);
68362
68400
  }
68363
68401
  if (sharedFlow) {
68364
68402
  sharedFlowNodes[sharedFlowCount] = sharedFlow;
@@ -68462,6 +68500,117 @@ function createTypeChecker(host) {
68462
68500
  }
68463
68501
  return void 0;
68464
68502
  }
68503
+ function getTypeAtFlowLambdaArgs(flow) {
68504
+ const flowType = getTypeAtFlowNode(flow.antecedent);
68505
+ const saveInitialType = initialType;
68506
+ initialType = getTypeFromFlowType(flowType);
68507
+ let lambdaTypes;
68508
+ if (initialType !== declaredType) {
68509
+ const saveInLambdaArg = inLambdaArg;
68510
+ inLambdaArg = true;
68511
+ const args = flow.node.arguments;
68512
+ let signatures;
68513
+ for (let i = 0; i < args.length; i++) {
68514
+ const lambda = getLambdaArgument(args[i]);
68515
+ if (lambda && lambda.returnFlowNode && isMutationFlowNode(
68516
+ lambda.returnFlowNode,
68517
+ /*noCacheCheck*/
68518
+ false
68519
+ )) {
68520
+ signatures ?? (signatures = getSignaturesOfType(getTypeOfExpression(flow.node.expression), 0 /* Call */));
68521
+ if (!some(signatures, (sig) => !!(getObjectFlags(getTypeAtPosition(sig, i)) & 268435456 /* DeferredCallback */))) {
68522
+ const lambdaType = getTypeFromFlowType(getTypeAtFlowNode(lambda.returnFlowNode));
68523
+ if (lambdaType !== initialType) {
68524
+ lambdaTypes ?? (lambdaTypes = [initialType]);
68525
+ lambdaTypes.push(lambdaType);
68526
+ }
68527
+ }
68528
+ }
68529
+ }
68530
+ inLambdaArg = saveInLambdaArg;
68531
+ }
68532
+ initialType = saveInitialType;
68533
+ return lambdaTypes ? createFlowType(getUnionOrEvolvingArrayType(lambdaTypes, 1 /* Literal */), isIncomplete(flowType)) : flowType;
68534
+ }
68535
+ function isMutationFlowNode(flow, noCacheCheck) {
68536
+ while (true) {
68537
+ const flags = flow.flags;
68538
+ if (flags & 8192 /* Shared */) {
68539
+ if (!noCacheCheck) {
68540
+ let cached = getMutationStateForFlowNode(flow);
68541
+ if (cached === void 0) {
68542
+ setMutationStateForFlowNode(flow, cached = isMutationFlowNode(
68543
+ flow,
68544
+ /*noCacheCheck*/
68545
+ true
68546
+ ));
68547
+ }
68548
+ return cached;
68549
+ }
68550
+ noCacheCheck = false;
68551
+ }
68552
+ if (flags & 16 /* Assignment */) {
68553
+ if (isOrContainsMatchingReference(reference, flow.node)) {
68554
+ return true;
68555
+ }
68556
+ } else if (flags & 4 /* BranchLabel */) {
68557
+ return some(flow.antecedent, (f) => isMutationFlowNode(
68558
+ f,
68559
+ /*noCacheCheck*/
68560
+ false
68561
+ ));
68562
+ } else if (flags & 8 /* LoopLabel */) {
68563
+ let cached = getMutationStateForFlowNode(flow);
68564
+ if (cached === void 0) {
68565
+ const index = setMutationStateForFlowNode(flow, false);
68566
+ cached = mutationFlowStates[index] = some(flow.antecedent, (f) => isMutationFlowNode(
68567
+ f,
68568
+ /*noCacheCheck*/
68569
+ false
68570
+ ));
68571
+ }
68572
+ return cached;
68573
+ } else if (flags & 256 /* ArrayMutation */) {
68574
+ if (declaredType === autoType || declaredType === autoArrayType) {
68575
+ const node = flow.node;
68576
+ const expr = node.kind === 213 /* CallExpression */ ? node.expression.expression : node.left.expression;
68577
+ if (isMatchingReference(reference, getReferenceCandidate(expr))) {
68578
+ return true;
68579
+ }
68580
+ }
68581
+ } else if (flags & 2048 /* LambdaArgs */) {
68582
+ const mutation = some(flow.node.arguments, (arg) => {
68583
+ const lambda = getLambdaArgument(arg);
68584
+ return !!(lambda && lambda.returnFlowNode && isMutationFlowNode(
68585
+ lambda.returnFlowNode,
68586
+ /*noCacheCheck*/
68587
+ false
68588
+ ));
68589
+ });
68590
+ if (mutation) {
68591
+ return true;
68592
+ }
68593
+ } else if (!(flags & (512 /* Call */ | 96 /* Condition */ | 128 /* SwitchClause */ | 1024 /* ReduceLabel */))) {
68594
+ return false;
68595
+ }
68596
+ flow = flow.antecedent;
68597
+ }
68598
+ }
68599
+ function getMutationStateForFlowNode(flow) {
68600
+ for (let i = mutationFlowStart; i < mutationFlowCount; i++) {
68601
+ if (mutationFlowNodes[i] === flow) {
68602
+ return mutationFlowStates[i];
68603
+ }
68604
+ }
68605
+ return void 0;
68606
+ }
68607
+ function setMutationStateForFlowNode(flow, state) {
68608
+ const index = mutationFlowCount;
68609
+ mutationFlowNodes[index] = flow;
68610
+ mutationFlowStates[index] = state;
68611
+ mutationFlowCount++;
68612
+ return index;
68613
+ }
68465
68614
  function getTypeAtFlowArrayMutation(flow) {
68466
68615
  if (declaredType === autoType || declaredType === autoArrayType) {
68467
68616
  const node = flow.node;
@@ -73466,20 +73615,7 @@ function createTypeChecker(host) {
73466
73615
  }
73467
73616
  }
73468
73617
  const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, accessFlags, node) || errorType;
73469
- const result = checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
73470
- if (!isErrorType(result)) {
73471
- return result;
73472
- }
73473
- if (isEntityNameExpression(indexExpression)) {
73474
- const fallback = getResolvedEntityNameUniqueSymbolType(indexExpression);
73475
- if (fallback) {
73476
- const indexedAccessType2 = getIndexedAccessTypeOrUndefined(objectType, fallback, accessFlags) || errorType;
73477
- if (!isErrorType(indexedAccessType2) && !(indexedAccessType2.flags & 8388608 /* IndexedAccess */ && indexedAccessType2.objectType === objectType && indexedAccessType2.indexType === fallback)) {
73478
- return getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType2, indexExpression, checkMode);
73479
- }
73480
- }
73481
- }
73482
- return result;
73618
+ return checkIndexedAccessIndexType(getFlowTypeOfAccessExpression(node, getNodeLinks(node).resolvedSymbol, indexedAccessType, indexExpression, checkMode), node);
73483
73619
  }
73484
73620
  function callLikeExpressionMayHaveTypeArguments(node) {
73485
73621
  return isCallOrNewExpression(node) || isTaggedTemplateExpression(node) || isJsxOpeningLikeElement(node);
@@ -75727,49 +75863,13 @@ function createTypeChecker(host) {
75727
75863
  checkSourceElement(node.type);
75728
75864
  return checkSatisfiesExpressionWorker(node.expression, node.type);
75729
75865
  }
75730
- function getResolvedEntityNameUniqueSymbolType(expression) {
75731
- const links = getNodeLinks(expression);
75732
- if (!links.uniqueSymbollFallback) {
75733
- let resolved = resolveEntityName(
75734
- expression,
75735
- 111551 /* Value */ | 1048576 /* ExportValue */,
75736
- /*ignoreErrors*/
75737
- true
75738
- );
75739
- if (!resolved || resolved === unknownSymbol) {
75740
- resolved = resolveEntityName(
75741
- expression,
75742
- 111551 /* Value */ | 1048576 /* ExportValue */,
75743
- /*ignoreErrors*/
75744
- true,
75745
- /*dontResolveAlias*/
75746
- true
75747
- );
75748
- }
75749
- if (resolved) {
75750
- links.uniqueSymbollFallback = getUniqueESSymbolTypeForSymbol(resolved);
75751
- } else {
75752
- links.uniqueSymbollFallback = false;
75753
- }
75754
- }
75755
- return links.uniqueSymbollFallback || void 0;
75756
- }
75757
75866
  function checkSatisfiesExpressionWorker(expression, target, checkMode) {
75758
75867
  const exprType = checkExpression(expression, checkMode);
75759
- const errorNode = findAncestor(target.parent, (n) => n.kind === 238 /* SatisfiesExpression */ || n.kind === 350 /* JSDocSatisfiesTag */);
75760
- if (target.kind === 143 /* KeyOfKeyword */ && isComputedPropertyName(expression.parent.parent)) {
75761
- if (!(exprType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
75762
- error(expression, Diagnostics.A_satisfies_keyof_computed_property_name_must_be_exactly_a_single_string_number_or_unique_symbol_literal_type);
75763
- if (isEntityNameExpression(expression)) {
75764
- return getResolvedEntityNameUniqueSymbolType(expression) || exprType;
75765
- }
75766
- }
75767
- return exprType;
75768
- }
75769
75868
  const targetType = getTypeFromTypeNode(target);
75770
75869
  if (isErrorType(targetType)) {
75771
75870
  return targetType;
75772
75871
  }
75872
+ const errorNode = findAncestor(target.parent, (n) => n.kind === 238 /* SatisfiesExpression */ || n.kind === 350 /* JSDocSatisfiesTag */);
75773
75873
  checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, errorNode, expression, Diagnostics.Type_0_does_not_satisfy_the_expected_type_1);
75774
75874
  return exprType;
75775
75875
  }
@@ -111595,7 +111695,7 @@ function transformDeclarations(context) {
111595
111695
  if (isDeclarationAndNotVisible(input)) return;
111596
111696
  if (hasDynamicName(input)) {
111597
111697
  if (isolatedDeclarations) {
111598
- if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression) && !isSatisfiesKeyofExpression(input.name.expression)) {
111698
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
111599
111699
  if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
111600
111700
  context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
111601
111701
  return;
@@ -111607,7 +111707,7 @@ function transformDeclarations(context) {
111607
111707
  return;
111608
111708
  }
111609
111709
  }
111610
- } else if (!resolver.isLateBound(getParseTreeNode(input)) || !(isEntityNameExpression(input.name.expression) || isSatisfiesKeyofExpression(input.name.expression))) {
111710
+ } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
111611
111711
  return;
111612
111712
  }
111613
111713
  }
@@ -111878,10 +111978,7 @@ function transformDeclarations(context) {
111878
111978
  return cleanup(visitEachChild(input, visitDeclarationSubtree, context));
111879
111979
  function cleanup(returnValue) {
111880
111980
  if (returnValue && canProduceDiagnostic && hasDynamicName(input)) {
111881
- const updated = checkName(input, returnValue);
111882
- if (updated) {
111883
- returnValue = updated;
111884
- }
111981
+ checkName(input);
111885
111982
  }
111886
111983
  if (isEnclosingDeclaration(input)) {
111887
111984
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -112390,7 +112487,7 @@ function transformDeclarations(context) {
112390
112487
  }
112391
112488
  }
112392
112489
  }
112393
- function checkName(node, returnValue) {
112490
+ function checkName(node) {
112394
112491
  let oldDiag;
112395
112492
  if (!suppressNewDiagnosticContexts) {
112396
112493
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -112400,21 +112497,11 @@ function transformDeclarations(context) {
112400
112497
  Debug.assert(hasDynamicName(node));
112401
112498
  const decl = node;
112402
112499
  const entityName = decl.name.expression;
112403
- const nameExpr = isEntityNameExpression(entityName) ? entityName : entityName.expression;
112404
- checkEntityNameVisibility(nameExpr, enclosingDeclaration);
112405
- let result = returnValue;
112406
- if (returnValue && nameExpr !== entityName) {
112407
- const updated = factory2.updateComputedPropertyName(decl.name, nameExpr);
112408
- result = factory2.cloneNode(returnValue);
112409
- result.name = updated;
112410
- }
112500
+ checkEntityNameVisibility(entityName, enclosingDeclaration);
112411
112501
  if (!suppressNewDiagnosticContexts) {
112412
112502
  getSymbolAccessibilityDiagnostic = oldDiag;
112413
112503
  }
112414
112504
  errorNameNode = void 0;
112415
- if (result !== returnValue) {
112416
- return result;
112417
- }
112418
112505
  }
112419
112506
  function shouldStripInternal(node) {
112420
112507
  return !!stripInternal && !!node && isInternalDeclaration(node, currentSourceFile);