@typescript-deploys/pr-build 5.6.0-pr-59388-4 → 5.6.0-pr-59217-23

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
@@ -6691,6 +6691,11 @@ var Diagnostics = {
6691
6691
  Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
6692
6692
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun: diag(2867, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2867", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`."),
6693
6693
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig: diag(2868, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2868", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig."),
6694
+ Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish: diag(2869, 1 /* Error */, "Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish_2869", "Right operand of ?? is unreachable because the left operand is never nullish."),
6695
+ This_binary_expression_is_never_nullish_Are_you_missing_parentheses: diag(2870, 1 /* Error */, "This_binary_expression_is_never_nullish_Are_you_missing_parentheses_2870", "This binary expression is never nullish. Are you missing parentheses?"),
6696
+ This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
6697
+ 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."),
6698
+ 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."),
6694
6699
  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}'."),
6695
6700
  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}'."),
6696
6701
  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}'."),
@@ -77686,7 +77691,7 @@ function createTypeChecker(host) {
77686
77691
  setLastResult(state, checkExpression(node.right, checkMode));
77687
77692
  return state;
77688
77693
  }
77689
- checkGrammarNullishCoalesceWithLogicalExpression(node);
77694
+ checkNullishCoalesceOperands(node);
77690
77695
  const operator = node.operatorToken.kind;
77691
77696
  if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) {
77692
77697
  state.skip = true;
@@ -77719,7 +77724,9 @@ function createTypeChecker(host) {
77719
77724
  if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent)) {
77720
77725
  checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : void 0);
77721
77726
  }
77722
- checkTruthinessOfType(leftType, node.left);
77727
+ if (isBinaryLogicalOperator(operator)) {
77728
+ checkTruthinessOfType(leftType, node.left);
77729
+ }
77723
77730
  }
77724
77731
  }
77725
77732
  }
@@ -77776,7 +77783,7 @@ function createTypeChecker(host) {
77776
77783
  state.typeStack[state.stackIndex + 1] = type;
77777
77784
  }
77778
77785
  }
77779
- function checkGrammarNullishCoalesceWithLogicalExpression(node) {
77786
+ function checkNullishCoalesceOperands(node) {
77780
77787
  const { left, operatorToken, right } = node;
77781
77788
  if (operatorToken.kind === 61 /* QuestionQuestionToken */) {
77782
77789
  if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
@@ -77785,7 +77792,57 @@ function createTypeChecker(host) {
77785
77792
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
77786
77793
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
77787
77794
  }
77795
+ const leftTarget = skipOuterExpressions(left, 15 /* All */);
77796
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
77797
+ if (nullishSemantics !== 3 /* Sometimes */) {
77798
+ if (node.parent.kind === 226 /* BinaryExpression */) {
77799
+ error(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
77800
+ } else {
77801
+ if (nullishSemantics === 1 /* Always */) {
77802
+ error(leftTarget, Diagnostics.This_expression_is_always_nullish);
77803
+ } else {
77804
+ error(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
77805
+ }
77806
+ }
77807
+ }
77808
+ }
77809
+ }
77810
+ function getSyntacticNullishnessSemantics(node) {
77811
+ switch (node.kind) {
77812
+ case 223 /* AwaitExpression */:
77813
+ case 213 /* CallExpression */:
77814
+ case 212 /* ElementAccessExpression */:
77815
+ case 214 /* NewExpression */:
77816
+ case 211 /* PropertyAccessExpression */:
77817
+ case 229 /* YieldExpression */:
77818
+ return 3 /* Sometimes */;
77819
+ case 226 /* BinaryExpression */:
77820
+ switch (node.operatorToken.kind) {
77821
+ case 64 /* EqualsToken */:
77822
+ case 61 /* QuestionQuestionToken */:
77823
+ case 78 /* QuestionQuestionEqualsToken */:
77824
+ case 57 /* BarBarToken */:
77825
+ case 76 /* BarBarEqualsToken */:
77826
+ case 56 /* AmpersandAmpersandToken */:
77827
+ case 77 /* AmpersandAmpersandEqualsToken */:
77828
+ return 3 /* Sometimes */;
77829
+ }
77830
+ return 2 /* Never */;
77831
+ case 216 /* TypeAssertionExpression */:
77832
+ case 234 /* AsExpression */:
77833
+ case 217 /* ParenthesizedExpression */:
77834
+ return getSyntacticNullishnessSemantics(node.expression);
77835
+ case 227 /* ConditionalExpression */:
77836
+ return getSyntacticNullishnessSemantics(node.whenTrue) | getSyntacticNullishnessSemantics(node.whenFalse);
77837
+ case 106 /* NullKeyword */:
77838
+ return 1 /* Always */;
77839
+ case 80 /* Identifier */:
77840
+ if (getResolvedSymbol(node) === undefinedSymbol) {
77841
+ return 1 /* Always */;
77842
+ }
77843
+ return 3 /* Sometimes */;
77788
77844
  }
77845
+ return 2 /* Never */;
77789
77846
  }
77790
77847
  function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
77791
77848
  const operator = operatorToken.kind;
@@ -77793,7 +77850,7 @@ function createTypeChecker(host) {
77793
77850
  return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */);
77794
77851
  }
77795
77852
  let leftType;
77796
- if (isLogicalOrCoalescingBinaryOperator(operator)) {
77853
+ if (isBinaryLogicalOperator(operator)) {
77797
77854
  leftType = checkTruthinessExpression(left, checkMode);
77798
77855
  } else {
77799
77856
  leftType = checkExpression(left, checkMode);
@@ -81399,9 +81456,54 @@ function createTypeChecker(host) {
81399
81456
  function checkTruthinessOfType(type, node) {
81400
81457
  if (type.flags & 16384 /* Void */) {
81401
81458
  error(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
81459
+ } else {
81460
+ const semantics = getSyntacticTruthySemantics(node);
81461
+ if (semantics !== 3 /* Sometimes */) {
81462
+ error(
81463
+ node,
81464
+ semantics === 1 /* Always */ ? Diagnostics.This_kind_of_expression_is_always_truthy : Diagnostics.This_kind_of_expression_is_always_falsy
81465
+ );
81466
+ }
81402
81467
  }
81403
81468
  return type;
81404
81469
  }
81470
+ function getSyntacticTruthySemantics(node) {
81471
+ switch (node.kind) {
81472
+ case 9 /* NumericLiteral */:
81473
+ if (node.text === "0" || node.text === "1") {
81474
+ return 3 /* Sometimes */;
81475
+ }
81476
+ return 1 /* Always */;
81477
+ case 209 /* ArrayLiteralExpression */:
81478
+ case 219 /* ArrowFunction */:
81479
+ case 10 /* BigIntLiteral */:
81480
+ case 231 /* ClassExpression */:
81481
+ case 218 /* FunctionExpression */:
81482
+ case 284 /* JsxElement */:
81483
+ case 285 /* JsxSelfClosingElement */:
81484
+ case 210 /* ObjectLiteralExpression */:
81485
+ case 14 /* RegularExpressionLiteral */:
81486
+ return 1 /* Always */;
81487
+ case 222 /* VoidExpression */:
81488
+ case 106 /* NullKeyword */:
81489
+ return 2 /* Never */;
81490
+ case 15 /* NoSubstitutionTemplateLiteral */:
81491
+ case 11 /* StringLiteral */:
81492
+ return !!node.text ? 1 /* Always */ : 2 /* Never */;
81493
+ case 216 /* TypeAssertionExpression */:
81494
+ case 234 /* AsExpression */:
81495
+ case 217 /* ParenthesizedExpression */:
81496
+ return getSyntacticTruthySemantics(node.expression);
81497
+ case 227 /* ConditionalExpression */:
81498
+ return getSyntacticTruthySemantics(node.whenTrue) | getSyntacticTruthySemantics(node.whenFalse);
81499
+ case 80 /* Identifier */:
81500
+ if (getResolvedSymbol(node) === undefinedSymbol) {
81501
+ return 2 /* Never */;
81502
+ }
81503
+ return 3 /* Sometimes */;
81504
+ }
81505
+ return 3 /* Sometimes */;
81506
+ }
81405
81507
  function checkTruthinessExpression(node, checkMode) {
81406
81508
  return checkTruthinessOfType(checkExpression(node, checkMode), node);
81407
81509
  }
package/lib/typescript.js CHANGED
@@ -142,6 +142,7 @@ __export(typescript_exports, {
142
142
  PollingInterval: () => PollingInterval,
143
143
  PollingWatchKind: () => PollingWatchKind,
144
144
  PragmaKindFlags: () => PragmaKindFlags,
145
+ PredicateSemantics: () => PredicateSemantics,
145
146
  PrivateIdentifierKind: () => PrivateIdentifierKind,
146
147
  ProcessLevel: () => ProcessLevel,
147
148
  ProgramUpdateLevel: () => ProgramUpdateLevel,
@@ -1178,6 +1179,7 @@ __export(typescript_exports, {
1178
1179
  isAwaitKeyword: () => isAwaitKeyword,
1179
1180
  isBigIntLiteral: () => isBigIntLiteral,
1180
1181
  isBinaryExpression: () => isBinaryExpression,
1182
+ isBinaryLogicalOperator: () => isBinaryLogicalOperator,
1181
1183
  isBinaryOperatorToken: () => isBinaryOperatorToken,
1182
1184
  isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
1183
1185
  isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
@@ -5994,6 +5996,13 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
5994
5996
  RelationComparisonResult3[RelationComparisonResult3["Overflow"] = 96] = "Overflow";
5995
5997
  return RelationComparisonResult3;
5996
5998
  })(RelationComparisonResult || {});
5999
+ var PredicateSemantics = /* @__PURE__ */ ((PredicateSemantics2) => {
6000
+ PredicateSemantics2[PredicateSemantics2["None"] = 0] = "None";
6001
+ PredicateSemantics2[PredicateSemantics2["Always"] = 1] = "Always";
6002
+ PredicateSemantics2[PredicateSemantics2["Never"] = 2] = "Never";
6003
+ PredicateSemantics2[PredicateSemantics2["Sometimes"] = 3] = "Sometimes";
6004
+ return PredicateSemantics2;
6005
+ })(PredicateSemantics || {});
5997
6006
  var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
5998
6007
  GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["None"] = 0] = "None";
5999
6008
  GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Auto"] = 1] = "Auto";
@@ -10078,6 +10087,11 @@ var Diagnostics = {
10078
10087
  Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
10079
10088
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun: diag(2867, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2867", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`."),
10080
10089
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig: diag(2868, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2868", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig."),
10090
+ Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish: diag(2869, 1 /* Error */, "Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish_2869", "Right operand of ?? is unreachable because the left operand is never nullish."),
10091
+ This_binary_expression_is_never_nullish_Are_you_missing_parentheses: diag(2870, 1 /* Error */, "This_binary_expression_is_never_nullish_Are_you_missing_parentheses_2870", "This binary expression is never nullish. Are you missing parentheses?"),
10092
+ This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
10093
+ 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."),
10094
+ 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."),
10081
10095
  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}'."),
10082
10096
  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}'."),
10083
10097
  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}'."),
@@ -82295,7 +82309,7 @@ function createTypeChecker(host) {
82295
82309
  setLastResult(state, checkExpression(node.right, checkMode));
82296
82310
  return state;
82297
82311
  }
82298
- checkGrammarNullishCoalesceWithLogicalExpression(node);
82312
+ checkNullishCoalesceOperands(node);
82299
82313
  const operator = node.operatorToken.kind;
82300
82314
  if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) {
82301
82315
  state.skip = true;
@@ -82328,7 +82342,9 @@ function createTypeChecker(host) {
82328
82342
  if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) {
82329
82343
  checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
82330
82344
  }
82331
- checkTruthinessOfType(leftType, node.left);
82345
+ if (isBinaryLogicalOperator(operator)) {
82346
+ checkTruthinessOfType(leftType, node.left);
82347
+ }
82332
82348
  }
82333
82349
  }
82334
82350
  }
@@ -82385,7 +82401,7 @@ function createTypeChecker(host) {
82385
82401
  state.typeStack[state.stackIndex + 1] = type;
82386
82402
  }
82387
82403
  }
82388
- function checkGrammarNullishCoalesceWithLogicalExpression(node) {
82404
+ function checkNullishCoalesceOperands(node) {
82389
82405
  const { left, operatorToken, right } = node;
82390
82406
  if (operatorToken.kind === 61 /* QuestionQuestionToken */) {
82391
82407
  if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
@@ -82394,7 +82410,57 @@ function createTypeChecker(host) {
82394
82410
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
82395
82411
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
82396
82412
  }
82413
+ const leftTarget = skipOuterExpressions(left, 15 /* All */);
82414
+ const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
82415
+ if (nullishSemantics !== 3 /* Sometimes */) {
82416
+ if (node.parent.kind === 226 /* BinaryExpression */) {
82417
+ error2(leftTarget, Diagnostics.This_binary_expression_is_never_nullish_Are_you_missing_parentheses);
82418
+ } else {
82419
+ if (nullishSemantics === 1 /* Always */) {
82420
+ error2(leftTarget, Diagnostics.This_expression_is_always_nullish);
82421
+ } else {
82422
+ error2(leftTarget, Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish);
82423
+ }
82424
+ }
82425
+ }
82426
+ }
82427
+ }
82428
+ function getSyntacticNullishnessSemantics(node) {
82429
+ switch (node.kind) {
82430
+ case 223 /* AwaitExpression */:
82431
+ case 213 /* CallExpression */:
82432
+ case 212 /* ElementAccessExpression */:
82433
+ case 214 /* NewExpression */:
82434
+ case 211 /* PropertyAccessExpression */:
82435
+ case 229 /* YieldExpression */:
82436
+ return 3 /* Sometimes */;
82437
+ case 226 /* BinaryExpression */:
82438
+ switch (node.operatorToken.kind) {
82439
+ case 64 /* EqualsToken */:
82440
+ case 61 /* QuestionQuestionToken */:
82441
+ case 78 /* QuestionQuestionEqualsToken */:
82442
+ case 57 /* BarBarToken */:
82443
+ case 76 /* BarBarEqualsToken */:
82444
+ case 56 /* AmpersandAmpersandToken */:
82445
+ case 77 /* AmpersandAmpersandEqualsToken */:
82446
+ return 3 /* Sometimes */;
82447
+ }
82448
+ return 2 /* Never */;
82449
+ case 216 /* TypeAssertionExpression */:
82450
+ case 234 /* AsExpression */:
82451
+ case 217 /* ParenthesizedExpression */:
82452
+ return getSyntacticNullishnessSemantics(node.expression);
82453
+ case 227 /* ConditionalExpression */:
82454
+ return getSyntacticNullishnessSemantics(node.whenTrue) | getSyntacticNullishnessSemantics(node.whenFalse);
82455
+ case 106 /* NullKeyword */:
82456
+ return 1 /* Always */;
82457
+ case 80 /* Identifier */:
82458
+ if (getResolvedSymbol(node) === undefinedSymbol) {
82459
+ return 1 /* Always */;
82460
+ }
82461
+ return 3 /* Sometimes */;
82397
82462
  }
82463
+ return 2 /* Never */;
82398
82464
  }
82399
82465
  function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
82400
82466
  const operator = operatorToken.kind;
@@ -82402,7 +82468,7 @@ function createTypeChecker(host) {
82402
82468
  return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */);
82403
82469
  }
82404
82470
  let leftType;
82405
- if (isLogicalOrCoalescingBinaryOperator(operator)) {
82471
+ if (isBinaryLogicalOperator(operator)) {
82406
82472
  leftType = checkTruthinessExpression(left, checkMode);
82407
82473
  } else {
82408
82474
  leftType = checkExpression(left, checkMode);
@@ -86008,9 +86074,54 @@ function createTypeChecker(host) {
86008
86074
  function checkTruthinessOfType(type, node) {
86009
86075
  if (type.flags & 16384 /* Void */) {
86010
86076
  error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
86077
+ } else {
86078
+ const semantics = getSyntacticTruthySemantics(node);
86079
+ if (semantics !== 3 /* Sometimes */) {
86080
+ error2(
86081
+ node,
86082
+ semantics === 1 /* Always */ ? Diagnostics.This_kind_of_expression_is_always_truthy : Diagnostics.This_kind_of_expression_is_always_falsy
86083
+ );
86084
+ }
86011
86085
  }
86012
86086
  return type;
86013
86087
  }
86088
+ function getSyntacticTruthySemantics(node) {
86089
+ switch (node.kind) {
86090
+ case 9 /* NumericLiteral */:
86091
+ if (node.text === "0" || node.text === "1") {
86092
+ return 3 /* Sometimes */;
86093
+ }
86094
+ return 1 /* Always */;
86095
+ case 209 /* ArrayLiteralExpression */:
86096
+ case 219 /* ArrowFunction */:
86097
+ case 10 /* BigIntLiteral */:
86098
+ case 231 /* ClassExpression */:
86099
+ case 218 /* FunctionExpression */:
86100
+ case 284 /* JsxElement */:
86101
+ case 285 /* JsxSelfClosingElement */:
86102
+ case 210 /* ObjectLiteralExpression */:
86103
+ case 14 /* RegularExpressionLiteral */:
86104
+ return 1 /* Always */;
86105
+ case 222 /* VoidExpression */:
86106
+ case 106 /* NullKeyword */:
86107
+ return 2 /* Never */;
86108
+ case 15 /* NoSubstitutionTemplateLiteral */:
86109
+ case 11 /* StringLiteral */:
86110
+ return !!node.text ? 1 /* Always */ : 2 /* Never */;
86111
+ case 216 /* TypeAssertionExpression */:
86112
+ case 234 /* AsExpression */:
86113
+ case 217 /* ParenthesizedExpression */:
86114
+ return getSyntacticTruthySemantics(node.expression);
86115
+ case 227 /* ConditionalExpression */:
86116
+ return getSyntacticTruthySemantics(node.whenTrue) | getSyntacticTruthySemantics(node.whenFalse);
86117
+ case 80 /* Identifier */:
86118
+ if (getResolvedSymbol(node) === undefinedSymbol) {
86119
+ return 2 /* Never */;
86120
+ }
86121
+ return 3 /* Sometimes */;
86122
+ }
86123
+ return 3 /* Sometimes */;
86124
+ }
86014
86125
  function checkTruthinessExpression(node, checkMode) {
86015
86126
  return checkTruthinessOfType(checkExpression(node, checkMode), node);
86016
86127
  }
@@ -178879,6 +178990,7 @@ __export(ts_exports2, {
178879
178990
  PollingInterval: () => PollingInterval,
178880
178991
  PollingWatchKind: () => PollingWatchKind,
178881
178992
  PragmaKindFlags: () => PragmaKindFlags,
178993
+ PredicateSemantics: () => PredicateSemantics,
178882
178994
  PrivateIdentifierKind: () => PrivateIdentifierKind,
178883
178995
  ProcessLevel: () => ProcessLevel,
178884
178996
  ProgramUpdateLevel: () => ProgramUpdateLevel,
@@ -179915,6 +180027,7 @@ __export(ts_exports2, {
179915
180027
  isAwaitKeyword: () => isAwaitKeyword,
179916
180028
  isBigIntLiteral: () => isBigIntLiteral,
179917
180029
  isBinaryExpression: () => isBinaryExpression,
180030
+ isBinaryLogicalOperator: () => isBinaryLogicalOperator,
179918
180031
  isBinaryOperatorToken: () => isBinaryOperatorToken,
179919
180032
  isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
179920
180033
  isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
@@ -193244,6 +193357,7 @@ if (typeof console !== "undefined") {
193244
193357
  PollingInterval,
193245
193358
  PollingWatchKind,
193246
193359
  PragmaKindFlags,
193360
+ PredicateSemantics,
193247
193361
  PrivateIdentifierKind,
193248
193362
  ProcessLevel,
193249
193363
  ProgramUpdateLevel,
@@ -194280,6 +194394,7 @@ if (typeof console !== "undefined") {
194280
194394
  isAwaitKeyword,
194281
194395
  isBigIntLiteral,
194282
194396
  isBinaryExpression,
194397
+ isBinaryLogicalOperator,
194283
194398
  isBinaryOperatorToken,
194284
194399
  isBindableObjectDefinePropertyCall,
194285
194400
  isBindableStaticAccessExpression,
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-59388-4",
5
+ "version": "5.6.0-pr-59217-23",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [