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

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.
Files changed (3) hide show
  1. package/lib/tsc.js +49 -106
  2. package/lib/typescript.js +52 -106
  3. package/package.json +1 -1
package/lib/tsc.js CHANGED
@@ -6703,7 +6703,6 @@ 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."),
6707
6706
  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}'."),
6708
6707
  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}'."),
6709
6708
  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}'."),
@@ -17122,9 +17121,6 @@ function accessKind(node) {
17122
17121
  return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
17123
17122
  case 209 /* ArrayLiteralExpression */:
17124
17123
  return accessKind(parent);
17125
- case 249 /* ForInStatement */:
17126
- case 250 /* ForOfStatement */:
17127
- return node === parent.initializer ? 1 /* Write */ : 0 /* Read */;
17128
17124
  default:
17129
17125
  return 0 /* Read */;
17130
17126
  }
@@ -17264,7 +17260,6 @@ function Symbol4(flags, name) {
17264
17260
  this.constEnumOnlyModule = void 0;
17265
17261
  this.isReferenced = void 0;
17266
17262
  this.lastAssignmentPos = void 0;
17267
- this.isDefinitelyAssigned = void 0;
17268
17263
  this.links = void 0;
17269
17264
  }
17270
17265
  function Type3(checker, flags) {
@@ -45747,16 +45742,11 @@ function createTypeChecker(host) {
45747
45742
  checkSourceFileWithEagerDiagnostics(file);
45748
45743
  Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
45749
45744
  diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
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
- );
45745
+ checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
45746
+ if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
45747
+ (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
45748
+ }
45749
+ });
45760
45750
  return diagnostics2 || emptyArray;
45761
45751
  } finally {
45762
45752
  cancellationToken = void 0;
@@ -46249,7 +46239,7 @@ function createTypeChecker(host) {
46249
46239
  var deferredGlobalClassAccessorDecoratorTargetType;
46250
46240
  var deferredGlobalClassAccessorDecoratorResultType;
46251
46241
  var deferredGlobalClassFieldDecoratorContextType;
46252
- var allPotentiallyUnusedOrUninitializedIdentifiers = /* @__PURE__ */ new Map();
46242
+ var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
46253
46243
  var flowLoopStart = 0;
46254
46244
  var flowLoopCount = 0;
46255
46245
  var sharedFlowCount = 0;
@@ -69586,9 +69576,6 @@ function createTypeChecker(host) {
69586
69576
  void 0
69587
69577
  );
69588
69578
  }
69589
- function isSymbolAssignedDefinitely(symbol) {
69590
- return symbol.isDefinitelyAssigned ?? (isSymbolAssigned(symbol) && symbol.isDefinitelyAssigned);
69591
- }
69592
69579
  function isPastLastAssignment(symbol, location) {
69593
69580
  const parent = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69594
69581
  if (!parent) {
@@ -69599,7 +69586,6 @@ function createTypeChecker(host) {
69599
69586
  links.flags |= 131072 /* AssignmentsMarked */;
69600
69587
  if (!hasParentWithAssignmentsMarked(parent)) {
69601
69588
  markNodeAssignments(parent);
69602
- symbol.isDefinitelyAssigned ?? (symbol.isDefinitelyAssigned = false);
69603
69589
  }
69604
69590
  }
69605
69591
  return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
@@ -69623,18 +69609,12 @@ function createTypeChecker(host) {
69623
69609
  function markNodeAssignments(node) {
69624
69610
  switch (node.kind) {
69625
69611
  case 80 /* Identifier */:
69626
- const assignmentKind = getAssignmentTargetKind(node);
69627
- if (assignmentKind !== 0 /* None */) {
69612
+ if (isAssignmentTarget(node)) {
69628
69613
  const symbol = getResolvedSymbol(node);
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
+ if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
69615
+ const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
69616
+ const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69617
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
69638
69618
  }
69639
69619
  }
69640
69620
  return;
@@ -79184,7 +79164,7 @@ function createTypeChecker(host) {
79184
79164
  }
79185
79165
  }
79186
79166
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 317 /* JSDocFunctionType */) {
79187
- registerForUnusedOrUninitializedIdentifiersCheck(node);
79167
+ registerForUnusedIdentifiersCheck(node);
79188
79168
  }
79189
79169
  }
79190
79170
  }
@@ -79730,7 +79710,7 @@ function createTypeChecker(host) {
79730
79710
  }
79731
79711
  }
79732
79712
  }
79733
- registerForUnusedOrUninitializedIdentifiersCheck(node);
79713
+ registerForUnusedIdentifiersCheck(node);
79734
79714
  }
79735
79715
  function checkTemplateLiteralType(node) {
79736
79716
  for (const span of node.templateSpans) {
@@ -80682,27 +80662,25 @@ function createTypeChecker(host) {
80682
80662
  }
80683
80663
  }
80684
80664
  }
80685
- function registerForUnusedOrUninitializedIdentifiersCheck(node) {
80686
- addLazyDiagnostic(registerForUnusedOrUninitializedIdentifiersCheckDiagnostics);
80687
- function registerForUnusedOrUninitializedIdentifiersCheckDiagnostics() {
80665
+ function registerForUnusedIdentifiersCheck(node) {
80666
+ addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
80667
+ function registerForUnusedIdentifiersCheckDiagnostics() {
80688
80668
  const sourceFile = getSourceFileOfNode(node);
80689
- let potentiallyUnusedOrUninitializedIdentifiers = allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path);
80690
- if (!potentiallyUnusedOrUninitializedIdentifiers) {
80691
- potentiallyUnusedOrUninitializedIdentifiers = [];
80692
- allPotentiallyUnusedOrUninitializedIdentifiers.set(sourceFile.path, potentiallyUnusedOrUninitializedIdentifiers);
80669
+ let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
80670
+ if (!potentiallyUnusedIdentifiers) {
80671
+ potentiallyUnusedIdentifiers = [];
80672
+ allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
80693
80673
  }
80694
- potentiallyUnusedOrUninitializedIdentifiers.push(node);
80674
+ potentiallyUnusedIdentifiers.push(node);
80695
80675
  }
80696
80676
  }
80697
- function checkUnusedOrUninitializedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic, checkUnused, checkUninitialized) {
80677
+ function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
80698
80678
  for (const node of potentiallyUnusedIdentifiers) {
80699
80679
  switch (node.kind) {
80700
80680
  case 263 /* ClassDeclaration */:
80701
80681
  case 231 /* ClassExpression */:
80702
- if (checkUnused) {
80703
- checkUnusedClassMembers(node, addDiagnostic);
80704
- checkUnusedTypeParameters(node, addDiagnostic);
80705
- }
80682
+ checkUnusedClassMembers(node, addDiagnostic);
80683
+ checkUnusedTypeParameters(node, addDiagnostic);
80706
80684
  break;
80707
80685
  case 307 /* SourceFile */:
80708
80686
  case 267 /* ModuleDeclaration */:
@@ -80711,12 +80689,7 @@ function createTypeChecker(host) {
80711
80689
  case 248 /* ForStatement */:
80712
80690
  case 249 /* ForInStatement */:
80713
80691
  case 250 /* ForOfStatement */:
80714
- if (checkUnused) {
80715
- checkUnusedLocalsAndParameters(node, addDiagnostic);
80716
- }
80717
- if (checkUninitialized) {
80718
- checkUninitializedLocals(node);
80719
- }
80692
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
80720
80693
  break;
80721
80694
  case 176 /* Constructor */:
80722
80695
  case 218 /* FunctionExpression */:
@@ -80725,15 +80698,10 @@ function createTypeChecker(host) {
80725
80698
  case 174 /* MethodDeclaration */:
80726
80699
  case 177 /* GetAccessor */:
80727
80700
  case 178 /* SetAccessor */:
80728
- if (checkUnused) {
80729
- if (node.body) {
80730
- checkUnusedLocalsAndParameters(node, addDiagnostic);
80731
- }
80732
- checkUnusedTypeParameters(node, addDiagnostic);
80733
- }
80734
- if (checkUninitialized) {
80735
- checkUninitializedLocals(node);
80701
+ if (node.body) {
80702
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
80736
80703
  }
80704
+ checkUnusedTypeParameters(node, addDiagnostic);
80737
80705
  break;
80738
80706
  case 173 /* MethodSignature */:
80739
80707
  case 179 /* CallSignature */:
@@ -80742,14 +80710,10 @@ function createTypeChecker(host) {
80742
80710
  case 185 /* ConstructorType */:
80743
80711
  case 265 /* TypeAliasDeclaration */:
80744
80712
  case 264 /* InterfaceDeclaration */:
80745
- if (checkUnused) {
80746
- checkUnusedTypeParameters(node, addDiagnostic);
80747
- }
80713
+ checkUnusedTypeParameters(node, addDiagnostic);
80748
80714
  break;
80749
80715
  case 195 /* InferType */:
80750
- if (checkUnused) {
80751
- checkUnusedInferTypeParameter(node, addDiagnostic);
80752
- }
80716
+ checkUnusedInferTypeParameter(node, addDiagnostic);
80753
80717
  break;
80754
80718
  default:
80755
80719
  Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
@@ -80936,21 +80900,6 @@ function createTypeChecker(host) {
80936
80900
  }
80937
80901
  });
80938
80902
  }
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
- }
80954
80903
  function checkPotentialUncheckedRenamedBindingElementsInTypes() {
80955
80904
  var _a;
80956
80905
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
@@ -80997,7 +80946,7 @@ function createTypeChecker(host) {
80997
80946
  forEach(node.statements, checkSourceElement);
80998
80947
  }
80999
80948
  if (node.locals) {
81000
- registerForUnusedOrUninitializedIdentifiersCheck(node);
80949
+ registerForUnusedIdentifiersCheck(node);
81001
80950
  }
81002
80951
  }
81003
80952
  function checkCollisionWithArgumentsInGeneratedCode(node) {
@@ -81587,7 +81536,7 @@ function createTypeChecker(host) {
81587
81536
  if (node.incrementor) checkExpression(node.incrementor);
81588
81537
  checkSourceElement(node.statement);
81589
81538
  if (node.locals) {
81590
- registerForUnusedOrUninitializedIdentifiersCheck(node);
81539
+ registerForUnusedIdentifiersCheck(node);
81591
81540
  }
81592
81541
  }
81593
81542
  function checkForOfStatement(node) {
@@ -81626,7 +81575,7 @@ function createTypeChecker(host) {
81626
81575
  }
81627
81576
  checkSourceElement(node.statement);
81628
81577
  if (node.locals) {
81629
- registerForUnusedOrUninitializedIdentifiersCheck(node);
81578
+ registerForUnusedIdentifiersCheck(node);
81630
81579
  }
81631
81580
  }
81632
81581
  function checkForInStatement(node) {
@@ -81658,7 +81607,7 @@ function createTypeChecker(host) {
81658
81607
  }
81659
81608
  checkSourceElement(node.statement);
81660
81609
  if (node.locals) {
81661
- registerForUnusedOrUninitializedIdentifiersCheck(node);
81610
+ registerForUnusedIdentifiersCheck(node);
81662
81611
  }
81663
81612
  }
81664
81613
  function checkRightHandSideOfForOf(statement) {
@@ -82344,7 +82293,7 @@ function createTypeChecker(host) {
82344
82293
  }
82345
82294
  });
82346
82295
  if (node.caseBlock.locals) {
82347
- registerForUnusedOrUninitializedIdentifiersCheck(node.caseBlock);
82296
+ registerForUnusedIdentifiersCheck(node.caseBlock);
82348
82297
  }
82349
82298
  }
82350
82299
  function checkLabeledStatement(node) {
@@ -82681,7 +82630,7 @@ function createTypeChecker(host) {
82681
82630
  }
82682
82631
  function checkClassExpressionDeferred(node) {
82683
82632
  forEach(node.members, checkSourceElement);
82684
- registerForUnusedOrUninitializedIdentifiersCheck(node);
82633
+ registerForUnusedIdentifiersCheck(node);
82685
82634
  }
82686
82635
  function checkClassDeclaration(node) {
82687
82636
  const firstDecorator = find(node.modifiers, isDecorator);
@@ -82693,7 +82642,7 @@ function createTypeChecker(host) {
82693
82642
  }
82694
82643
  checkClassLikeDeclaration(node);
82695
82644
  forEach(node.members, checkSourceElement);
82696
- registerForUnusedOrUninitializedIdentifiersCheck(node);
82645
+ registerForUnusedIdentifiersCheck(node);
82697
82646
  }
82698
82647
  function checkClassLikeDeclaration(node) {
82699
82648
  checkGrammarClassLikeDeclaration(node);
@@ -83249,7 +83198,7 @@ function createTypeChecker(host) {
83249
83198
  forEach(node.members, checkSourceElement);
83250
83199
  addLazyDiagnostic(() => {
83251
83200
  checkTypeForDuplicateIndexSignatures(node);
83252
- registerForUnusedOrUninitializedIdentifiersCheck(node);
83201
+ registerForUnusedIdentifiersCheck(node);
83253
83202
  });
83254
83203
  }
83255
83204
  function checkTypeAliasDeclaration(node) {
@@ -83265,7 +83214,7 @@ function createTypeChecker(host) {
83265
83214
  }
83266
83215
  } else {
83267
83216
  checkSourceElement(node.type);
83268
- registerForUnusedOrUninitializedIdentifiersCheck(node);
83217
+ registerForUnusedIdentifiersCheck(node);
83269
83218
  }
83270
83219
  }
83271
83220
  function computeEnumMemberValues(node) {
@@ -83527,7 +83476,7 @@ function createTypeChecker(host) {
83527
83476
  if (node.body) {
83528
83477
  checkSourceElement(node.body);
83529
83478
  if (!isGlobalScopeAugmentation(node)) {
83530
- registerForUnusedOrUninitializedIdentifiersCheck(node);
83479
+ registerForUnusedIdentifiersCheck(node);
83531
83480
  }
83532
83481
  }
83533
83482
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
@@ -84572,8 +84521,8 @@ function createTypeChecker(host) {
84572
84521
  return Debug.assertNever(kind);
84573
84522
  }
84574
84523
  }
84575
- function getPotentiallyUnusedOrUninitializedIdentifiers(sourceFile) {
84576
- return allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path) || emptyArray;
84524
+ function getPotentiallyUnusedIdentifiers(sourceFile) {
84525
+ return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
84577
84526
  }
84578
84527
  function checkSourceFileWorker(node) {
84579
84528
  const links = getNodeLinks(node);
@@ -84598,21 +84547,15 @@ function createTypeChecker(host) {
84598
84547
  checkSourceElement(node.endOfFileToken);
84599
84548
  checkDeferredNodes(node);
84600
84549
  if (isExternalOrCommonJsModule(node)) {
84601
- registerForUnusedOrUninitializedIdentifiersCheck(node);
84550
+ registerForUnusedIdentifiersCheck(node);
84602
84551
  }
84603
84552
  addLazyDiagnostic(() => {
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
- );
84553
+ if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
84554
+ checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
84555
+ if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
84556
+ diagnostics.add(diag2);
84557
+ }
84558
+ });
84616
84559
  }
84617
84560
  if (!node.isDeclarationFile) {
84618
84561
  checkPotentialUncheckedRenamedBindingElementsInTypes();
package/lib/typescript.js CHANGED
@@ -484,6 +484,7 @@ __export(typescript_exports, {
484
484
  decodeMappings: () => decodeMappings,
485
485
  decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
486
486
  deduplicate: () => deduplicate,
487
+ defaultInitCompilerOptions: () => defaultInitCompilerOptions,
487
488
  defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
488
489
  diagnosticCategoryName: () => diagnosticCategoryName,
489
490
  diagnosticToString: () => diagnosticToString,
@@ -10099,7 +10100,6 @@ var Diagnostics = {
10099
10100
  This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
10100
10101
  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
10102
  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."),
10103
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}'."),
10104
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}'."),
10105
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}'."),
@@ -21012,9 +21012,6 @@ function accessKind(node) {
21012
21012
  return node === parent2.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent2.parent);
21013
21013
  case 209 /* ArrayLiteralExpression */:
21014
21014
  return accessKind(parent2);
21015
- case 249 /* ForInStatement */:
21016
- case 250 /* ForOfStatement */:
21017
- return node === parent2.initializer ? 1 /* Write */ : 0 /* Read */;
21018
21015
  default:
21019
21016
  return 0 /* Read */;
21020
21017
  }
@@ -21213,7 +21210,6 @@ function Symbol4(flags, name) {
21213
21210
  this.constEnumOnlyModule = void 0;
21214
21211
  this.isReferenced = void 0;
21215
21212
  this.lastAssignmentPos = void 0;
21216
- this.isDefinitelyAssigned = void 0;
21217
21213
  this.links = void 0;
21218
21214
  }
21219
21215
  function Type3(checker, flags) {
@@ -50365,16 +50361,11 @@ function createTypeChecker(host) {
50365
50361
  checkSourceFileWithEagerDiagnostics(file);
50366
50362
  Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
50367
50363
  diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
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
- );
50364
+ checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => {
50365
+ if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
50366
+ (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
50367
+ }
50368
+ });
50378
50369
  return diagnostics2 || emptyArray;
50379
50370
  } finally {
50380
50371
  cancellationToken = void 0;
@@ -50867,7 +50858,7 @@ function createTypeChecker(host) {
50867
50858
  var deferredGlobalClassAccessorDecoratorTargetType;
50868
50859
  var deferredGlobalClassAccessorDecoratorResultType;
50869
50860
  var deferredGlobalClassFieldDecoratorContextType;
50870
- var allPotentiallyUnusedOrUninitializedIdentifiers = /* @__PURE__ */ new Map();
50861
+ var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
50871
50862
  var flowLoopStart = 0;
50872
50863
  var flowLoopCount = 0;
50873
50864
  var sharedFlowCount = 0;
@@ -74204,9 +74195,6 @@ function createTypeChecker(host) {
74204
74195
  void 0
74205
74196
  );
74206
74197
  }
74207
- function isSymbolAssignedDefinitely(symbol) {
74208
- return symbol.isDefinitelyAssigned ?? (isSymbolAssigned(symbol) && symbol.isDefinitelyAssigned);
74209
- }
74210
74198
  function isPastLastAssignment(symbol, location) {
74211
74199
  const parent2 = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74212
74200
  if (!parent2) {
@@ -74217,7 +74205,6 @@ function createTypeChecker(host) {
74217
74205
  links.flags |= 131072 /* AssignmentsMarked */;
74218
74206
  if (!hasParentWithAssignmentsMarked(parent2)) {
74219
74207
  markNodeAssignments(parent2);
74220
- symbol.isDefinitelyAssigned ?? (symbol.isDefinitelyAssigned = false);
74221
74208
  }
74222
74209
  }
74223
74210
  return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
@@ -74241,18 +74228,12 @@ function createTypeChecker(host) {
74241
74228
  function markNodeAssignments(node) {
74242
74229
  switch (node.kind) {
74243
74230
  case 80 /* Identifier */:
74244
- const assignmentKind = getAssignmentTargetKind(node);
74245
- if (assignmentKind !== 0 /* None */) {
74231
+ if (isAssignmentTarget(node)) {
74246
74232
  const symbol = getResolvedSymbol(node);
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
- }
74233
+ if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
74234
+ const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
74235
+ const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74236
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
74256
74237
  }
74257
74238
  }
74258
74239
  return;
@@ -83802,7 +83783,7 @@ function createTypeChecker(host) {
83802
83783
  }
83803
83784
  }
83804
83785
  if (node.kind !== 181 /* IndexSignature */ && node.kind !== 317 /* JSDocFunctionType */) {
83805
- registerForUnusedOrUninitializedIdentifiersCheck(node);
83786
+ registerForUnusedIdentifiersCheck(node);
83806
83787
  }
83807
83788
  }
83808
83789
  }
@@ -84348,7 +84329,7 @@ function createTypeChecker(host) {
84348
84329
  }
84349
84330
  }
84350
84331
  }
84351
- registerForUnusedOrUninitializedIdentifiersCheck(node);
84332
+ registerForUnusedIdentifiersCheck(node);
84352
84333
  }
84353
84334
  function checkTemplateLiteralType(node) {
84354
84335
  for (const span of node.templateSpans) {
@@ -85300,27 +85281,25 @@ function createTypeChecker(host) {
85300
85281
  }
85301
85282
  }
85302
85283
  }
85303
- function registerForUnusedOrUninitializedIdentifiersCheck(node) {
85304
- addLazyDiagnostic(registerForUnusedOrUninitializedIdentifiersCheckDiagnostics);
85305
- function registerForUnusedOrUninitializedIdentifiersCheckDiagnostics() {
85284
+ function registerForUnusedIdentifiersCheck(node) {
85285
+ addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
85286
+ function registerForUnusedIdentifiersCheckDiagnostics() {
85306
85287
  const sourceFile = getSourceFileOfNode(node);
85307
- let potentiallyUnusedOrUninitializedIdentifiers = allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path);
85308
- if (!potentiallyUnusedOrUninitializedIdentifiers) {
85309
- potentiallyUnusedOrUninitializedIdentifiers = [];
85310
- allPotentiallyUnusedOrUninitializedIdentifiers.set(sourceFile.path, potentiallyUnusedOrUninitializedIdentifiers);
85288
+ let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
85289
+ if (!potentiallyUnusedIdentifiers) {
85290
+ potentiallyUnusedIdentifiers = [];
85291
+ allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers);
85311
85292
  }
85312
- potentiallyUnusedOrUninitializedIdentifiers.push(node);
85293
+ potentiallyUnusedIdentifiers.push(node);
85313
85294
  }
85314
85295
  }
85315
- function checkUnusedOrUninitializedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic, checkUnused, checkUninitialized) {
85296
+ function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
85316
85297
  for (const node of potentiallyUnusedIdentifiers) {
85317
85298
  switch (node.kind) {
85318
85299
  case 263 /* ClassDeclaration */:
85319
85300
  case 231 /* ClassExpression */:
85320
- if (checkUnused) {
85321
- checkUnusedClassMembers(node, addDiagnostic);
85322
- checkUnusedTypeParameters(node, addDiagnostic);
85323
- }
85301
+ checkUnusedClassMembers(node, addDiagnostic);
85302
+ checkUnusedTypeParameters(node, addDiagnostic);
85324
85303
  break;
85325
85304
  case 307 /* SourceFile */:
85326
85305
  case 267 /* ModuleDeclaration */:
@@ -85329,12 +85308,7 @@ function createTypeChecker(host) {
85329
85308
  case 248 /* ForStatement */:
85330
85309
  case 249 /* ForInStatement */:
85331
85310
  case 250 /* ForOfStatement */:
85332
- if (checkUnused) {
85333
- checkUnusedLocalsAndParameters(node, addDiagnostic);
85334
- }
85335
- if (checkUninitialized) {
85336
- checkUninitializedLocals(node);
85337
- }
85311
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
85338
85312
  break;
85339
85313
  case 176 /* Constructor */:
85340
85314
  case 218 /* FunctionExpression */:
@@ -85343,15 +85317,10 @@ function createTypeChecker(host) {
85343
85317
  case 174 /* MethodDeclaration */:
85344
85318
  case 177 /* GetAccessor */:
85345
85319
  case 178 /* SetAccessor */:
85346
- if (checkUnused) {
85347
- if (node.body) {
85348
- checkUnusedLocalsAndParameters(node, addDiagnostic);
85349
- }
85350
- checkUnusedTypeParameters(node, addDiagnostic);
85351
- }
85352
- if (checkUninitialized) {
85353
- checkUninitializedLocals(node);
85320
+ if (node.body) {
85321
+ checkUnusedLocalsAndParameters(node, addDiagnostic);
85354
85322
  }
85323
+ checkUnusedTypeParameters(node, addDiagnostic);
85355
85324
  break;
85356
85325
  case 173 /* MethodSignature */:
85357
85326
  case 179 /* CallSignature */:
@@ -85360,14 +85329,10 @@ function createTypeChecker(host) {
85360
85329
  case 185 /* ConstructorType */:
85361
85330
  case 265 /* TypeAliasDeclaration */:
85362
85331
  case 264 /* InterfaceDeclaration */:
85363
- if (checkUnused) {
85364
- checkUnusedTypeParameters(node, addDiagnostic);
85365
- }
85332
+ checkUnusedTypeParameters(node, addDiagnostic);
85366
85333
  break;
85367
85334
  case 195 /* InferType */:
85368
- if (checkUnused) {
85369
- checkUnusedInferTypeParameter(node, addDiagnostic);
85370
- }
85335
+ checkUnusedInferTypeParameter(node, addDiagnostic);
85371
85336
  break;
85372
85337
  default:
85373
85338
  Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
@@ -85554,21 +85519,6 @@ function createTypeChecker(host) {
85554
85519
  }
85555
85520
  });
85556
85521
  }
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
- }
85572
85522
  function checkPotentialUncheckedRenamedBindingElementsInTypes() {
85573
85523
  var _a;
85574
85524
  for (const node of potentialUnusedRenamedBindingElementsInTypes) {
@@ -85615,7 +85565,7 @@ function createTypeChecker(host) {
85615
85565
  forEach(node.statements, checkSourceElement);
85616
85566
  }
85617
85567
  if (node.locals) {
85618
- registerForUnusedOrUninitializedIdentifiersCheck(node);
85568
+ registerForUnusedIdentifiersCheck(node);
85619
85569
  }
85620
85570
  }
85621
85571
  function checkCollisionWithArgumentsInGeneratedCode(node) {
@@ -86205,7 +86155,7 @@ function createTypeChecker(host) {
86205
86155
  if (node.incrementor) checkExpression(node.incrementor);
86206
86156
  checkSourceElement(node.statement);
86207
86157
  if (node.locals) {
86208
- registerForUnusedOrUninitializedIdentifiersCheck(node);
86158
+ registerForUnusedIdentifiersCheck(node);
86209
86159
  }
86210
86160
  }
86211
86161
  function checkForOfStatement(node) {
@@ -86244,7 +86194,7 @@ function createTypeChecker(host) {
86244
86194
  }
86245
86195
  checkSourceElement(node.statement);
86246
86196
  if (node.locals) {
86247
- registerForUnusedOrUninitializedIdentifiersCheck(node);
86197
+ registerForUnusedIdentifiersCheck(node);
86248
86198
  }
86249
86199
  }
86250
86200
  function checkForInStatement(node) {
@@ -86276,7 +86226,7 @@ function createTypeChecker(host) {
86276
86226
  }
86277
86227
  checkSourceElement(node.statement);
86278
86228
  if (node.locals) {
86279
- registerForUnusedOrUninitializedIdentifiersCheck(node);
86229
+ registerForUnusedIdentifiersCheck(node);
86280
86230
  }
86281
86231
  }
86282
86232
  function checkRightHandSideOfForOf(statement) {
@@ -86962,7 +86912,7 @@ function createTypeChecker(host) {
86962
86912
  }
86963
86913
  });
86964
86914
  if (node.caseBlock.locals) {
86965
- registerForUnusedOrUninitializedIdentifiersCheck(node.caseBlock);
86915
+ registerForUnusedIdentifiersCheck(node.caseBlock);
86966
86916
  }
86967
86917
  }
86968
86918
  function checkLabeledStatement(node) {
@@ -87299,7 +87249,7 @@ function createTypeChecker(host) {
87299
87249
  }
87300
87250
  function checkClassExpressionDeferred(node) {
87301
87251
  forEach(node.members, checkSourceElement);
87302
- registerForUnusedOrUninitializedIdentifiersCheck(node);
87252
+ registerForUnusedIdentifiersCheck(node);
87303
87253
  }
87304
87254
  function checkClassDeclaration(node) {
87305
87255
  const firstDecorator = find(node.modifiers, isDecorator);
@@ -87311,7 +87261,7 @@ function createTypeChecker(host) {
87311
87261
  }
87312
87262
  checkClassLikeDeclaration(node);
87313
87263
  forEach(node.members, checkSourceElement);
87314
- registerForUnusedOrUninitializedIdentifiersCheck(node);
87264
+ registerForUnusedIdentifiersCheck(node);
87315
87265
  }
87316
87266
  function checkClassLikeDeclaration(node) {
87317
87267
  checkGrammarClassLikeDeclaration(node);
@@ -87867,7 +87817,7 @@ function createTypeChecker(host) {
87867
87817
  forEach(node.members, checkSourceElement);
87868
87818
  addLazyDiagnostic(() => {
87869
87819
  checkTypeForDuplicateIndexSignatures(node);
87870
- registerForUnusedOrUninitializedIdentifiersCheck(node);
87820
+ registerForUnusedIdentifiersCheck(node);
87871
87821
  });
87872
87822
  }
87873
87823
  function checkTypeAliasDeclaration(node) {
@@ -87883,7 +87833,7 @@ function createTypeChecker(host) {
87883
87833
  }
87884
87834
  } else {
87885
87835
  checkSourceElement(node.type);
87886
- registerForUnusedOrUninitializedIdentifiersCheck(node);
87836
+ registerForUnusedIdentifiersCheck(node);
87887
87837
  }
87888
87838
  }
87889
87839
  function computeEnumMemberValues(node) {
@@ -88145,7 +88095,7 @@ function createTypeChecker(host) {
88145
88095
  if (node.body) {
88146
88096
  checkSourceElement(node.body);
88147
88097
  if (!isGlobalScopeAugmentation(node)) {
88148
- registerForUnusedOrUninitializedIdentifiersCheck(node);
88098
+ registerForUnusedIdentifiersCheck(node);
88149
88099
  }
88150
88100
  }
88151
88101
  addLazyDiagnostic(checkModuleDeclarationDiagnostics);
@@ -89190,8 +89140,8 @@ function createTypeChecker(host) {
89190
89140
  return Debug.assertNever(kind);
89191
89141
  }
89192
89142
  }
89193
- function getPotentiallyUnusedOrUninitializedIdentifiers(sourceFile) {
89194
- return allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path) || emptyArray;
89143
+ function getPotentiallyUnusedIdentifiers(sourceFile) {
89144
+ return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray;
89195
89145
  }
89196
89146
  function checkSourceFileWorker(node) {
89197
89147
  const links = getNodeLinks(node);
@@ -89216,21 +89166,15 @@ function createTypeChecker(host) {
89216
89166
  checkSourceElement(node.endOfFileToken);
89217
89167
  checkDeferredNodes(node);
89218
89168
  if (isExternalOrCommonJsModule(node)) {
89219
- registerForUnusedOrUninitializedIdentifiersCheck(node);
89169
+ registerForUnusedIdentifiersCheck(node);
89220
89170
  }
89221
89171
  addLazyDiagnostic(() => {
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
- );
89172
+ if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
89173
+ checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => {
89174
+ if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
89175
+ diagnostics.add(diag2);
89176
+ }
89177
+ });
89234
89178
  }
89235
89179
  if (!node.isDeclarationFile) {
89236
89180
  checkPotentialUncheckedRenamedBindingElementsInTypes();
@@ -179538,6 +179482,7 @@ __export(ts_exports2, {
179538
179482
  decodeMappings: () => decodeMappings,
179539
179483
  decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
179540
179484
  deduplicate: () => deduplicate,
179485
+ defaultInitCompilerOptions: () => defaultInitCompilerOptions,
179541
179486
  defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
179542
179487
  diagnosticCategoryName: () => diagnosticCategoryName,
179543
179488
  diagnosticToString: () => diagnosticToString,
@@ -193922,6 +193867,7 @@ if (typeof console !== "undefined") {
193922
193867
  decodeMappings,
193923
193868
  decodedTextSpanIntersectsWith,
193924
193869
  deduplicate,
193870
+ defaultInitCompilerOptions,
193925
193871
  defaultMaximumTruncationLength,
193926
193872
  diagnosticCategoryName,
193927
193873
  diagnosticToString,
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-55887-54",
5
+ "version": "5.6.0-pr-59436-2",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [