@typescript-deploys/pr-build 5.6.0-pr-59217-14 → 5.6.0-pr-59287-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.
- package/lib/tsc.js +7 -97
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +7 -110
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -6686,9 +6686,6 @@ var Diagnostics = {
|
|
|
6686
6686
|
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."),
|
|
6687
6687
|
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`."),
|
|
6688
6688
|
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."),
|
|
6689
|
-
This_expression_is_always_truthy_Did_you_mean_to_test_something_else: diag(2869, 1 /* Error */, "This_expression_is_always_truthy_Did_you_mean_to_test_something_else_2869", "This expression is always truthy. Did you mean to test something else?"),
|
|
6690
|
-
This_expression_is_always_falsy_Did_you_mean_to_test_something_else: diag(2870, 1 /* Error */, "This_expression_is_always_falsy_Did_you_mean_to_test_something_else_2870", "This expression is always falsy. Did you mean to test something else?"),
|
|
6691
|
-
Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness: diag(2871, 1 /* Error */, "Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness_2871", "Using ?? on this expression appears unintentional because it always evaluates to the same nullishness."),
|
|
6692
6689
|
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}'."),
|
|
6693
6690
|
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}'."),
|
|
6694
6691
|
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}'."),
|
|
@@ -65978,12 +65975,12 @@ function createTypeChecker(host) {
|
|
|
65978
65975
|
const widened = getWidenedTypeWithContext(original, propContext);
|
|
65979
65976
|
return widened === original ? prop : createSymbolWithType(prop, widened);
|
|
65980
65977
|
}
|
|
65981
|
-
function
|
|
65978
|
+
function getOptionalNeverProperty(prop) {
|
|
65982
65979
|
const cached = undefinedProperties.get(prop.escapedName);
|
|
65983
65980
|
if (cached) {
|
|
65984
65981
|
return cached;
|
|
65985
65982
|
}
|
|
65986
|
-
const result = createSymbolWithType(prop,
|
|
65983
|
+
const result = createSymbolWithType(prop, neverType);
|
|
65987
65984
|
result.flags |= 16777216 /* Optional */;
|
|
65988
65985
|
undefinedProperties.set(prop.escapedName, result);
|
|
65989
65986
|
return result;
|
|
@@ -65996,7 +65993,7 @@ function createTypeChecker(host) {
|
|
|
65996
65993
|
if (context) {
|
|
65997
65994
|
for (const prop of getPropertiesOfContext(context)) {
|
|
65998
65995
|
if (!members.has(prop.escapedName)) {
|
|
65999
|
-
members.set(prop.escapedName,
|
|
65996
|
+
members.set(prop.escapedName, getOptionalNeverProperty(prop));
|
|
66000
65997
|
}
|
|
66001
65998
|
}
|
|
66002
65999
|
}
|
|
@@ -77531,7 +77528,7 @@ function createTypeChecker(host) {
|
|
|
77531
77528
|
setLastResult(state, checkExpression(node.right, checkMode));
|
|
77532
77529
|
return state;
|
|
77533
77530
|
}
|
|
77534
|
-
|
|
77531
|
+
checkGrammarNullishCoalesceWithLogicalExpression(node);
|
|
77535
77532
|
const operator = node.operatorToken.kind;
|
|
77536
77533
|
if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) {
|
|
77537
77534
|
state.skip = true;
|
|
@@ -77564,9 +77561,7 @@ function createTypeChecker(host) {
|
|
|
77564
77561
|
if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent)) {
|
|
77565
77562
|
checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : void 0);
|
|
77566
77563
|
}
|
|
77567
|
-
|
|
77568
|
-
checkTruthinessOfType(leftType, node.left);
|
|
77569
|
-
}
|
|
77564
|
+
checkTruthinessOfType(leftType, node.left);
|
|
77570
77565
|
}
|
|
77571
77566
|
}
|
|
77572
77567
|
}
|
|
@@ -77623,7 +77618,7 @@ function createTypeChecker(host) {
|
|
|
77623
77618
|
state.typeStack[state.stackIndex + 1] = type;
|
|
77624
77619
|
}
|
|
77625
77620
|
}
|
|
77626
|
-
function
|
|
77621
|
+
function checkGrammarNullishCoalesceWithLogicalExpression(node) {
|
|
77627
77622
|
const { left, operatorToken, right } = node;
|
|
77628
77623
|
if (operatorToken.kind === 61 /* QuestionQuestionToken */) {
|
|
77629
77624
|
if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
|
@@ -77632,56 +77627,15 @@ function createTypeChecker(host) {
|
|
|
77632
77627
|
if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
|
77633
77628
|
grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
|
|
77634
77629
|
}
|
|
77635
|
-
const leftTarget = skipOuterExpressions(left, 15 /* All */);
|
|
77636
|
-
if (getSyntacticNullishnessSemantics(leftTarget) !== 3 /* Sometimes */) {
|
|
77637
|
-
error(leftTarget, Diagnostics.Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness);
|
|
77638
|
-
}
|
|
77639
77630
|
}
|
|
77640
77631
|
}
|
|
77641
|
-
function getSyntacticNullishnessSemantics(node) {
|
|
77642
|
-
switch (node.kind) {
|
|
77643
|
-
case 223 /* AwaitExpression */:
|
|
77644
|
-
case 213 /* CallExpression */:
|
|
77645
|
-
case 212 /* ElementAccessExpression */:
|
|
77646
|
-
case 214 /* NewExpression */:
|
|
77647
|
-
case 211 /* PropertyAccessExpression */:
|
|
77648
|
-
case 229 /* YieldExpression */:
|
|
77649
|
-
return 3 /* Sometimes */;
|
|
77650
|
-
case 226 /* BinaryExpression */:
|
|
77651
|
-
switch (node.operatorToken.kind) {
|
|
77652
|
-
case 64 /* EqualsToken */:
|
|
77653
|
-
case 61 /* QuestionQuestionToken */:
|
|
77654
|
-
case 78 /* QuestionQuestionEqualsToken */:
|
|
77655
|
-
case 57 /* BarBarToken */:
|
|
77656
|
-
case 76 /* BarBarEqualsToken */:
|
|
77657
|
-
case 56 /* AmpersandAmpersandToken */:
|
|
77658
|
-
case 77 /* AmpersandAmpersandEqualsToken */:
|
|
77659
|
-
return 3 /* Sometimes */;
|
|
77660
|
-
}
|
|
77661
|
-
return 2 /* Never */;
|
|
77662
|
-
case 106 /* NullKeyword */:
|
|
77663
|
-
return 1 /* Always */;
|
|
77664
|
-
case 216 /* TypeAssertionExpression */:
|
|
77665
|
-
case 234 /* AsExpression */:
|
|
77666
|
-
case 217 /* ParenthesizedExpression */:
|
|
77667
|
-
return getSyntacticNullishnessSemantics(node.expression);
|
|
77668
|
-
case 227 /* ConditionalExpression */:
|
|
77669
|
-
return getSyntacticNullishnessSemantics(node.whenTrue) | getSyntacticNullishnessSemantics(node.whenFalse);
|
|
77670
|
-
case 80 /* Identifier */:
|
|
77671
|
-
if (node.escapedText === "undefined") {
|
|
77672
|
-
return 1 /* Always */;
|
|
77673
|
-
}
|
|
77674
|
-
return 3 /* Sometimes */;
|
|
77675
|
-
}
|
|
77676
|
-
return 2 /* Never */;
|
|
77677
|
-
}
|
|
77678
77632
|
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
|
|
77679
77633
|
const operator = operatorToken.kind;
|
|
77680
77634
|
if (operator === 64 /* EqualsToken */ && (left.kind === 210 /* ObjectLiteralExpression */ || left.kind === 209 /* ArrayLiteralExpression */)) {
|
|
77681
77635
|
return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */);
|
|
77682
77636
|
}
|
|
77683
77637
|
let leftType;
|
|
77684
|
-
if (
|
|
77638
|
+
if (isLogicalOrCoalescingBinaryOperator(operator)) {
|
|
77685
77639
|
leftType = checkTruthinessExpression(left, checkMode);
|
|
77686
77640
|
} else {
|
|
77687
77641
|
leftType = checkExpression(left, checkMode);
|
|
@@ -81284,53 +81238,9 @@ function createTypeChecker(host) {
|
|
|
81284
81238
|
function checkTruthinessOfType(type, node) {
|
|
81285
81239
|
if (type.flags & 16384 /* Void */) {
|
|
81286
81240
|
error(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
81287
|
-
} else {
|
|
81288
|
-
const semantics = getSyntacticTruthySemantics(node);
|
|
81289
|
-
if (semantics !== 3 /* Sometimes */) {
|
|
81290
|
-
error(
|
|
81291
|
-
node,
|
|
81292
|
-
semantics === 1 /* Always */ ? Diagnostics.This_expression_is_always_truthy_Did_you_mean_to_test_something_else : Diagnostics.This_expression_is_always_falsy_Did_you_mean_to_test_something_else
|
|
81293
|
-
);
|
|
81294
|
-
}
|
|
81295
81241
|
}
|
|
81296
81242
|
return type;
|
|
81297
81243
|
}
|
|
81298
|
-
function getSyntacticTruthySemantics(node) {
|
|
81299
|
-
switch (node.kind) {
|
|
81300
|
-
case 9 /* NumericLiteral */:
|
|
81301
|
-
if (node.text === "0" || node.text === "1") {
|
|
81302
|
-
return 3 /* Sometimes */;
|
|
81303
|
-
}
|
|
81304
|
-
return 1 /* Always */;
|
|
81305
|
-
case 209 /* ArrayLiteralExpression */:
|
|
81306
|
-
case 219 /* ArrowFunction */:
|
|
81307
|
-
case 10 /* BigIntLiteral */:
|
|
81308
|
-
case 231 /* ClassExpression */:
|
|
81309
|
-
case 218 /* FunctionExpression */:
|
|
81310
|
-
case 284 /* JsxElement */:
|
|
81311
|
-
case 285 /* JsxSelfClosingElement */:
|
|
81312
|
-
case 210 /* ObjectLiteralExpression */:
|
|
81313
|
-
case 14 /* RegularExpressionLiteral */:
|
|
81314
|
-
return 1 /* Always */;
|
|
81315
|
-
case 222 /* VoidExpression */:
|
|
81316
|
-
return 2 /* Never */;
|
|
81317
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
81318
|
-
case 11 /* StringLiteral */:
|
|
81319
|
-
return !!node.text ? 1 /* Always */ : 2 /* Never */;
|
|
81320
|
-
case 216 /* TypeAssertionExpression */:
|
|
81321
|
-
case 234 /* AsExpression */:
|
|
81322
|
-
case 217 /* ParenthesizedExpression */:
|
|
81323
|
-
return getSyntacticTruthySemantics(node.expression);
|
|
81324
|
-
case 227 /* ConditionalExpression */:
|
|
81325
|
-
return getSyntacticTruthySemantics(node.whenTrue) | getSyntacticTruthySemantics(node.whenFalse);
|
|
81326
|
-
case 80 /* Identifier */:
|
|
81327
|
-
if (node.escapedText === "undefined") {
|
|
81328
|
-
return 2 /* Never */;
|
|
81329
|
-
}
|
|
81330
|
-
return 3 /* Sometimes */;
|
|
81331
|
-
}
|
|
81332
|
-
return 3 /* Sometimes */;
|
|
81333
|
-
}
|
|
81334
81244
|
function checkTruthinessExpression(node, checkMode) {
|
|
81335
81245
|
return checkTruthinessOfType(checkExpression(node, checkMode), node);
|
|
81336
81246
|
}
|
package/lib/typescript.d.ts
CHANGED
|
@@ -8705,7 +8705,6 @@ declare namespace ts {
|
|
|
8705
8705
|
* ```
|
|
8706
8706
|
*/
|
|
8707
8707
|
function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[];
|
|
8708
|
-
function isBinaryLogicalOperator(token: SyntaxKind): boolean;
|
|
8709
8708
|
/**
|
|
8710
8709
|
* Create an external source map source file reference
|
|
8711
8710
|
*/
|
package/lib/typescript.js
CHANGED
|
@@ -142,7 +142,6 @@ __export(typescript_exports, {
|
|
|
142
142
|
PollingInterval: () => PollingInterval,
|
|
143
143
|
PollingWatchKind: () => PollingWatchKind,
|
|
144
144
|
PragmaKindFlags: () => PragmaKindFlags,
|
|
145
|
-
PredicateSemantics: () => PredicateSemantics,
|
|
146
145
|
PrivateIdentifierKind: () => PrivateIdentifierKind,
|
|
147
146
|
ProcessLevel: () => ProcessLevel,
|
|
148
147
|
ProgramUpdateLevel: () => ProgramUpdateLevel,
|
|
@@ -1174,7 +1173,6 @@ __export(typescript_exports, {
|
|
|
1174
1173
|
isAwaitKeyword: () => isAwaitKeyword,
|
|
1175
1174
|
isBigIntLiteral: () => isBigIntLiteral,
|
|
1176
1175
|
isBinaryExpression: () => isBinaryExpression,
|
|
1177
|
-
isBinaryLogicalOperator: () => isBinaryLogicalOperator,
|
|
1178
1176
|
isBinaryOperatorToken: () => isBinaryOperatorToken,
|
|
1179
1177
|
isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
|
|
1180
1178
|
isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
|
|
@@ -5988,13 +5986,6 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
|
|
|
5988
5986
|
RelationComparisonResult3[RelationComparisonResult3["Overflow"] = 96] = "Overflow";
|
|
5989
5987
|
return RelationComparisonResult3;
|
|
5990
5988
|
})(RelationComparisonResult || {});
|
|
5991
|
-
var PredicateSemantics = /* @__PURE__ */ ((PredicateSemantics2) => {
|
|
5992
|
-
PredicateSemantics2[PredicateSemantics2["None"] = 0] = "None";
|
|
5993
|
-
PredicateSemantics2[PredicateSemantics2["Always"] = 1] = "Always";
|
|
5994
|
-
PredicateSemantics2[PredicateSemantics2["Never"] = 2] = "Never";
|
|
5995
|
-
PredicateSemantics2[PredicateSemantics2["Sometimes"] = 3] = "Sometimes";
|
|
5996
|
-
return PredicateSemantics2;
|
|
5997
|
-
})(PredicateSemantics || {});
|
|
5998
5989
|
var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
|
|
5999
5990
|
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["None"] = 0] = "None";
|
|
6000
5991
|
GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Auto"] = 1] = "Auto";
|
|
@@ -10075,9 +10066,6 @@ var Diagnostics = {
|
|
|
10075
10066
|
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."),
|
|
10076
10067
|
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`."),
|
|
10077
10068
|
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."),
|
|
10078
|
-
This_expression_is_always_truthy_Did_you_mean_to_test_something_else: diag(2869, 1 /* Error */, "This_expression_is_always_truthy_Did_you_mean_to_test_something_else_2869", "This expression is always truthy. Did you mean to test something else?"),
|
|
10079
|
-
This_expression_is_always_falsy_Did_you_mean_to_test_something_else: diag(2870, 1 /* Error */, "This_expression_is_always_falsy_Did_you_mean_to_test_something_else_2870", "This expression is always falsy. Did you mean to test something else?"),
|
|
10080
|
-
Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness: diag(2871, 1 /* Error */, "Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness_2871", "Using ?? on this expression appears unintentional because it always evaluates to the same nullishness."),
|
|
10081
10069
|
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
10070
|
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
10071
|
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}'."),
|
|
@@ -70589,12 +70577,12 @@ function createTypeChecker(host) {
|
|
|
70589
70577
|
const widened = getWidenedTypeWithContext(original, propContext);
|
|
70590
70578
|
return widened === original ? prop : createSymbolWithType(prop, widened);
|
|
70591
70579
|
}
|
|
70592
|
-
function
|
|
70580
|
+
function getOptionalNeverProperty(prop) {
|
|
70593
70581
|
const cached = undefinedProperties.get(prop.escapedName);
|
|
70594
70582
|
if (cached) {
|
|
70595
70583
|
return cached;
|
|
70596
70584
|
}
|
|
70597
|
-
const result = createSymbolWithType(prop,
|
|
70585
|
+
const result = createSymbolWithType(prop, neverType);
|
|
70598
70586
|
result.flags |= 16777216 /* Optional */;
|
|
70599
70587
|
undefinedProperties.set(prop.escapedName, result);
|
|
70600
70588
|
return result;
|
|
@@ -70607,7 +70595,7 @@ function createTypeChecker(host) {
|
|
|
70607
70595
|
if (context) {
|
|
70608
70596
|
for (const prop of getPropertiesOfContext(context)) {
|
|
70609
70597
|
if (!members.has(prop.escapedName)) {
|
|
70610
|
-
members.set(prop.escapedName,
|
|
70598
|
+
members.set(prop.escapedName, getOptionalNeverProperty(prop));
|
|
70611
70599
|
}
|
|
70612
70600
|
}
|
|
70613
70601
|
}
|
|
@@ -82142,7 +82130,7 @@ function createTypeChecker(host) {
|
|
|
82142
82130
|
setLastResult(state, checkExpression(node.right, checkMode));
|
|
82143
82131
|
return state;
|
|
82144
82132
|
}
|
|
82145
|
-
|
|
82133
|
+
checkGrammarNullishCoalesceWithLogicalExpression(node);
|
|
82146
82134
|
const operator = node.operatorToken.kind;
|
|
82147
82135
|
if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) {
|
|
82148
82136
|
state.skip = true;
|
|
@@ -82175,9 +82163,7 @@ function createTypeChecker(host) {
|
|
|
82175
82163
|
if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) {
|
|
82176
82164
|
checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
|
|
82177
82165
|
}
|
|
82178
|
-
|
|
82179
|
-
checkTruthinessOfType(leftType, node.left);
|
|
82180
|
-
}
|
|
82166
|
+
checkTruthinessOfType(leftType, node.left);
|
|
82181
82167
|
}
|
|
82182
82168
|
}
|
|
82183
82169
|
}
|
|
@@ -82234,7 +82220,7 @@ function createTypeChecker(host) {
|
|
|
82234
82220
|
state.typeStack[state.stackIndex + 1] = type;
|
|
82235
82221
|
}
|
|
82236
82222
|
}
|
|
82237
|
-
function
|
|
82223
|
+
function checkGrammarNullishCoalesceWithLogicalExpression(node) {
|
|
82238
82224
|
const { left, operatorToken, right } = node;
|
|
82239
82225
|
if (operatorToken.kind === 61 /* QuestionQuestionToken */) {
|
|
82240
82226
|
if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
|
@@ -82243,56 +82229,15 @@ function createTypeChecker(host) {
|
|
|
82243
82229
|
if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
|
82244
82230
|
grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
|
|
82245
82231
|
}
|
|
82246
|
-
const leftTarget = skipOuterExpressions(left, 15 /* All */);
|
|
82247
|
-
if (getSyntacticNullishnessSemantics(leftTarget) !== 3 /* Sometimes */) {
|
|
82248
|
-
error2(leftTarget, Diagnostics.Using_on_this_expression_appears_unintentional_because_it_always_evaluates_to_the_same_nullishness);
|
|
82249
|
-
}
|
|
82250
82232
|
}
|
|
82251
82233
|
}
|
|
82252
|
-
function getSyntacticNullishnessSemantics(node) {
|
|
82253
|
-
switch (node.kind) {
|
|
82254
|
-
case 223 /* AwaitExpression */:
|
|
82255
|
-
case 213 /* CallExpression */:
|
|
82256
|
-
case 212 /* ElementAccessExpression */:
|
|
82257
|
-
case 214 /* NewExpression */:
|
|
82258
|
-
case 211 /* PropertyAccessExpression */:
|
|
82259
|
-
case 229 /* YieldExpression */:
|
|
82260
|
-
return 3 /* Sometimes */;
|
|
82261
|
-
case 226 /* BinaryExpression */:
|
|
82262
|
-
switch (node.operatorToken.kind) {
|
|
82263
|
-
case 64 /* EqualsToken */:
|
|
82264
|
-
case 61 /* QuestionQuestionToken */:
|
|
82265
|
-
case 78 /* QuestionQuestionEqualsToken */:
|
|
82266
|
-
case 57 /* BarBarToken */:
|
|
82267
|
-
case 76 /* BarBarEqualsToken */:
|
|
82268
|
-
case 56 /* AmpersandAmpersandToken */:
|
|
82269
|
-
case 77 /* AmpersandAmpersandEqualsToken */:
|
|
82270
|
-
return 3 /* Sometimes */;
|
|
82271
|
-
}
|
|
82272
|
-
return 2 /* Never */;
|
|
82273
|
-
case 106 /* NullKeyword */:
|
|
82274
|
-
return 1 /* Always */;
|
|
82275
|
-
case 216 /* TypeAssertionExpression */:
|
|
82276
|
-
case 234 /* AsExpression */:
|
|
82277
|
-
case 217 /* ParenthesizedExpression */:
|
|
82278
|
-
return getSyntacticNullishnessSemantics(node.expression);
|
|
82279
|
-
case 227 /* ConditionalExpression */:
|
|
82280
|
-
return getSyntacticNullishnessSemantics(node.whenTrue) | getSyntacticNullishnessSemantics(node.whenFalse);
|
|
82281
|
-
case 80 /* Identifier */:
|
|
82282
|
-
if (node.escapedText === "undefined") {
|
|
82283
|
-
return 1 /* Always */;
|
|
82284
|
-
}
|
|
82285
|
-
return 3 /* Sometimes */;
|
|
82286
|
-
}
|
|
82287
|
-
return 2 /* Never */;
|
|
82288
|
-
}
|
|
82289
82234
|
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
|
|
82290
82235
|
const operator = operatorToken.kind;
|
|
82291
82236
|
if (operator === 64 /* EqualsToken */ && (left.kind === 210 /* ObjectLiteralExpression */ || left.kind === 209 /* ArrayLiteralExpression */)) {
|
|
82292
82237
|
return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */);
|
|
82293
82238
|
}
|
|
82294
82239
|
let leftType;
|
|
82295
|
-
if (
|
|
82240
|
+
if (isLogicalOrCoalescingBinaryOperator(operator)) {
|
|
82296
82241
|
leftType = checkTruthinessExpression(left, checkMode);
|
|
82297
82242
|
} else {
|
|
82298
82243
|
leftType = checkExpression(left, checkMode);
|
|
@@ -85895,53 +85840,9 @@ function createTypeChecker(host) {
|
|
|
85895
85840
|
function checkTruthinessOfType(type, node) {
|
|
85896
85841
|
if (type.flags & 16384 /* Void */) {
|
|
85897
85842
|
error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness);
|
|
85898
|
-
} else {
|
|
85899
|
-
const semantics = getSyntacticTruthySemantics(node);
|
|
85900
|
-
if (semantics !== 3 /* Sometimes */) {
|
|
85901
|
-
error2(
|
|
85902
|
-
node,
|
|
85903
|
-
semantics === 1 /* Always */ ? Diagnostics.This_expression_is_always_truthy_Did_you_mean_to_test_something_else : Diagnostics.This_expression_is_always_falsy_Did_you_mean_to_test_something_else
|
|
85904
|
-
);
|
|
85905
|
-
}
|
|
85906
85843
|
}
|
|
85907
85844
|
return type;
|
|
85908
85845
|
}
|
|
85909
|
-
function getSyntacticTruthySemantics(node) {
|
|
85910
|
-
switch (node.kind) {
|
|
85911
|
-
case 9 /* NumericLiteral */:
|
|
85912
|
-
if (node.text === "0" || node.text === "1") {
|
|
85913
|
-
return 3 /* Sometimes */;
|
|
85914
|
-
}
|
|
85915
|
-
return 1 /* Always */;
|
|
85916
|
-
case 209 /* ArrayLiteralExpression */:
|
|
85917
|
-
case 219 /* ArrowFunction */:
|
|
85918
|
-
case 10 /* BigIntLiteral */:
|
|
85919
|
-
case 231 /* ClassExpression */:
|
|
85920
|
-
case 218 /* FunctionExpression */:
|
|
85921
|
-
case 284 /* JsxElement */:
|
|
85922
|
-
case 285 /* JsxSelfClosingElement */:
|
|
85923
|
-
case 210 /* ObjectLiteralExpression */:
|
|
85924
|
-
case 14 /* RegularExpressionLiteral */:
|
|
85925
|
-
return 1 /* Always */;
|
|
85926
|
-
case 222 /* VoidExpression */:
|
|
85927
|
-
return 2 /* Never */;
|
|
85928
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
85929
|
-
case 11 /* StringLiteral */:
|
|
85930
|
-
return !!node.text ? 1 /* Always */ : 2 /* Never */;
|
|
85931
|
-
case 216 /* TypeAssertionExpression */:
|
|
85932
|
-
case 234 /* AsExpression */:
|
|
85933
|
-
case 217 /* ParenthesizedExpression */:
|
|
85934
|
-
return getSyntacticTruthySemantics(node.expression);
|
|
85935
|
-
case 227 /* ConditionalExpression */:
|
|
85936
|
-
return getSyntacticTruthySemantics(node.whenTrue) | getSyntacticTruthySemantics(node.whenFalse);
|
|
85937
|
-
case 80 /* Identifier */:
|
|
85938
|
-
if (node.escapedText === "undefined") {
|
|
85939
|
-
return 2 /* Never */;
|
|
85940
|
-
}
|
|
85941
|
-
return 3 /* Sometimes */;
|
|
85942
|
-
}
|
|
85943
|
-
return 3 /* Sometimes */;
|
|
85944
|
-
}
|
|
85945
85846
|
function checkTruthinessExpression(node, checkMode) {
|
|
85946
85847
|
return checkTruthinessOfType(checkExpression(node, checkMode), node);
|
|
85947
85848
|
}
|
|
@@ -178729,7 +178630,6 @@ __export(ts_exports2, {
|
|
|
178729
178630
|
PollingInterval: () => PollingInterval,
|
|
178730
178631
|
PollingWatchKind: () => PollingWatchKind,
|
|
178731
178632
|
PragmaKindFlags: () => PragmaKindFlags,
|
|
178732
|
-
PredicateSemantics: () => PredicateSemantics,
|
|
178733
178633
|
PrivateIdentifierKind: () => PrivateIdentifierKind,
|
|
178734
178634
|
ProcessLevel: () => ProcessLevel,
|
|
178735
178635
|
ProgramUpdateLevel: () => ProgramUpdateLevel,
|
|
@@ -179761,7 +179661,6 @@ __export(ts_exports2, {
|
|
|
179761
179661
|
isAwaitKeyword: () => isAwaitKeyword,
|
|
179762
179662
|
isBigIntLiteral: () => isBigIntLiteral,
|
|
179763
179663
|
isBinaryExpression: () => isBinaryExpression,
|
|
179764
|
-
isBinaryLogicalOperator: () => isBinaryLogicalOperator,
|
|
179765
179664
|
isBinaryOperatorToken: () => isBinaryOperatorToken,
|
|
179766
179665
|
isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
|
|
179767
179666
|
isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
|
|
@@ -193089,7 +192988,6 @@ if (typeof console !== "undefined") {
|
|
|
193089
192988
|
PollingInterval,
|
|
193090
192989
|
PollingWatchKind,
|
|
193091
192990
|
PragmaKindFlags,
|
|
193092
|
-
PredicateSemantics,
|
|
193093
192991
|
PrivateIdentifierKind,
|
|
193094
192992
|
ProcessLevel,
|
|
193095
192993
|
ProgramUpdateLevel,
|
|
@@ -194121,7 +194019,6 @@ if (typeof console !== "undefined") {
|
|
|
194121
194019
|
isAwaitKeyword,
|
|
194122
194020
|
isBigIntLiteral,
|
|
194123
194021
|
isBinaryExpression,
|
|
194124
|
-
isBinaryLogicalOperator,
|
|
194125
194022
|
isBinaryOperatorToken,
|
|
194126
194023
|
isBindableObjectDefinePropertyCall,
|
|
194127
194024
|
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-
|
|
5
|
+
"version": "5.6.0-pr-59287-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|