@typescript-deploys/pr-build 5.6.0-pr-52095-71 → 5.6.0-pr-55887-76

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
@@ -17134,6 +17134,9 @@ function accessKind(node) {
17134
17134
  return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
17135
17135
  case 209 /* ArrayLiteralExpression */:
17136
17136
  return accessKind(parent);
17137
+ case 249 /* ForInStatement */:
17138
+ case 250 /* ForOfStatement */:
17139
+ return node === parent.initializer ? 1 /* Write */ : 0 /* Read */;
17137
17140
  default:
17138
17141
  return 0 /* Read */;
17139
17142
  }
@@ -69774,6 +69777,12 @@ function createTypeChecker(host) {
69774
69777
  function getControlFlowContainer(node) {
69775
69778
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 307 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
69776
69779
  }
69780
+ function isSymbolAssignedDefinitely(symbol) {
69781
+ if (symbol.lastAssignmentPos !== void 0) {
69782
+ return symbol.lastAssignmentPos < 0;
69783
+ }
69784
+ return isSymbolAssigned(symbol) && symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
69785
+ }
69777
69786
  function isSymbolAssigned(symbol) {
69778
69787
  return !isPastLastAssignment(
69779
69788
  symbol,
@@ -69793,7 +69802,7 @@ function createTypeChecker(host) {
69793
69802
  markNodeAssignments(parent);
69794
69803
  }
69795
69804
  }
69796
- return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
69805
+ return !symbol.lastAssignmentPos || location && Math.abs(symbol.lastAssignmentPos) < location.pos;
69797
69806
  }
69798
69807
  function isSomeSymbolAssigned(rootDeclaration) {
69799
69808
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -69814,12 +69823,19 @@ function createTypeChecker(host) {
69814
69823
  function markNodeAssignments(node) {
69815
69824
  switch (node.kind) {
69816
69825
  case 80 /* Identifier */:
69817
- if (isAssignmentTarget(node)) {
69826
+ const assigmentTarget = getAssignmentTargetKind(node);
69827
+ if (assigmentTarget !== 0 /* None */) {
69818
69828
  const symbol = getResolvedSymbol(node);
69819
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
69820
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
69821
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69822
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
69829
+ const hasDefiniteAssignment = assigmentTarget === 1 /* Definite */ || symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
69830
+ if (isParameterOrMutableLocalVariable(symbol)) {
69831
+ if (symbol.lastAssignmentPos === void 0 || Math.abs(symbol.lastAssignmentPos) !== Number.MAX_VALUE) {
69832
+ const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
69833
+ const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
69834
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
69835
+ }
69836
+ if (hasDefiniteAssignment && symbol.lastAssignmentPos > 0) {
69837
+ symbol.lastAssignmentPos = -symbol.lastAssignmentPos;
69838
+ }
69823
69839
  }
69824
69840
  }
69825
69841
  return;
@@ -69836,7 +69852,8 @@ function createTypeChecker(host) {
69836
69852
  true
69837
69853
  );
69838
69854
  if (symbol && isParameterOrMutableLocalVariable(symbol)) {
69839
- symbol.lastAssignmentPos = Number.MAX_VALUE;
69855
+ const sign = symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0 ? -1 : 1;
69856
+ symbol.lastAssignmentPos = sign * Number.MAX_VALUE;
69840
69857
  }
69841
69858
  }
69842
69859
  return;
@@ -70420,6 +70437,7 @@ function createTypeChecker(host) {
70420
70437
  }
70421
70438
  const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
70422
70439
  let declaration = localOrExportSymbol.valueDeclaration;
70440
+ const immediateDeclaration = declaration;
70423
70441
  if (declaration && declaration.kind === 208 /* BindingElement */ && contains(contextualBindingPatterns, declaration.parent) && findAncestor(node, (parent) => parent === declaration.parent)) {
70424
70442
  return nonInferrableAnyType;
70425
70443
  }
@@ -70465,7 +70483,8 @@ function createTypeChecker(host) {
70465
70483
  while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
70466
70484
  flowContainer = getControlFlowContainer(flowContainer);
70467
70485
  }
70468
- const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
70486
+ const isNeverInitialized = immediateDeclaration && isVariableDeclaration(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol);
70487
+ const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
70469
70488
  const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type);
70470
70489
  const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer);
70471
70490
  if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {