@typescript-deploys/pr-build 5.6.0-pr-59421-2 → 5.6.0-pr-55887-54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.6";
21
- var version = `${versionMajorMinor}.0-insiders.20240725`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240726`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6703,6 +6703,7 @@ var Diagnostics = {
6703
6703
  This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
6704
6704
  This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
6705
6705
  This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
6706
+ Variable_0_is_used_but_never_initialized: diag(2874, 1 /* Error */, "Variable_0_is_used_but_never_initialized_2874", "Variable '{0}' is used but never initialized."),
6706
6707
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6707
6708
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6708
6709
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -17121,6 +17122,9 @@ function accessKind(node) {
17121
17122
  return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
17122
17123
  case 209 /* ArrayLiteralExpression */:
17123
17124
  return accessKind(parent);
17125
+ case 249 /* ForInStatement */:
17126
+ case 250 /* ForOfStatement */:
17127
+ return node === parent.initializer ? 1 /* Write */ : 0 /* Read */;
17124
17128
  default:
17125
17129
  return 0 /* Read */;
17126
17130
  }
@@ -17260,6 +17264,7 @@ function Symbol4(flags, name) {
17260
17264
  this.constEnumOnlyModule = void 0;
17261
17265
  this.isReferenced = void 0;
17262
17266
  this.lastAssignmentPos = void 0;
17267
+ this.isDefinitelyAssigned = void 0;
17263
17268
  this.links = void 0;
17264
17269
  }
17265
17270
  function Type3(checker, flags) {
@@ -45471,6 +45476,7 @@ function createTypeChecker(host) {
45471
45476
  getNonOptionalType: removeOptionalTypeMarker,
45472
45477
  getTypeArguments,
45473
45478
  typeToTypeNode: nodeBuilder.typeToTypeNode,
45479
+ typePredicateToTypePredicateNode: nodeBuilder.typePredicateToTypePredicateNode,
45474
45480
  indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
45475
45481
  signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
45476
45482
  symbolToEntityName: nodeBuilder.symbolToEntityName,
@@ -45741,11 +45747,16 @@ function createTypeChecker(host) {
45741
45747
  checkSourceFileWithEagerDiagnostics(file);
45742
45748
  Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
45743
45749
  diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
45744
- checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
45745
- if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
45746
- (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
45747
- }
45748
- });
45750
+ checkUnusedOrUninitializedIdentifiers(
45751
+ getPotentiallyUnusedOrUninitializedIdentifiers(file),
45752
+ (containingNode, kind, diag2) => {
45753
+ if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
45754
+ (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
45755
+ }
45756
+ },
45757
+ /*checkUnused*/
45758
+ true
45759
+ );
45749
45760
  return diagnostics2 || emptyArray;
45750
45761
  } finally {
45751
45762
  cancellationToken = void 0;
@@ -46238,7 +46249,7 @@ function createTypeChecker(host) {
46238
46249
  var deferredGlobalClassAccessorDecoratorTargetType;
46239
46250
  var deferredGlobalClassAccessorDecoratorResultType;
46240
46251
  var deferredGlobalClassFieldDecoratorContextType;
46241
- var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
46252
+ var allPotentiallyUnusedOrUninitializedIdentifiers = /* @__PURE__ */ new Map();
46242
46253
  var flowLoopStart = 0;
46243
46254
  var flowLoopCount = 0;
46244
46255
  var sharedFlowCount = 0;
@@ -67789,6 +67800,9 @@ function createTypeChecker(host) {
67789
67800
  return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
67790
67801
  }
67791
67802
  function isFunctionObjectType(type) {
67803
+ if (getObjectFlags(type) & 256 /* EvolvingArray */) {
67804
+ return false;
67805
+ }
67792
67806
  const resolved = resolveStructuredTypeMembers(type);
67793
67807
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
67794
67808
  }
@@ -69572,6 +69586,9 @@ function createTypeChecker(host) {
69572
69586
  void 0
69573
69587
  );
69574
69588
  }
69589
+ function isSymbolAssignedDefinitely(symbol) {
69590
+ return symbol.isDefinitelyAssigned ?? (isSymbolAssigned(symbol) && symbol.isDefinitelyAssigned);
69591
+ }
69575
69592
  function isPastLastAssignment(symbol, location) {
69576
69593
  const parent = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69577
69594
  if (!parent) {
@@ -69582,6 +69599,7 @@ function createTypeChecker(host) {
69582
69599
  links.flags |= 131072 /* AssignmentsMarked */;
69583
69600
  if (!hasParentWithAssignmentsMarked(parent)) {
69584
69601
  markNodeAssignments(parent);
69602
+ symbol.isDefinitelyAssigned ?? (symbol.isDefinitelyAssigned = false);
69585
69603
  }
69586
69604
  }
69587
69605
  return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
@@ -69605,12 +69623,18 @@ function createTypeChecker(host) {
69605
69623
  function markNodeAssignments(node) {
69606
69624
  switch (node.kind) {
69607
69625
  case 80 /* Identifier */:
69608
- if (isAssignmentTarget(node)) {
69626
+ const assignmentKind = getAssignmentTargetKind(node);
69627
+ if (assignmentKind !== 0 /* None */) {
69609
69628
  const symbol = getResolvedSymbol(node);
69610
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
69611
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
69612
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69613
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
69629
+ if (isParameterOrMutableLocalVariable(symbol)) {
69630
+ if (assignmentKind === 1 /* Definite */) {
69631
+ symbol.isDefinitelyAssigned = true;
69632
+ }
69633
+ if (symbol.lastAssignmentPos !== Number.MAX_VALUE) {
69634
+ const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
69635
+ const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69636
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
69637
+ }
69614
69638
  }
69615
69639
  }
69616
69640
  return;
@@ -79160,7 +79184,7 @@ function createTypeChecker(host) {
79160
79184
  }
79161
79185
  }
79162
79186
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 317 /* JSDocFunctionType */) {
79163
- registerForUnusedIdentifiersCheck(node);
79187
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
79164
79188
  }
79165
79189
  }
79166
79190
  }
@@ -79706,7 +79730,7 @@ function createTypeChecker(host) {
79706
79730
  }
79707
79731
  }
79708
79732
  }
79709
- registerForUnusedIdentifiersCheck(node);
79733
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
79710
79734
  }
79711
79735
  function checkTemplateLiteralType(node) {
79712
79736
  for (const span of node.templateSpans) {
@@ -80658,25 +80682,27 @@ function createTypeChecker(host) {
80658
80682
  }
80659
80683
  }
80660
80684
  }
80661
- function registerForUnusedIdentifiersCheck(node) {
80662
- addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
80663
- function registerForUnusedIdentifiersCheckDiagnostics() {
80685
+ function registerForUnusedOrUninitializedIdentifiersCheck(node) {
80686
+ addLazyDiagnostic(registerForUnusedOrUninitializedIdentifiersCheckDiagnostics);
80687
+ function registerForUnusedOrUninitializedIdentifiersCheckDiagnostics() {
80664
80688
  const sourceFile = getSourceFileOfNode(node);
80665
- let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
80666
- if (!potentiallyUnusedIdentifiers) {
80667
- potentiallyUnusedIdentifiers = [];
80668
- allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
80689
+ let potentiallyUnusedOrUninitializedIdentifiers = allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path);
80690
+ if (!potentiallyUnusedOrUninitializedIdentifiers) {
80691
+ potentiallyUnusedOrUninitializedIdentifiers = [];
80692
+ allPotentiallyUnusedOrUninitializedIdentifiers.set(sourceFile.path, potentiallyUnusedOrUninitializedIdentifiers);
80669
80693
  }
80670
- potentiallyUnusedIdentifiers.push(node);
80694
+ potentiallyUnusedOrUninitializedIdentifiers.push(node);
80671
80695
  }
80672
80696
  }
80673
- function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
80697
+ function checkUnusedOrUninitializedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic, checkUnused, checkUninitialized) {
80674
80698
  for (const node of potentiallyUnusedIdentifiers) {
80675
80699
  switch (node.kind) {
80676
80700
  case 263 /* ClassDeclaration */:
80677
80701
  case 231 /* ClassExpression */:
80678
- checkUnusedClassMembers(node, addDiagnostic);
80679
- checkUnusedTypeParameters(node, addDiagnostic);
80702
+ if (checkUnused) {
80703
+ checkUnusedClassMembers(node, addDiagnostic);
80704
+ checkUnusedTypeParameters(node, addDiagnostic);
80705
+ }
80680
80706
  break;
80681
80707
  case 307 /* SourceFile */:
80682
80708
  case 267 /* ModuleDeclaration */:
@@ -80685,7 +80711,12 @@ function createTypeChecker(host) {
80685
80711
  case 248 /* ForStatement */:
80686
80712
  case 249 /* ForInStatement */:
80687
80713
  case 250 /* ForOfStatement */:
80688
- checkUnusedLocalsAndParameters(node, addDiagnostic);
80714
+ if (checkUnused) {
80715
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
80716
+ }
80717
+ if (checkUninitialized) {
80718
+ checkUninitializedLocals(node);
80719
+ }
80689
80720
  break;
80690
80721
  case 176 /* Constructor */:
80691
80722
  case 218 /* FunctionExpression */:
@@ -80694,10 +80725,15 @@ function createTypeChecker(host) {
80694
80725
  case 174 /* MethodDeclaration */:
80695
80726
  case 177 /* GetAccessor */:
80696
80727
  case 178 /* SetAccessor */:
80697
- if (node.body) {
80698
- checkUnusedLocalsAndParameters(node, addDiagnostic);
80728
+ if (checkUnused) {
80729
+ if (node.body) {
80730
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
80731
+ }
80732
+ checkUnusedTypeParameters(node, addDiagnostic);
80733
+ }
80734
+ if (checkUninitialized) {
80735
+ checkUninitializedLocals(node);
80699
80736
  }
80700
- checkUnusedTypeParameters(node, addDiagnostic);
80701
80737
  break;
80702
80738
  case 173 /* MethodSignature */:
80703
80739
  case 179 /* CallSignature */:
@@ -80706,10 +80742,14 @@ function createTypeChecker(host) {
80706
80742
  case 185 /* ConstructorType */:
80707
80743
  case 265 /* TypeAliasDeclaration */:
80708
80744
  case 264 /* InterfaceDeclaration */:
80709
- checkUnusedTypeParameters(node, addDiagnostic);
80745
+ if (checkUnused) {
80746
+ checkUnusedTypeParameters(node, addDiagnostic);
80747
+ }
80710
80748
  break;
80711
80749
  case 195 /* InferType */:
80712
- checkUnusedInferTypeParameter(node, addDiagnostic);
80750
+ if (checkUnused) {
80751
+ checkUnusedInferTypeParameter(node, addDiagnostic);
80752
+ }
80713
80753
  break;
80714
80754
  default:
80715
80755
  Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
@@ -80896,6 +80936,21 @@ function createTypeChecker(host) {
80896
80936
  }
80897
80937
  });
80898
80938
  }
80939
+ function checkUninitializedLocals(nodeWithLocals) {
80940
+ nodeWithLocals.locals.forEach((local) => {
80941
+ if (!(local.flags & 3 /* Variable */) || !local.isReferenced || isSymbolAssignedDefinitely(local)) {
80942
+ return;
80943
+ }
80944
+ const declaration = local.valueDeclaration;
80945
+ if (!declaration || !isVariableDeclaration(declaration) || !(getCombinedNodeFlagsCached(declaration) & 1 /* Let */) || getCombinedNodeFlagsCached(declaration) & 33554432 /* Ambient */ || declaration.exclamationToken || declaration.initializer || !declaration.type) {
80946
+ return;
80947
+ }
80948
+ const type = getTypeFromTypeNode(declaration.type);
80949
+ if (!(type.flags & 3 /* AnyOrUnknown */) && !containsUndefinedType(type)) {
80950
+ error(declaration, Diagnostics.Variable_0_is_used_but_never_initialized, idText(declaration.name));
80951
+ }
80952
+ });
80953
+ }
80899
80954
  function checkPotentialUncheckedRenamedBindingElementsInTypes() {
80900
80955
  var _a;
80901
80956
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
@@ -80942,7 +80997,7 @@ function createTypeChecker(host) {
80942
80997
  forEach(node.statements, checkSourceElement);
80943
80998
  }
80944
80999
  if (node.locals) {
80945
- registerForUnusedIdentifiersCheck(node);
81000
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
80946
81001
  }
80947
81002
  }
80948
81003
  function checkCollisionWithArgumentsInGeneratedCode(node) {
@@ -81532,7 +81587,7 @@ function createTypeChecker(host) {
81532
81587
  if (node.incrementor) checkExpression(node.incrementor);
81533
81588
  checkSourceElement(node.statement);
81534
81589
  if (node.locals) {
81535
- registerForUnusedIdentifiersCheck(node);
81590
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
81536
81591
  }
81537
81592
  }
81538
81593
  function checkForOfStatement(node) {
@@ -81571,7 +81626,7 @@ function createTypeChecker(host) {
81571
81626
  }
81572
81627
  checkSourceElement(node.statement);
81573
81628
  if (node.locals) {
81574
- registerForUnusedIdentifiersCheck(node);
81629
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
81575
81630
  }
81576
81631
  }
81577
81632
  function checkForInStatement(node) {
@@ -81603,7 +81658,7 @@ function createTypeChecker(host) {
81603
81658
  }
81604
81659
  checkSourceElement(node.statement);
81605
81660
  if (node.locals) {
81606
- registerForUnusedIdentifiersCheck(node);
81661
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
81607
81662
  }
81608
81663
  }
81609
81664
  function checkRightHandSideOfForOf(statement) {
@@ -82289,7 +82344,7 @@ function createTypeChecker(host) {
82289
82344
  }
82290
82345
  });
82291
82346
  if (node.caseBlock.locals) {
82292
- registerForUnusedIdentifiersCheck(node.caseBlock);
82347
+ registerForUnusedOrUninitializedIdentifiersCheck(node.caseBlock);
82293
82348
  }
82294
82349
  }
82295
82350
  function checkLabeledStatement(node) {
@@ -82626,7 +82681,7 @@ function createTypeChecker(host) {
82626
82681
  }
82627
82682
  function checkClassExpressionDeferred(node) {
82628
82683
  forEach(node.members, checkSourceElement);
82629
- registerForUnusedIdentifiersCheck(node);
82684
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
82630
82685
  }
82631
82686
  function checkClassDeclaration(node) {
82632
82687
  const firstDecorator = find(node.modifiers, isDecorator);
@@ -82638,7 +82693,7 @@ function createTypeChecker(host) {
82638
82693
  }
82639
82694
  checkClassLikeDeclaration(node);
82640
82695
  forEach(node.members, checkSourceElement);
82641
- registerForUnusedIdentifiersCheck(node);
82696
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
82642
82697
  }
82643
82698
  function checkClassLikeDeclaration(node) {
82644
82699
  checkGrammarClassLikeDeclaration(node);
@@ -83194,7 +83249,7 @@ function createTypeChecker(host) {
83194
83249
  forEach(node.members, checkSourceElement);
83195
83250
  addLazyDiagnostic(() => {
83196
83251
  checkTypeForDuplicateIndexSignatures(node);
83197
- registerForUnusedIdentifiersCheck(node);
83252
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
83198
83253
  });
83199
83254
  }
83200
83255
  function checkTypeAliasDeclaration(node) {
@@ -83210,7 +83265,7 @@ function createTypeChecker(host) {
83210
83265
  }
83211
83266
  } else {
83212
83267
  checkSourceElement(node.type);
83213
- registerForUnusedIdentifiersCheck(node);
83268
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
83214
83269
  }
83215
83270
  }
83216
83271
  function computeEnumMemberValues(node) {
@@ -83472,7 +83527,7 @@ function createTypeChecker(host) {
83472
83527
  if (node.body) {
83473
83528
  checkSourceElement(node.body);
83474
83529
  if (!isGlobalScopeAugmentation(node)) {
83475
- registerForUnusedIdentifiersCheck(node);
83530
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
83476
83531
  }
83477
83532
  }
83478
83533
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
@@ -84517,8 +84572,8 @@ function createTypeChecker(host) {
84517
84572
  return Debug.assertNever(kind);
84518
84573
  }
84519
84574
  }
84520
- function getPotentiallyUnusedIdentifiers(sourceFile) {
84521
- return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
84575
+ function getPotentiallyUnusedOrUninitializedIdentifiers(sourceFile) {
84576
+ return allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path) || emptyArray;
84522
84577
  }
84523
84578
  function checkSourceFileWorker(node) {
84524
84579
  const links = getNodeLinks(node);
@@ -84543,15 +84598,21 @@ function createTypeChecker(host) {
84543
84598
  checkSourceElement(node.endOfFileToken);
84544
84599
  checkDeferredNodes(node);
84545
84600
  if (isExternalOrCommonJsModule(node)) {
84546
- registerForUnusedIdentifiersCheck(node);
84601
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
84547
84602
  }
84548
84603
  addLazyDiagnostic(() => {
84549
- if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
84550
- checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
84551
- if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
84552
- diagnostics.add(diag2);
84553
- }
84554
- });
84604
+ const checkUnused = !node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters);
84605
+ if (checkUnused || strictNullChecks) {
84606
+ checkUnusedOrUninitializedIdentifiers(
84607
+ getPotentiallyUnusedOrUninitializedIdentifiers(node),
84608
+ (containingNode, kind, diag2) => {
84609
+ if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
84610
+ diagnostics.add(diag2);
84611
+ }
84612
+ },
84613
+ checkUnused,
84614
+ strictNullChecks
84615
+ );
84555
84616
  }
84556
84617
  if (!node.isDeclarationFile) {
84557
84618
  checkPotentialUncheckedRenamedBindingElementsInTypes();
@@ -3268,6 +3268,7 @@ declare namespace ts {
3268
3268
  private delayUpdateProjectsOfScriptInfoPath;
3269
3269
  private handleDeletedFile;
3270
3270
  private watchWildcardDirectory;
3271
+ private onWildCardDirectoryWatcherInvoke;
3271
3272
  private delayUpdateProjectsFromParsedConfigOnConfigFileChange;
3272
3273
  private onConfigFileChanged;
3273
3274
  private removeProject;
@@ -3338,6 +3339,7 @@ declare namespace ts {
3338
3339
  private ensureProjectChildren;
3339
3340
  private cleanupConfiguredProjects;
3340
3341
  private cleanupProjectsAndScriptInfos;
3342
+ private tryInvokeWildCardDirectories;
3341
3343
  openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
3342
3344
  private removeOrphanScriptInfos;
3343
3345
  private telemetryOnOpenFile;
package/lib/typescript.js CHANGED
@@ -2259,7 +2259,7 @@ module.exports = __toCommonJS(typescript_exports);
2259
2259
 
2260
2260
  // src/compiler/corePublic.ts
2261
2261
  var versionMajorMinor = "5.6";
2262
- var version = `${versionMajorMinor}.0-insiders.20240725`;
2262
+ var version = `${versionMajorMinor}.0-insiders.20240726`;
2263
2263
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2264
2264
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2265
2265
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10099,6 +10099,7 @@ var Diagnostics = {
10099
10099
  This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
10100
10100
  This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
10101
10101
  This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
10102
+ Variable_0_is_used_but_never_initialized: diag(2874, 1 /* Error */, "Variable_0_is_used_but_never_initialized_2874", "Variable '{0}' is used but never initialized."),
10102
10103
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10103
10104
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10104
10105
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -21011,6 +21012,9 @@ function accessKind(node) {
21011
21012
  return node === parent2.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent2.parent);
21012
21013
  case 209 /* ArrayLiteralExpression */:
21013
21014
  return accessKind(parent2);
21015
+ case 249 /* ForInStatement */:
21016
+ case 250 /* ForOfStatement */:
21017
+ return node === parent2.initializer ? 1 /* Write */ : 0 /* Read */;
21014
21018
  default:
21015
21019
  return 0 /* Read */;
21016
21020
  }
@@ -21209,6 +21213,7 @@ function Symbol4(flags, name) {
21209
21213
  this.constEnumOnlyModule = void 0;
21210
21214
  this.isReferenced = void 0;
21211
21215
  this.lastAssignmentPos = void 0;
21216
+ this.isDefinitelyAssigned = void 0;
21212
21217
  this.links = void 0;
21213
21218
  }
21214
21219
  function Type3(checker, flags) {
@@ -50089,6 +50094,7 @@ function createTypeChecker(host) {
50089
50094
  getNonOptionalType: removeOptionalTypeMarker,
50090
50095
  getTypeArguments,
50091
50096
  typeToTypeNode: nodeBuilder.typeToTypeNode,
50097
+ typePredicateToTypePredicateNode: nodeBuilder.typePredicateToTypePredicateNode,
50092
50098
  indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration,
50093
50099
  signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration,
50094
50100
  symbolToEntityName: nodeBuilder.symbolToEntityName,
@@ -50359,11 +50365,16 @@ function createTypeChecker(host) {
50359
50365
  checkSourceFileWithEagerDiagnostics(file);
50360
50366
  Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
50361
50367
  diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
50362
- checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
50363
- if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
50364
- (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
50365
- }
50366
- });
50368
+ checkUnusedOrUninitializedIdentifiers(
50369
+ getPotentiallyUnusedOrUninitializedIdentifiers(file),
50370
+ (containingNode, kind, diag2) => {
50371
+ if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
50372
+ (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
50373
+ }
50374
+ },
50375
+ /*checkUnused*/
50376
+ true
50377
+ );
50367
50378
  return diagnostics2 || emptyArray;
50368
50379
  } finally {
50369
50380
  cancellationToken = void 0;
@@ -50856,7 +50867,7 @@ function createTypeChecker(host) {
50856
50867
  var deferredGlobalClassAccessorDecoratorTargetType;
50857
50868
  var deferredGlobalClassAccessorDecoratorResultType;
50858
50869
  var deferredGlobalClassFieldDecoratorContextType;
50859
- var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
50870
+ var allPotentiallyUnusedOrUninitializedIdentifiers = /* @__PURE__ */ new Map();
50860
50871
  var flowLoopStart = 0;
50861
50872
  var flowLoopCount = 0;
50862
50873
  var sharedFlowCount = 0;
@@ -72407,6 +72418,9 @@ function createTypeChecker(host) {
72407
72418
  return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
72408
72419
  }
72409
72420
  function isFunctionObjectType(type) {
72421
+ if (getObjectFlags(type) & 256 /* EvolvingArray */) {
72422
+ return false;
72423
+ }
72410
72424
  const resolved = resolveStructuredTypeMembers(type);
72411
72425
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
72412
72426
  }
@@ -74190,6 +74204,9 @@ function createTypeChecker(host) {
74190
74204
  void 0
74191
74205
  );
74192
74206
  }
74207
+ function isSymbolAssignedDefinitely(symbol) {
74208
+ return symbol.isDefinitelyAssigned ?? (isSymbolAssigned(symbol) && symbol.isDefinitelyAssigned);
74209
+ }
74193
74210
  function isPastLastAssignment(symbol, location) {
74194
74211
  const parent2 = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74195
74212
  if (!parent2) {
@@ -74200,6 +74217,7 @@ function createTypeChecker(host) {
74200
74217
  links.flags |= 131072 /* AssignmentsMarked */;
74201
74218
  if (!hasParentWithAssignmentsMarked(parent2)) {
74202
74219
  markNodeAssignments(parent2);
74220
+ symbol.isDefinitelyAssigned ?? (symbol.isDefinitelyAssigned = false);
74203
74221
  }
74204
74222
  }
74205
74223
  return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
@@ -74223,12 +74241,18 @@ function createTypeChecker(host) {
74223
74241
  function markNodeAssignments(node) {
74224
74242
  switch (node.kind) {
74225
74243
  case 80 /* Identifier */:
74226
- if (isAssignmentTarget(node)) {
74244
+ const assignmentKind = getAssignmentTargetKind(node);
74245
+ if (assignmentKind !== 0 /* None */) {
74227
74246
  const symbol = getResolvedSymbol(node);
74228
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
74229
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
74230
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74231
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
74247
+ if (isParameterOrMutableLocalVariable(symbol)) {
74248
+ if (assignmentKind === 1 /* Definite */) {
74249
+ symbol.isDefinitelyAssigned = true;
74250
+ }
74251
+ if (symbol.lastAssignmentPos !== Number.MAX_VALUE) {
74252
+ const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
74253
+ const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74254
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
74255
+ }
74232
74256
  }
74233
74257
  }
74234
74258
  return;
@@ -83778,7 +83802,7 @@ function createTypeChecker(host) {
83778
83802
  }
83779
83803
  }
83780
83804
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 317 /* JSDocFunctionType */) {
83781
- registerForUnusedIdentifiersCheck(node);
83805
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
83782
83806
  }
83783
83807
  }
83784
83808
  }
@@ -84324,7 +84348,7 @@ function createTypeChecker(host) {
84324
84348
  }
84325
84349
  }
84326
84350
  }
84327
- registerForUnusedIdentifiersCheck(node);
84351
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
84328
84352
  }
84329
84353
  function checkTemplateLiteralType(node) {
84330
84354
  for (const span of node.templateSpans) {
@@ -85276,25 +85300,27 @@ function createTypeChecker(host) {
85276
85300
  }
85277
85301
  }
85278
85302
  }
85279
- function registerForUnusedIdentifiersCheck(node) {
85280
- addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
85281
- function registerForUnusedIdentifiersCheckDiagnostics() {
85303
+ function registerForUnusedOrUninitializedIdentifiersCheck(node) {
85304
+ addLazyDiagnostic(registerForUnusedOrUninitializedIdentifiersCheckDiagnostics);
85305
+ function registerForUnusedOrUninitializedIdentifiersCheckDiagnostics() {
85282
85306
  const sourceFile = getSourceFileOfNode(node);
85283
- let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
85284
- if (!potentiallyUnusedIdentifiers) {
85285
- potentiallyUnusedIdentifiers = [];
85286
- allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
85307
+ let potentiallyUnusedOrUninitializedIdentifiers = allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path);
85308
+ if (!potentiallyUnusedOrUninitializedIdentifiers) {
85309
+ potentiallyUnusedOrUninitializedIdentifiers = [];
85310
+ allPotentiallyUnusedOrUninitializedIdentifiers.set(sourceFile.path, potentiallyUnusedOrUninitializedIdentifiers);
85287
85311
  }
85288
- potentiallyUnusedIdentifiers.push(node);
85312
+ potentiallyUnusedOrUninitializedIdentifiers.push(node);
85289
85313
  }
85290
85314
  }
85291
- function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
85315
+ function checkUnusedOrUninitializedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic, checkUnused, checkUninitialized) {
85292
85316
  for (const node of potentiallyUnusedIdentifiers) {
85293
85317
  switch (node.kind) {
85294
85318
  case 263 /* ClassDeclaration */:
85295
85319
  case 231 /* ClassExpression */:
85296
- checkUnusedClassMembers(node, addDiagnostic);
85297
- checkUnusedTypeParameters(node, addDiagnostic);
85320
+ if (checkUnused) {
85321
+ checkUnusedClassMembers(node, addDiagnostic);
85322
+ checkUnusedTypeParameters(node, addDiagnostic);
85323
+ }
85298
85324
  break;
85299
85325
  case 307 /* SourceFile */:
85300
85326
  case 267 /* ModuleDeclaration */:
@@ -85303,7 +85329,12 @@ function createTypeChecker(host) {
85303
85329
  case 248 /* ForStatement */:
85304
85330
  case 249 /* ForInStatement */:
85305
85331
  case 250 /* ForOfStatement */:
85306
- checkUnusedLocalsAndParameters(node, addDiagnostic);
85332
+ if (checkUnused) {
85333
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
85334
+ }
85335
+ if (checkUninitialized) {
85336
+ checkUninitializedLocals(node);
85337
+ }
85307
85338
  break;
85308
85339
  case 176 /* Constructor */:
85309
85340
  case 218 /* FunctionExpression */:
@@ -85312,10 +85343,15 @@ function createTypeChecker(host) {
85312
85343
  case 174 /* MethodDeclaration */:
85313
85344
  case 177 /* GetAccessor */:
85314
85345
  case 178 /* SetAccessor */:
85315
- if (node.body) {
85316
- checkUnusedLocalsAndParameters(node, addDiagnostic);
85346
+ if (checkUnused) {
85347
+ if (node.body) {
85348
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
85349
+ }
85350
+ checkUnusedTypeParameters(node, addDiagnostic);
85351
+ }
85352
+ if (checkUninitialized) {
85353
+ checkUninitializedLocals(node);
85317
85354
  }
85318
- checkUnusedTypeParameters(node, addDiagnostic);
85319
85355
  break;
85320
85356
  case 173 /* MethodSignature */:
85321
85357
  case 179 /* CallSignature */:
@@ -85324,10 +85360,14 @@ function createTypeChecker(host) {
85324
85360
  case 185 /* ConstructorType */:
85325
85361
  case 265 /* TypeAliasDeclaration */:
85326
85362
  case 264 /* InterfaceDeclaration */:
85327
- checkUnusedTypeParameters(node, addDiagnostic);
85363
+ if (checkUnused) {
85364
+ checkUnusedTypeParameters(node, addDiagnostic);
85365
+ }
85328
85366
  break;
85329
85367
  case 195 /* InferType */:
85330
- checkUnusedInferTypeParameter(node, addDiagnostic);
85368
+ if (checkUnused) {
85369
+ checkUnusedInferTypeParameter(node, addDiagnostic);
85370
+ }
85331
85371
  break;
85332
85372
  default:
85333
85373
  Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
@@ -85514,6 +85554,21 @@ function createTypeChecker(host) {
85514
85554
  }
85515
85555
  });
85516
85556
  }
85557
+ function checkUninitializedLocals(nodeWithLocals) {
85558
+ nodeWithLocals.locals.forEach((local) => {
85559
+ if (!(local.flags & 3 /* Variable */) || !local.isReferenced || isSymbolAssignedDefinitely(local)) {
85560
+ return;
85561
+ }
85562
+ const declaration = local.valueDeclaration;
85563
+ if (!declaration || !isVariableDeclaration(declaration) || !(getCombinedNodeFlagsCached(declaration) & 1 /* Let */) || getCombinedNodeFlagsCached(declaration) & 33554432 /* Ambient */ || declaration.exclamationToken || declaration.initializer || !declaration.type) {
85564
+ return;
85565
+ }
85566
+ const type = getTypeFromTypeNode(declaration.type);
85567
+ if (!(type.flags & 3 /* AnyOrUnknown */) && !containsUndefinedType(type)) {
85568
+ error2(declaration, Diagnostics.Variable_0_is_used_but_never_initialized, idText(declaration.name));
85569
+ }
85570
+ });
85571
+ }
85517
85572
  function checkPotentialUncheckedRenamedBindingElementsInTypes() {
85518
85573
  var _a;
85519
85574
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
@@ -85560,7 +85615,7 @@ function createTypeChecker(host) {
85560
85615
  forEach(node.statements, checkSourceElement);
85561
85616
  }
85562
85617
  if (node.locals) {
85563
- registerForUnusedIdentifiersCheck(node);
85618
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
85564
85619
  }
85565
85620
  }
85566
85621
  function checkCollisionWithArgumentsInGeneratedCode(node) {
@@ -86150,7 +86205,7 @@ function createTypeChecker(host) {
86150
86205
  if (node.incrementor) checkExpression(node.incrementor);
86151
86206
  checkSourceElement(node.statement);
86152
86207
  if (node.locals) {
86153
- registerForUnusedIdentifiersCheck(node);
86208
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
86154
86209
  }
86155
86210
  }
86156
86211
  function checkForOfStatement(node) {
@@ -86189,7 +86244,7 @@ function createTypeChecker(host) {
86189
86244
  }
86190
86245
  checkSourceElement(node.statement);
86191
86246
  if (node.locals) {
86192
- registerForUnusedIdentifiersCheck(node);
86247
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
86193
86248
  }
86194
86249
  }
86195
86250
  function checkForInStatement(node) {
@@ -86221,7 +86276,7 @@ function createTypeChecker(host) {
86221
86276
  }
86222
86277
  checkSourceElement(node.statement);
86223
86278
  if (node.locals) {
86224
- registerForUnusedIdentifiersCheck(node);
86279
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
86225
86280
  }
86226
86281
  }
86227
86282
  function checkRightHandSideOfForOf(statement) {
@@ -86907,7 +86962,7 @@ function createTypeChecker(host) {
86907
86962
  }
86908
86963
  });
86909
86964
  if (node.caseBlock.locals) {
86910
- registerForUnusedIdentifiersCheck(node.caseBlock);
86965
+ registerForUnusedOrUninitializedIdentifiersCheck(node.caseBlock);
86911
86966
  }
86912
86967
  }
86913
86968
  function checkLabeledStatement(node) {
@@ -87244,7 +87299,7 @@ function createTypeChecker(host) {
87244
87299
  }
87245
87300
  function checkClassExpressionDeferred(node) {
87246
87301
  forEach(node.members, checkSourceElement);
87247
- registerForUnusedIdentifiersCheck(node);
87302
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
87248
87303
  }
87249
87304
  function checkClassDeclaration(node) {
87250
87305
  const firstDecorator = find(node.modifiers, isDecorator);
@@ -87256,7 +87311,7 @@ function createTypeChecker(host) {
87256
87311
  }
87257
87312
  checkClassLikeDeclaration(node);
87258
87313
  forEach(node.members, checkSourceElement);
87259
- registerForUnusedIdentifiersCheck(node);
87314
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
87260
87315
  }
87261
87316
  function checkClassLikeDeclaration(node) {
87262
87317
  checkGrammarClassLikeDeclaration(node);
@@ -87812,7 +87867,7 @@ function createTypeChecker(host) {
87812
87867
  forEach(node.members, checkSourceElement);
87813
87868
  addLazyDiagnostic(() => {
87814
87869
  checkTypeForDuplicateIndexSignatures(node);
87815
- registerForUnusedIdentifiersCheck(node);
87870
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
87816
87871
  });
87817
87872
  }
87818
87873
  function checkTypeAliasDeclaration(node) {
@@ -87828,7 +87883,7 @@ function createTypeChecker(host) {
87828
87883
  }
87829
87884
  } else {
87830
87885
  checkSourceElement(node.type);
87831
- registerForUnusedIdentifiersCheck(node);
87886
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
87832
87887
  }
87833
87888
  }
87834
87889
  function computeEnumMemberValues(node) {
@@ -88090,7 +88145,7 @@ function createTypeChecker(host) {
88090
88145
  if (node.body) {
88091
88146
  checkSourceElement(node.body);
88092
88147
  if (!isGlobalScopeAugmentation(node)) {
88093
- registerForUnusedIdentifiersCheck(node);
88148
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
88094
88149
  }
88095
88150
  }
88096
88151
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
@@ -89135,8 +89190,8 @@ function createTypeChecker(host) {
89135
89190
  return Debug.assertNever(kind);
89136
89191
  }
89137
89192
  }
89138
- function getPotentiallyUnusedIdentifiers(sourceFile) {
89139
- return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
89193
+ function getPotentiallyUnusedOrUninitializedIdentifiers(sourceFile) {
89194
+ return allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path) || emptyArray;
89140
89195
  }
89141
89196
  function checkSourceFileWorker(node) {
89142
89197
  const links = getNodeLinks(node);
@@ -89161,15 +89216,21 @@ function createTypeChecker(host) {
89161
89216
  checkSourceElement(node.endOfFileToken);
89162
89217
  checkDeferredNodes(node);
89163
89218
  if (isExternalOrCommonJsModule(node)) {
89164
- registerForUnusedIdentifiersCheck(node);
89219
+ registerForUnusedOrUninitializedIdentifiersCheck(node);
89165
89220
  }
89166
89221
  addLazyDiagnostic(() => {
89167
- if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
89168
- checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
89169
- if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
89170
- diagnostics.add(diag2);
89171
- }
89172
- });
89222
+ const checkUnused = !node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters);
89223
+ if (checkUnused || strictNullChecks) {
89224
+ checkUnusedOrUninitializedIdentifiers(
89225
+ getPotentiallyUnusedOrUninitializedIdentifiers(node),
89226
+ (containingNode, kind, diag2) => {
89227
+ if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
89228
+ diagnostics.add(diag2);
89229
+ }
89230
+ },
89231
+ checkUnused,
89232
+ strictNullChecks
89233
+ );
89173
89234
  }
89174
89235
  if (!node.isDeclarationFile) {
89175
89236
  checkPotentialUncheckedRenamedBindingElementsInTypes();
@@ -148186,7 +148247,27 @@ function getInfo4(context) {
148186
148247
  return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) };
148187
148248
  }
148188
148249
  const typeChecker = context.program.getTypeChecker();
148189
- const returnType = tryGetReturnType(typeChecker, declaration);
148250
+ let returnType;
148251
+ if (typeChecker.isImplementationOfOverload(declaration)) {
148252
+ const signatures = typeChecker.getTypeAtLocation(declaration).getCallSignatures();
148253
+ if (signatures.length > 1) {
148254
+ returnType = typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType()));
148255
+ }
148256
+ }
148257
+ if (!returnType) {
148258
+ const signature = typeChecker.getSignatureFromDeclaration(declaration);
148259
+ if (signature) {
148260
+ const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
148261
+ if (typePredicate && typePredicate.type) {
148262
+ const typePredicateTypeNode = typeChecker.typePredicateToTypePredicateNode(typePredicate, declaration, 1 /* NoTruncation */);
148263
+ if (typePredicateTypeNode) {
148264
+ return { declaration, returnTypeNode: typePredicateTypeNode };
148265
+ }
148266
+ } else {
148267
+ returnType = typeChecker.getReturnTypeOfSignature(signature);
148268
+ }
148269
+ }
148270
+ }
148190
148271
  if (!returnType) {
148191
148272
  return { error: getLocaleSpecificMessage(Diagnostics.Could_not_determine_function_return_type) };
148192
148273
  }
@@ -148206,18 +148287,6 @@ function isConvertibleDeclaration(node) {
148206
148287
  return false;
148207
148288
  }
148208
148289
  }
148209
- function tryGetReturnType(typeChecker, node) {
148210
- if (typeChecker.isImplementationOfOverload(node)) {
148211
- const signatures = typeChecker.getTypeAtLocation(node).getCallSignatures();
148212
- if (signatures.length > 1) {
148213
- return typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType()));
148214
- }
148215
- }
148216
- const signature = typeChecker.getSignatureFromDeclaration(node);
148217
- if (signature) {
148218
- return typeChecker.getReturnTypeOfSignature(signature);
148219
- }
148220
- }
148221
148290
 
148222
148291
  // src/services/classifier2020.ts
148223
148292
  var TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => {
@@ -150115,6 +150184,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150115
150184
  synchronizeHostData();
150116
150185
  Debug.assert(args.type === "file");
150117
150186
  const sourceFile = getValidSourceFile(args.fileName);
150187
+ if (containsParseError(sourceFile)) return emptyArray;
150118
150188
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
150119
150189
  const mode = args.mode ?? (args.skipDestructiveCodeActions ? "SortAndCombine" /* SortAndCombine */ : "All" /* All */);
150120
150190
  return ts_OrganizeImports_exports.organizeImports(sourceFile, formatContext, host, program, preferences, mode);
@@ -151762,6 +151832,7 @@ __export(ts_codefix_exports, {
151762
151832
  setJsonCompilerOptionValue: () => setJsonCompilerOptionValue,
151763
151833
  setJsonCompilerOptionValues: () => setJsonCompilerOptionValues,
151764
151834
  tryGetAutoImportableReferenceFromTypeNode: () => tryGetAutoImportableReferenceFromTypeNode,
151835
+ typePredicateToAutoImportableTypeNode: () => typePredicateToAutoImportableTypeNode,
151765
151836
  typeToAutoImportableTypeNode: () => typeToAutoImportableTypeNode
151766
151837
  });
151767
151838
 
@@ -157350,7 +157421,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
157350
157421
  const moduleDeclaration = find(symbol.declarations, isModuleDeclaration);
157351
157422
  const moduleDeclarationSourceFile = moduleDeclaration == null ? void 0 : moduleDeclaration.getSourceFile();
157352
157423
  if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
157353
- return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleDeclaration };
157424
+ return { kind: 2 /* Function */, token, call: parent2.parent, sourceFile: moduleDeclarationSourceFile, modifierFlags: 32 /* Export */, parentDeclaration: moduleDeclaration };
157354
157425
  }
157355
157426
  const moduleSourceFile = find(symbol.declarations, isSourceFile);
157356
157427
  if (sourceFile.commonJsModuleIndicator) return void 0;
@@ -159848,7 +159919,25 @@ function withContext(context, typePrintMode, cb) {
159848
159919
  if (typePrintMode === 1 /* Relative */) {
159849
159920
  return relativeType(node);
159850
159921
  }
159851
- let type = isValueSignatureDeclaration(node) ? tryGetReturnType2(node) : typeChecker.getTypeAtLocation(node);
159922
+ let type;
159923
+ if (isValueSignatureDeclaration(node)) {
159924
+ const signature = typeChecker.getSignatureFromDeclaration(node);
159925
+ if (signature) {
159926
+ const typePredicate = typeChecker.getTypePredicateOfSignature(signature);
159927
+ if (typePredicate) {
159928
+ if (!typePredicate.type) {
159929
+ return emptyInferenceResult;
159930
+ }
159931
+ return {
159932
+ typeNode: typePredicateToTypeNode(typePredicate, findAncestor(node, isDeclaration) ?? sourceFile, getFlags(typePredicate.type)),
159933
+ mutatedTarget: false
159934
+ };
159935
+ }
159936
+ type = typeChecker.getReturnTypeOfSignature(signature);
159937
+ }
159938
+ } else {
159939
+ type = typeChecker.getTypeAtLocation(node);
159940
+ }
159852
159941
  if (!type) {
159853
159942
  return emptyInferenceResult;
159854
159943
  }
@@ -159865,11 +159954,13 @@ function withContext(context, typePrintMode, cb) {
159865
159954
  if (isParameter(node) && typeChecker.requiresAddingImplicitUndefined(node)) {
159866
159955
  type = typeChecker.getUnionType([typeChecker.getUndefinedType(), type], 0 /* None */);
159867
159956
  }
159868
- const flags = (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
159869
159957
  return {
159870
- typeNode: typeToTypeNode2(type, findAncestor(node, isDeclaration) ?? sourceFile, flags),
159958
+ typeNode: typeToTypeNode2(type, findAncestor(node, isDeclaration) ?? sourceFile, getFlags(type)),
159871
159959
  mutatedTarget: false
159872
159960
  };
159961
+ function getFlags(type2) {
159962
+ return (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type2.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
159963
+ }
159873
159964
  }
159874
159965
  function createTypeOfFromEntityNameExpression(node) {
159875
159966
  return factory.createTypeQueryNode(getSynthesizedDeepClone(node));
@@ -160032,11 +160123,18 @@ function withContext(context, typePrintMode, cb) {
160032
160123
  });
160033
160124
  return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
160034
160125
  }
160035
- function tryGetReturnType2(node) {
160036
- const signature = typeChecker.getSignatureFromDeclaration(node);
160037
- if (signature) {
160038
- return typeChecker.getReturnTypeOfSignature(signature);
160039
- }
160126
+ function typePredicateToTypeNode(typePredicate, enclosingDeclaration, flags = 0 /* None */) {
160127
+ let isTruncated = false;
160128
+ const result2 = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
160129
+ moduleResolverHost: program,
160130
+ trackSymbol() {
160131
+ return true;
160132
+ },
160133
+ reportTruncationError() {
160134
+ isTruncated = true;
160135
+ }
160136
+ });
160137
+ return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
160040
160138
  }
160041
160139
  function addTypeToVariableLike(decl) {
160042
160140
  const { typeNode } = inferType(decl);
@@ -161707,6 +161805,17 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
161707
161805
  }
161708
161806
  return getSynthesizedDeepClone(typeNode);
161709
161807
  }
161808
+ function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, tracker) {
161809
+ let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, tracker);
161810
+ if ((typePredicateNode == null ? void 0 : typePredicateNode.type) && isImportTypeNode(typePredicateNode.type)) {
161811
+ const importableReference = tryGetAutoImportableReferenceFromTypeNode(typePredicateNode.type, scriptTarget);
161812
+ if (importableReference) {
161813
+ importSymbols(importAdder, importableReference.symbols);
161814
+ typePredicateNode = factory.updateTypePredicateNode(typePredicateNode, typePredicateNode.assertsModifier, typePredicateNode.parameterName, importableReference.typeNode);
161815
+ }
161816
+ }
161817
+ return getSynthesizedDeepClone(typePredicateNode);
161818
+ }
161710
161819
  function typeContainsTypeParameter(type) {
161711
161820
  if (type.isUnionOrIntersection()) {
161712
161821
  return type.types.some(typeContainsTypeParameter);
@@ -170469,13 +170578,12 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
170469
170578
  const calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
170470
170579
  if (calledDeclaration && !(isJsxOpeningLikeElement(node.parent) && isJsxConstructorLike(calledDeclaration))) {
170471
170580
  const sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
170472
- let includeDeclarations;
170473
170581
  if (typeChecker.getRootSymbols(symbol).some((s) => symbolMatchesSignature(s, calledDeclaration))) {
170474
- if (!isConstructorDeclaration(calledDeclaration)) return [sigInfo];
170475
- includeDeclarations = (d) => d !== calledDeclaration && (isClassDeclaration(d) || isClassExpression(d));
170582
+ return [sigInfo];
170583
+ } else {
170584
+ const defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || emptyArray;
170585
+ return node.kind === 108 /* SuperKeyword */ ? [sigInfo, ...defs] : [...defs, sigInfo];
170476
170586
  }
170477
- const defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration, includeDeclarations) || emptyArray;
170478
- return node.kind === 108 /* SuperKeyword */ ? [sigInfo, ...defs] : [...defs, sigInfo];
170479
170587
  }
170480
170588
  if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) {
170481
170589
  const shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
@@ -170732,10 +170840,9 @@ function isExpandoDeclaration(node) {
170732
170840
  });
170733
170841
  return !!containingAssignment && getAssignmentDeclarationKind(containingAssignment) === 5 /* Property */;
170734
170842
  }
170735
- function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration, includeDeclarations) {
170736
- const excludeConstructorDeclaration = excludeDeclaration !== void 0 && isConstructorDeclaration(excludeDeclaration);
170737
- const filteredDeclarations = filter(symbol.declarations, includeDeclarations ?? ((d) => d !== excludeDeclaration));
170738
- const signatureDefinition = !excludeConstructorDeclaration && (getConstructSignatureDefinition() || getCallSignatureDefinition());
170843
+ function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) {
170844
+ const filteredDeclarations = filter(symbol.declarations, (d) => d !== excludeDeclaration);
170845
+ const signatureDefinition = getConstructSignatureDefinition() || getCallSignatureDefinition();
170739
170846
  if (signatureDefinition) {
170740
170847
  return signatureDefinition;
170741
170848
  }
@@ -183071,7 +183178,7 @@ var Project2 = class _Project {
183071
183178
  }
183072
183179
  fileExists(file) {
183073
183180
  const path = this.toPath(file);
183074
- return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
183181
+ return !!this.projectService.getScriptInfoForPath(path) || !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
183075
183182
  }
183076
183183
  /** @internal */
183077
183184
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
@@ -186095,59 +186202,13 @@ var _ProjectService = class _ProjectService {
186095
186202
  watchWildcardDirectory(directory, flags, configFileName, config) {
186096
186203
  let watcher = this.watchFactory.watchDirectory(
186097
186204
  directory,
186098
- (fileOrDirectory) => {
186099
- const fileOrDirectoryPath = this.toPath(fileOrDirectory);
186100
- const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
186101
- if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
186102
- const file = this.getNormalizedAbsolutePath(fileOrDirectory);
186103
- this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
186104
- this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
186105
- this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
186106
- }
186107
- const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
186108
- if (isIgnoredFileFromWildCardWatching({
186109
- watchedDirPath: this.toPath(directory),
186110
- fileOrDirectory,
186111
- fileOrDirectoryPath,
186112
- configFileName,
186113
- extraFileExtensions: this.hostConfiguration.extraFileExtensions,
186114
- currentDirectory: this.currentDirectory,
186115
- options: config.parsedCommandLine.options,
186116
- program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config.parsedCommandLine.fileNames,
186117
- useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
186118
- writeLog: (s) => this.logger.info(s),
186119
- toPath: (s) => this.toPath(s),
186120
- getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
186121
- })) return;
186122
- if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */;
186123
- config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
186124
- var _a;
186125
- if (!watchWildcardDirectories) return;
186126
- const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
186127
- if (!project) return;
186128
- if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
186129
- const path = this.toPath(configFileName);
186130
- if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
186131
- project.markAutoImportProviderAsDirty();
186132
- }
186133
- }
186134
- const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
186135
- if (project.pendingUpdateLevel > updateLevel) return;
186136
- if (this.openFiles.has(fileOrDirectoryPath)) {
186137
- const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
186138
- if (info.isAttached(project)) {
186139
- const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
186140
- project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
186141
- } else {
186142
- project.pendingUpdateLevel = updateLevel;
186143
- this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186144
- }
186145
- } else {
186146
- project.pendingUpdateLevel = updateLevel;
186147
- this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186148
- }
186149
- });
186150
- },
186205
+ (fileOrDirectory) => this.onWildCardDirectoryWatcherInvoke(
186206
+ directory,
186207
+ configFileName,
186208
+ config,
186209
+ result,
186210
+ fileOrDirectory
186211
+ ),
186151
186212
  flags,
186152
186213
  this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine.watchOptions, getDirectoryPath(configFileName)),
186153
186214
  WatchType.WildcardDirectory,
@@ -186170,6 +186231,59 @@ var _ProjectService = class _ProjectService {
186170
186231
  };
186171
186232
  return result;
186172
186233
  }
186234
+ onWildCardDirectoryWatcherInvoke(directory, configFileName, config, wildCardWatcher, fileOrDirectory) {
186235
+ const fileOrDirectoryPath = this.toPath(fileOrDirectory);
186236
+ const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
186237
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
186238
+ const file = this.getNormalizedAbsolutePath(fileOrDirectory);
186239
+ this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
186240
+ this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
186241
+ this.watchPackageJsonFile(file, fileOrDirectoryPath, wildCardWatcher);
186242
+ }
186243
+ const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
186244
+ if (isIgnoredFileFromWildCardWatching({
186245
+ watchedDirPath: this.toPath(directory),
186246
+ fileOrDirectory,
186247
+ fileOrDirectoryPath,
186248
+ configFileName,
186249
+ extraFileExtensions: this.hostConfiguration.extraFileExtensions,
186250
+ currentDirectory: this.currentDirectory,
186251
+ options: config.parsedCommandLine.options,
186252
+ program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config.parsedCommandLine.fileNames,
186253
+ useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
186254
+ writeLog: (s) => this.logger.info(s),
186255
+ toPath: (s) => this.toPath(s),
186256
+ getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
186257
+ })) return;
186258
+ if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */;
186259
+ config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
186260
+ var _a;
186261
+ if (!watchWildcardDirectories) return;
186262
+ const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
186263
+ if (!project) return;
186264
+ if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
186265
+ const path = this.toPath(configFileName);
186266
+ if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
186267
+ project.markAutoImportProviderAsDirty();
186268
+ }
186269
+ }
186270
+ const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
186271
+ if (project.pendingUpdateLevel > updateLevel) return;
186272
+ if (this.openFiles.has(fileOrDirectoryPath)) {
186273
+ const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
186274
+ if (info.isAttached(project)) {
186275
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
186276
+ project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
186277
+ } else {
186278
+ project.pendingUpdateLevel = updateLevel;
186279
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186280
+ }
186281
+ } else {
186282
+ project.pendingUpdateLevel = updateLevel;
186283
+ this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
186284
+ }
186285
+ });
186286
+ }
186173
186287
  delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
186174
186288
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
186175
186289
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config)) return false;
@@ -188086,8 +188200,38 @@ Dynamic files must always be opened with service's current directory or service
188086
188200
  }
188087
188201
  this.removeOrphanScriptInfos();
188088
188202
  }
188203
+ tryInvokeWildCardDirectories(info) {
188204
+ this.configFileExistenceInfoCache.forEach((configFileExistenceInfo, config) => {
188205
+ var _a, _b;
188206
+ if (!((_a = configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) || contains(
188207
+ configFileExistenceInfo.config.parsedCommandLine.fileNames,
188208
+ info.fileName,
188209
+ !this.host.useCaseSensitiveFileNames ? equateStringsCaseInsensitive : equateStringsCaseSensitive
188210
+ )) {
188211
+ return;
188212
+ }
188213
+ (_b = configFileExistenceInfo.config.watchedDirectories) == null ? void 0 : _b.forEach((watcher, directory) => {
188214
+ if (containsPath(directory, info.fileName, !this.host.useCaseSensitiveFileNames)) {
188215
+ this.logger.info(`Invoking ${config}:: wildcard for open scriptInfo:: ${info.fileName}`);
188216
+ this.onWildCardDirectoryWatcherInvoke(
188217
+ directory,
188218
+ config,
188219
+ configFileExistenceInfo.config,
188220
+ watcher.watcher,
188221
+ info.fileName
188222
+ );
188223
+ }
188224
+ });
188225
+ });
188226
+ }
188089
188227
  openClientFileWithNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
188228
+ const existing = this.getScriptInfoForPath(normalizedPathToPath(
188229
+ fileName,
188230
+ projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory,
188231
+ this.toCanonicalFileName
188232
+ ));
188090
188233
  const info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
188234
+ if (!existing && info && !info.isDynamic) this.tryInvokeWildCardDirectories(info);
188091
188235
  const { retainProjects, ...result } = this.assignProjectToOpenedScriptInfo(info);
188092
188236
  this.cleanupProjectsAndScriptInfos(
188093
188237
  retainProjects,
@@ -188234,10 +188378,16 @@ Dynamic files must always be opened with service's current directory or service
188234
188378
  }
188235
188379
  /** @internal */
188236
188380
  applyChangesInOpenFiles(openFiles, changedFiles, closedFiles) {
188381
+ let existingOpenScriptInfos;
188237
188382
  let openScriptInfos;
188238
188383
  let assignOrphanScriptInfosToInferredProject = false;
188239
188384
  if (openFiles) {
188240
188385
  for (const file of openFiles) {
188386
+ (existingOpenScriptInfos ?? (existingOpenScriptInfos = [])).push(this.getScriptInfoForPath(normalizedPathToPath(
188387
+ toNormalizedPath(file.fileName),
188388
+ file.projectRootPath ? this.getNormalizedAbsolutePath(file.projectRootPath) : this.currentDirectory,
188389
+ this.toCanonicalFileName
188390
+ )));
188241
188391
  const info = this.getOrCreateOpenScriptInfo(
188242
188392
  toNormalizedPath(file.fileName),
188243
188393
  file.content,
@@ -188265,6 +188415,10 @@ Dynamic files must always be opened with service's current directory or service
188265
188415
  }
188266
188416
  }
188267
188417
  let retainProjects;
188418
+ forEach(
188419
+ existingOpenScriptInfos,
188420
+ (existing, index) => !existing && openScriptInfos[index] && !openScriptInfos[index].isDynamic ? this.tryInvokeWildCardDirectories(openScriptInfos[index]) : void 0
188421
+ );
188268
188422
  openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
188269
188423
  var _a;
188270
188424
  return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.6.0-pr-59421-2",
5
+ "version": "5.6.0-pr-55887-54",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [