@typescript-deploys/pr-build 5.4.0-pr-56877-6 → 5.4.0-pr-56908-17

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.4";
21
- var version = `${versionMajorMinor}.0-insiders.20231226`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231231`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -12913,6 +12913,9 @@ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
12913
12913
  function getContainingFunction(node) {
12914
12914
  return findAncestor(node.parent, isFunctionLike);
12915
12915
  }
12916
+ function getContainingFunctionDeclaration(node) {
12917
+ return findAncestor(node.parent, isFunctionLikeDeclaration);
12918
+ }
12916
12919
  function getContainingClass(node) {
12917
12920
  return findAncestor(node.parent, isClassLike);
12918
12921
  }
@@ -16081,7 +16084,7 @@ function Symbol4(flags, name) {
16081
16084
  this.exportSymbol = void 0;
16082
16085
  this.constEnumOnlyModule = void 0;
16083
16086
  this.isReferenced = void 0;
16084
- this.isAssigned = void 0;
16087
+ this.lastAssignmentPos = void 0;
16085
16088
  this.links = void 0;
16086
16089
  }
16087
16090
  function Type3(checker, flags) {
@@ -17503,13 +17506,6 @@ function hasContextSensitiveParameters(node) {
17503
17506
  function isInfinityOrNaNString(name) {
17504
17507
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
17505
17508
  }
17506
- function isCatchClauseVariableDeclaration(node) {
17507
- return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
17508
- }
17509
- function isParameterOrCatchClauseVariable(symbol) {
17510
- const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
17511
- return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
17512
- }
17513
17509
  function isFunctionExpressionOrArrowFunction(node) {
17514
17510
  return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
17515
17511
  }
@@ -66154,7 +66150,7 @@ function createTypeChecker(host) {
66154
66150
  case 80 /* Identifier */:
66155
66151
  if (!isThisInTypeQuery(node)) {
66156
66152
  const symbol = getResolvedSymbol(node);
66157
- return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
66153
+ return isConstantVariable(symbol) || isParameterOrLetOrCatchVariable(symbol) && !isSymbolAssigned(symbol);
66158
66154
  }
66159
66155
  break;
66160
66156
  case 211 /* PropertyAccessExpression */:
@@ -67244,10 +67240,17 @@ function createTypeChecker(host) {
67244
67240
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
67245
67241
  }
67246
67242
  function isSymbolAssigned(symbol) {
67247
- if (!symbol.valueDeclaration) {
67243
+ return !isPastLastAssignment(
67244
+ symbol,
67245
+ /*location*/
67246
+ void 0
67247
+ );
67248
+ }
67249
+ function isPastLastAssignment(symbol, location) {
67250
+ const parent = findAncestor(symbol.valueDeclaration, isAssignmentMarkingContainer);
67251
+ if (!parent) {
67248
67252
  return false;
67249
67253
  }
67250
- const parent = getRootDeclaration(symbol.valueDeclaration).parent;
67251
67254
  const links = getNodeLinks(parent);
67252
67255
  if (!(links.flags & 131072 /* AssignmentsMarked */)) {
67253
67256
  links.flags |= 131072 /* AssignmentsMarked */;
@@ -67255,7 +67258,7 @@ function createTypeChecker(host) {
67255
67258
  markNodeAssignments(parent);
67256
67259
  }
67257
67260
  }
67258
- return symbol.isAssigned || false;
67261
+ return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
67259
67262
  }
67260
67263
  function isSomeSymbolAssigned(rootDeclaration) {
67261
67264
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -67268,23 +67271,60 @@ function createTypeChecker(host) {
67268
67271
  return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
67269
67272
  }
67270
67273
  function hasParentWithAssignmentsMarked(node) {
67271
- return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
67274
+ return !!findAncestor(node.parent, (node2) => isAssignmentMarkingContainer(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
67275
+ }
67276
+ function isAssignmentMarkingContainer(node) {
67277
+ return isFunctionLikeDeclaration(node) || isBlock(node) || isSourceFile(node) || isForStatement(node) || isForInOrOfStatement(node) || isCatchClause(node);
67272
67278
  }
67273
67279
  function markNodeAssignments(node) {
67274
- if (node.kind === 80 /* Identifier */) {
67275
- if (isAssignmentTarget(node)) {
67276
- const symbol = getResolvedSymbol(node);
67277
- if (isParameterOrCatchClauseVariable(symbol)) {
67278
- symbol.isAssigned = true;
67279
- }
67280
+ let statementEnd;
67281
+ markAssignments(node);
67282
+ function markAssignments(node2) {
67283
+ switch (node2.kind) {
67284
+ case 80 /* Identifier */:
67285
+ if (isAssignmentTarget(node2)) {
67286
+ const symbol = getResolvedSymbol(node2);
67287
+ if (isParameterOrLetOrCatchVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
67288
+ const referencingFunction = getContainingFunctionDeclaration(node2) || getSourceFileOfNode(node2);
67289
+ const declaringFunction = getContainingFunctionDeclaration(symbol.valueDeclaration) || getSourceFileOfNode(node2);
67290
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? statementEnd ?? node2.pos : Number.MAX_VALUE;
67291
+ }
67292
+ }
67293
+ return;
67294
+ case 243 /* VariableStatement */:
67295
+ case 244 /* ExpressionStatement */:
67296
+ case 245 /* IfStatement */:
67297
+ case 246 /* DoStatement */:
67298
+ case 247 /* WhileStatement */:
67299
+ case 248 /* ForStatement */:
67300
+ case 249 /* ForInStatement */:
67301
+ case 250 /* ForOfStatement */:
67302
+ case 254 /* WithStatement */:
67303
+ case 255 /* SwitchStatement */:
67304
+ case 258 /* TryStatement */:
67305
+ case 263 /* ClassDeclaration */:
67306
+ const saveStatementEnd = statementEnd;
67307
+ statementEnd ?? (statementEnd = node2.end);
67308
+ forEachChild(node2, markAssignments);
67309
+ statementEnd = saveStatementEnd;
67310
+ return;
67311
+ case 264 /* InterfaceDeclaration */:
67312
+ case 265 /* TypeAliasDeclaration */:
67313
+ case 266 /* EnumDeclaration */:
67314
+ return;
67315
+ }
67316
+ if (!isTypeNode(node2)) {
67317
+ forEachChild(node2, markAssignments);
67280
67318
  }
67281
- } else {
67282
- forEachChild(node, markNodeAssignments);
67283
67319
  }
67284
67320
  }
67285
67321
  function isConstantVariable(symbol) {
67286
67322
  return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
67287
67323
  }
67324
+ function isParameterOrLetOrCatchVariable(symbol) {
67325
+ const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
67326
+ return !!(declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (declaration.parent.kind === 299 /* CatchClause */ || declaration.parent.flags & 1 /* Let */)));
67327
+ }
67288
67328
  function parameterInitializerContainsUndefined(declaration) {
67289
67329
  const links = getNodeLinks(declaration);
67290
67330
  if (links.parameterInitializerContainsUndefined === void 0) {
@@ -67533,7 +67573,7 @@ function createTypeChecker(host) {
67533
67573
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
67534
67574
  const typeIsAutomatic = type === autoType || type === autoArrayType;
67535
67575
  const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
67536
- while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
67576
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrLetOrCatchVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
67537
67577
  flowContainer = getControlFlowContainer(flowContainer);
67538
67578
  }
67539
67579
  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 */;
@@ -74042,7 +74082,7 @@ function createTypeChecker(host) {
74042
74082
  if (!witnesses) {
74043
74083
  return false;
74044
74084
  }
74045
- const operandConstraint = getBaseConstraintOfType(checkExpressionCached(node.expression.expression)) || unknownType;
74085
+ const operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
74046
74086
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
74047
74087
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
74048
74088
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
package/lib/tsserver.js CHANGED
@@ -1251,7 +1251,6 @@ __export(server_exports, {
1251
1251
  isCaseKeyword: () => isCaseKeyword,
1252
1252
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
1253
1253
  isCatchClause: () => isCatchClause,
1254
- isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
1255
1254
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
1256
1255
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
1257
1256
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -1653,7 +1652,6 @@ __export(server_exports, {
1653
1652
  isPackedArrayLiteral: () => isPackedArrayLiteral,
1654
1653
  isParameter: () => isParameter,
1655
1654
  isParameterDeclaration: () => isParameterDeclaration,
1656
- isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
1657
1655
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
1658
1656
  isParameterPropertyModifier: () => isParameterPropertyModifier,
1659
1657
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -2339,7 +2337,7 @@ module.exports = __toCommonJS(server_exports);
2339
2337
 
2340
2338
  // src/compiler/corePublic.ts
2341
2339
  var versionMajorMinor = "5.4";
2342
- var version = `${versionMajorMinor}.0-insiders.20231226`;
2340
+ var version = `${versionMajorMinor}.0-insiders.20231231`;
2343
2341
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2344
2342
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2345
2343
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -20232,7 +20230,7 @@ function Symbol4(flags, name) {
20232
20230
  this.exportSymbol = void 0;
20233
20231
  this.constEnumOnlyModule = void 0;
20234
20232
  this.isReferenced = void 0;
20235
- this.isAssigned = void 0;
20233
+ this.lastAssignmentPos = void 0;
20236
20234
  this.links = void 0;
20237
20235
  }
20238
20236
  function Type3(checker, flags) {
@@ -21704,13 +21702,6 @@ function hasContextSensitiveParameters(node) {
21704
21702
  function isInfinityOrNaNString(name) {
21705
21703
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
21706
21704
  }
21707
- function isCatchClauseVariableDeclaration(node) {
21708
- return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
21709
- }
21710
- function isParameterOrCatchClauseVariable(symbol) {
21711
- const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
21712
- return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
21713
- }
21714
21705
  function isFunctionExpressionOrArrowFunction(node) {
21715
21706
  return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
21716
21707
  }
@@ -70873,7 +70864,7 @@ function createTypeChecker(host) {
70873
70864
  case 80 /* Identifier */:
70874
70865
  if (!isThisInTypeQuery(node)) {
70875
70866
  const symbol = getResolvedSymbol(node);
70876
- return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
70867
+ return isConstantVariable(symbol) || isParameterOrLetOrCatchVariable(symbol) && !isSymbolAssigned(symbol);
70877
70868
  }
70878
70869
  break;
70879
70870
  case 211 /* PropertyAccessExpression */:
@@ -71963,10 +71954,17 @@ function createTypeChecker(host) {
71963
71954
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
71964
71955
  }
71965
71956
  function isSymbolAssigned(symbol) {
71966
- if (!symbol.valueDeclaration) {
71957
+ return !isPastLastAssignment(
71958
+ symbol,
71959
+ /*location*/
71960
+ void 0
71961
+ );
71962
+ }
71963
+ function isPastLastAssignment(symbol, location) {
71964
+ const parent2 = findAncestor(symbol.valueDeclaration, isAssignmentMarkingContainer);
71965
+ if (!parent2) {
71967
71966
  return false;
71968
71967
  }
71969
- const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
71970
71968
  const links = getNodeLinks(parent2);
71971
71969
  if (!(links.flags & 131072 /* AssignmentsMarked */)) {
71972
71970
  links.flags |= 131072 /* AssignmentsMarked */;
@@ -71974,7 +71972,7 @@ function createTypeChecker(host) {
71974
71972
  markNodeAssignments(parent2);
71975
71973
  }
71976
71974
  }
71977
- return symbol.isAssigned || false;
71975
+ return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
71978
71976
  }
71979
71977
  function isSomeSymbolAssigned(rootDeclaration) {
71980
71978
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -71987,23 +71985,60 @@ function createTypeChecker(host) {
71987
71985
  return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
71988
71986
  }
71989
71987
  function hasParentWithAssignmentsMarked(node) {
71990
- return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
71988
+ return !!findAncestor(node.parent, (node2) => isAssignmentMarkingContainer(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
71989
+ }
71990
+ function isAssignmentMarkingContainer(node) {
71991
+ return isFunctionLikeDeclaration(node) || isBlock(node) || isSourceFile(node) || isForStatement(node) || isForInOrOfStatement(node) || isCatchClause(node);
71991
71992
  }
71992
71993
  function markNodeAssignments(node) {
71993
- if (node.kind === 80 /* Identifier */) {
71994
- if (isAssignmentTarget(node)) {
71995
- const symbol = getResolvedSymbol(node);
71996
- if (isParameterOrCatchClauseVariable(symbol)) {
71997
- symbol.isAssigned = true;
71998
- }
71994
+ let statementEnd;
71995
+ markAssignments(node);
71996
+ function markAssignments(node2) {
71997
+ switch (node2.kind) {
71998
+ case 80 /* Identifier */:
71999
+ if (isAssignmentTarget(node2)) {
72000
+ const symbol = getResolvedSymbol(node2);
72001
+ if (isParameterOrLetOrCatchVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
72002
+ const referencingFunction = getContainingFunctionDeclaration(node2) || getSourceFileOfNode(node2);
72003
+ const declaringFunction = getContainingFunctionDeclaration(symbol.valueDeclaration) || getSourceFileOfNode(node2);
72004
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? statementEnd ?? node2.pos : Number.MAX_VALUE;
72005
+ }
72006
+ }
72007
+ return;
72008
+ case 243 /* VariableStatement */:
72009
+ case 244 /* ExpressionStatement */:
72010
+ case 245 /* IfStatement */:
72011
+ case 246 /* DoStatement */:
72012
+ case 247 /* WhileStatement */:
72013
+ case 248 /* ForStatement */:
72014
+ case 249 /* ForInStatement */:
72015
+ case 250 /* ForOfStatement */:
72016
+ case 254 /* WithStatement */:
72017
+ case 255 /* SwitchStatement */:
72018
+ case 258 /* TryStatement */:
72019
+ case 263 /* ClassDeclaration */:
72020
+ const saveStatementEnd = statementEnd;
72021
+ statementEnd ?? (statementEnd = node2.end);
72022
+ forEachChild(node2, markAssignments);
72023
+ statementEnd = saveStatementEnd;
72024
+ return;
72025
+ case 264 /* InterfaceDeclaration */:
72026
+ case 265 /* TypeAliasDeclaration */:
72027
+ case 266 /* EnumDeclaration */:
72028
+ return;
72029
+ }
72030
+ if (!isTypeNode(node2)) {
72031
+ forEachChild(node2, markAssignments);
71999
72032
  }
72000
- } else {
72001
- forEachChild(node, markNodeAssignments);
72002
72033
  }
72003
72034
  }
72004
72035
  function isConstantVariable(symbol) {
72005
72036
  return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
72006
72037
  }
72038
+ function isParameterOrLetOrCatchVariable(symbol) {
72039
+ const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
72040
+ return !!(declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (declaration.parent.kind === 299 /* CatchClause */ || declaration.parent.flags & 1 /* Let */)));
72041
+ }
72007
72042
  function parameterInitializerContainsUndefined(declaration) {
72008
72043
  const links = getNodeLinks(declaration);
72009
72044
  if (links.parameterInitializerContainsUndefined === void 0) {
@@ -72252,7 +72287,7 @@ function createTypeChecker(host) {
72252
72287
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
72253
72288
  const typeIsAutomatic = type === autoType || type === autoArrayType;
72254
72289
  const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
72255
- while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
72290
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrLetOrCatchVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
72256
72291
  flowContainer = getControlFlowContainer(flowContainer);
72257
72292
  }
72258
72293
  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 */;
@@ -78761,7 +78796,7 @@ function createTypeChecker(host) {
78761
78796
  if (!witnesses) {
78762
78797
  return false;
78763
78798
  }
78764
- const operandConstraint = getBaseConstraintOfType(checkExpressionCached(node.expression.expression)) || unknownType;
78799
+ const operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
78765
78800
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
78766
78801
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
78767
78802
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
@@ -174921,7 +174956,6 @@ __export(ts_exports2, {
174921
174956
  isCaseKeyword: () => isCaseKeyword,
174922
174957
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
174923
174958
  isCatchClause: () => isCatchClause,
174924
- isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
174925
174959
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
174926
174960
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
174927
174961
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -175323,7 +175357,6 @@ __export(ts_exports2, {
175323
175357
  isPackedArrayLiteral: () => isPackedArrayLiteral,
175324
175358
  isParameter: () => isParameter,
175325
175359
  isParameterDeclaration: () => isParameterDeclaration,
175326
- isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
175327
175360
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
175328
175361
  isParameterPropertyModifier: () => isParameterPropertyModifier,
175329
175362
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -189720,7 +189753,6 @@ start(initializeNodeSystem(), require("os").platform());
189720
189753
  isCaseKeyword,
189721
189754
  isCaseOrDefaultClause,
189722
189755
  isCatchClause,
189723
- isCatchClauseVariableDeclaration,
189724
189756
  isCatchClauseVariableDeclarationOrBindingElement,
189725
189757
  isCheckJsEnabledForFile,
189726
189758
  isChildOfNodeWithKind,
@@ -190122,7 +190154,6 @@ start(initializeNodeSystem(), require("os").platform());
190122
190154
  isPackedArrayLiteral,
190123
190155
  isParameter,
190124
190156
  isParameterDeclaration,
190125
- isParameterOrCatchClauseVariable,
190126
190157
  isParameterPropertyDeclaration,
190127
190158
  isParameterPropertyModifier,
190128
190159
  isParenthesizedExpression,
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = `${versionMajorMinor}.0-insiders.20231226`;
38
+ version = `${versionMajorMinor}.0-insiders.20231231`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -17522,7 +17522,7 @@ ${lanes.join("\n")}
17522
17522
  this.exportSymbol = void 0;
17523
17523
  this.constEnumOnlyModule = void 0;
17524
17524
  this.isReferenced = void 0;
17525
- this.isAssigned = void 0;
17525
+ this.lastAssignmentPos = void 0;
17526
17526
  this.links = void 0;
17527
17527
  }
17528
17528
  function Type3(checker, flags) {
@@ -18701,13 +18701,6 @@ ${lanes.join("\n")}
18701
18701
  function isInfinityOrNaNString(name) {
18702
18702
  return name === "Infinity" || name === "-Infinity" || name === "NaN";
18703
18703
  }
18704
- function isCatchClauseVariableDeclaration(node) {
18705
- return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
18706
- }
18707
- function isParameterOrCatchClauseVariable(symbol) {
18708
- const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
18709
- return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
18710
- }
18711
18704
  function isFunctionExpressionOrArrowFunction(node) {
18712
18705
  return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
18713
18706
  }
@@ -68629,7 +68622,7 @@ ${lanes.join("\n")}
68629
68622
  case 80 /* Identifier */:
68630
68623
  if (!isThisInTypeQuery(node)) {
68631
68624
  const symbol = getResolvedSymbol(node);
68632
- return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
68625
+ return isConstantVariable(symbol) || isParameterOrLetOrCatchVariable(symbol) && !isSymbolAssigned(symbol);
68633
68626
  }
68634
68627
  break;
68635
68628
  case 211 /* PropertyAccessExpression */:
@@ -69719,10 +69712,17 @@ ${lanes.join("\n")}
69719
69712
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
69720
69713
  }
69721
69714
  function isSymbolAssigned(symbol) {
69722
- if (!symbol.valueDeclaration) {
69715
+ return !isPastLastAssignment(
69716
+ symbol,
69717
+ /*location*/
69718
+ void 0
69719
+ );
69720
+ }
69721
+ function isPastLastAssignment(symbol, location) {
69722
+ const parent2 = findAncestor(symbol.valueDeclaration, isAssignmentMarkingContainer);
69723
+ if (!parent2) {
69723
69724
  return false;
69724
69725
  }
69725
- const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
69726
69726
  const links = getNodeLinks(parent2);
69727
69727
  if (!(links.flags & 131072 /* AssignmentsMarked */)) {
69728
69728
  links.flags |= 131072 /* AssignmentsMarked */;
@@ -69730,7 +69730,7 @@ ${lanes.join("\n")}
69730
69730
  markNodeAssignments(parent2);
69731
69731
  }
69732
69732
  }
69733
- return symbol.isAssigned || false;
69733
+ return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
69734
69734
  }
69735
69735
  function isSomeSymbolAssigned(rootDeclaration) {
69736
69736
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -69743,23 +69743,60 @@ ${lanes.join("\n")}
69743
69743
  return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
69744
69744
  }
69745
69745
  function hasParentWithAssignmentsMarked(node) {
69746
- return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
69746
+ return !!findAncestor(node.parent, (node2) => isAssignmentMarkingContainer(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
69747
+ }
69748
+ function isAssignmentMarkingContainer(node) {
69749
+ return isFunctionLikeDeclaration(node) || isBlock(node) || isSourceFile(node) || isForStatement(node) || isForInOrOfStatement(node) || isCatchClause(node);
69747
69750
  }
69748
69751
  function markNodeAssignments(node) {
69749
- if (node.kind === 80 /* Identifier */) {
69750
- if (isAssignmentTarget(node)) {
69751
- const symbol = getResolvedSymbol(node);
69752
- if (isParameterOrCatchClauseVariable(symbol)) {
69753
- symbol.isAssigned = true;
69754
- }
69752
+ let statementEnd;
69753
+ markAssignments(node);
69754
+ function markAssignments(node2) {
69755
+ switch (node2.kind) {
69756
+ case 80 /* Identifier */:
69757
+ if (isAssignmentTarget(node2)) {
69758
+ const symbol = getResolvedSymbol(node2);
69759
+ if (isParameterOrLetOrCatchVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
69760
+ const referencingFunction = getContainingFunctionDeclaration(node2) || getSourceFileOfNode(node2);
69761
+ const declaringFunction = getContainingFunctionDeclaration(symbol.valueDeclaration) || getSourceFileOfNode(node2);
69762
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? statementEnd ?? node2.pos : Number.MAX_VALUE;
69763
+ }
69764
+ }
69765
+ return;
69766
+ case 243 /* VariableStatement */:
69767
+ case 244 /* ExpressionStatement */:
69768
+ case 245 /* IfStatement */:
69769
+ case 246 /* DoStatement */:
69770
+ case 247 /* WhileStatement */:
69771
+ case 248 /* ForStatement */:
69772
+ case 249 /* ForInStatement */:
69773
+ case 250 /* ForOfStatement */:
69774
+ case 254 /* WithStatement */:
69775
+ case 255 /* SwitchStatement */:
69776
+ case 258 /* TryStatement */:
69777
+ case 263 /* ClassDeclaration */:
69778
+ const saveStatementEnd = statementEnd;
69779
+ statementEnd ?? (statementEnd = node2.end);
69780
+ forEachChild(node2, markAssignments);
69781
+ statementEnd = saveStatementEnd;
69782
+ return;
69783
+ case 264 /* InterfaceDeclaration */:
69784
+ case 265 /* TypeAliasDeclaration */:
69785
+ case 266 /* EnumDeclaration */:
69786
+ return;
69787
+ }
69788
+ if (!isTypeNode(node2)) {
69789
+ forEachChild(node2, markAssignments);
69755
69790
  }
69756
- } else {
69757
- forEachChild(node, markNodeAssignments);
69758
69791
  }
69759
69792
  }
69760
69793
  function isConstantVariable(symbol) {
69761
69794
  return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
69762
69795
  }
69796
+ function isParameterOrLetOrCatchVariable(symbol) {
69797
+ const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
69798
+ return !!(declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (declaration.parent.kind === 299 /* CatchClause */ || declaration.parent.flags & 1 /* Let */)));
69799
+ }
69763
69800
  function parameterInitializerContainsUndefined(declaration) {
69764
69801
  const links = getNodeLinks(declaration);
69765
69802
  if (links.parameterInitializerContainsUndefined === void 0) {
@@ -70008,7 +70045,7 @@ ${lanes.join("\n")}
70008
70045
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
70009
70046
  const typeIsAutomatic = type === autoType || type === autoArrayType;
70010
70047
  const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
70011
- while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
70048
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrLetOrCatchVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
70012
70049
  flowContainer = getControlFlowContainer(flowContainer);
70013
70050
  }
70014
70051
  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 */;
@@ -76517,7 +76554,7 @@ ${lanes.join("\n")}
76517
76554
  if (!witnesses) {
76518
76555
  return false;
76519
76556
  }
76520
- const operandConstraint = getBaseConstraintOfType(checkExpressionCached(node.expression.expression)) || unknownType;
76557
+ const operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
76521
76558
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
76522
76559
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
76523
76560
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
@@ -186472,7 +186509,6 @@ ${e.message}`;
186472
186509
  isCaseKeyword: () => isCaseKeyword,
186473
186510
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
186474
186511
  isCatchClause: () => isCatchClause,
186475
- isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
186476
186512
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
186477
186513
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
186478
186514
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -186874,7 +186910,6 @@ ${e.message}`;
186874
186910
  isPackedArrayLiteral: () => isPackedArrayLiteral,
186875
186911
  isParameter: () => isParameter,
186876
186912
  isParameterDeclaration: () => isParameterDeclaration,
186877
- isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
186878
186913
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
186879
186914
  isParameterPropertyModifier: () => isParameterPropertyModifier,
186880
186915
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -188892,7 +188927,6 @@ ${e.message}`;
188892
188927
  isCaseKeyword: () => isCaseKeyword,
188893
188928
  isCaseOrDefaultClause: () => isCaseOrDefaultClause,
188894
188929
  isCatchClause: () => isCatchClause,
188895
- isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
188896
188930
  isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
188897
188931
  isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
188898
188932
  isChildOfNodeWithKind: () => isChildOfNodeWithKind,
@@ -189294,7 +189328,6 @@ ${e.message}`;
189294
189328
  isPackedArrayLiteral: () => isPackedArrayLiteral,
189295
189329
  isParameter: () => isParameter,
189296
189330
  isParameterDeclaration: () => isParameterDeclaration,
189297
- isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
189298
189331
  isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
189299
189332
  isParameterPropertyModifier: () => isParameterPropertyModifier,
189300
189333
  isParenthesizedExpression: () => isParenthesizedExpression,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-insiders.20231226`;
57
+ var version = `${versionMajorMinor}.0-insiders.20231231`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -11129,7 +11129,7 @@ function Symbol4(flags, name) {
11129
11129
  this.exportSymbol = void 0;
11130
11130
  this.constEnumOnlyModule = void 0;
11131
11131
  this.isReferenced = void 0;
11132
- this.isAssigned = void 0;
11132
+ this.lastAssignmentPos = void 0;
11133
11133
  this.links = void 0;
11134
11134
  }
11135
11135
  function Type3(checker, flags) {
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.4.0-pr-56877-6",
5
+ "version": "5.4.0-pr-56908-17",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "4fe64133abca119ba5665a6d6b4190cb46ac69c7"
117
+ "gitHead": "04c952ee8448121bfb4aaa4b847226c087f15635"
118
118
  }