@typescript-deploys/pr-build 4.9.0-pr-50620-15 → 4.9.0-pr-50666-16
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 +21 -22
- package/lib/tsserver.js +27 -42
- package/lib/tsserverlibrary.js +27 -42
- package/lib/typescript.js +27 -42
- package/lib/typescriptServices.js +27 -42
- package/lib/typingsInstaller.js +27 -42
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -5852,8 +5852,6 @@ var ts;
|
|
|
5852
5852
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
5853
5853
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
5854
5854
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
5855
|
-
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
5856
|
-
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
5857
5855
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
5858
5856
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
5859
5857
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -32321,6 +32319,7 @@ var ts;
|
|
|
32321
32319
|
shortName: "h",
|
|
32322
32320
|
type: "boolean",
|
|
32323
32321
|
showInSimplifiedHelpView: true,
|
|
32322
|
+
isCommandLineOnly: true,
|
|
32324
32323
|
category: ts.Diagnostics.Command_line_Options,
|
|
32325
32324
|
description: ts.Diagnostics.Print_this_message,
|
|
32326
32325
|
defaultValueDescription: false,
|
|
@@ -32329,6 +32328,8 @@ var ts;
|
|
|
32329
32328
|
name: "help",
|
|
32330
32329
|
shortName: "?",
|
|
32331
32330
|
type: "boolean",
|
|
32331
|
+
isCommandLineOnly: true,
|
|
32332
|
+
category: ts.Diagnostics.Command_line_Options,
|
|
32332
32333
|
defaultValueDescription: false,
|
|
32333
32334
|
},
|
|
32334
32335
|
{
|
|
@@ -40706,6 +40707,7 @@ var ts;
|
|
|
40706
40707
|
var deferredGlobalOmitSymbol;
|
|
40707
40708
|
var deferredGlobalAwaitedSymbol;
|
|
40708
40709
|
var deferredGlobalBigIntType;
|
|
40710
|
+
var deferredGlobalRecordSymbol;
|
|
40709
40711
|
var allPotentiallyUnusedIdentifiers = new ts.Map();
|
|
40710
40712
|
var flowLoopStart = 0;
|
|
40711
40713
|
var flowLoopCount = 0;
|
|
@@ -51240,6 +51242,9 @@ var ts;
|
|
|
51240
51242
|
function getGlobalBigIntType() {
|
|
51241
51243
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, false))) || emptyObjectType;
|
|
51242
51244
|
}
|
|
51245
|
+
function getGlobalRecordSymbol() {
|
|
51246
|
+
return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", 2, true) || unknownSymbol);
|
|
51247
|
+
}
|
|
51243
51248
|
function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
|
|
51244
51249
|
return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
|
|
51245
51250
|
}
|
|
@@ -60214,18 +60219,22 @@ var ts;
|
|
|
60214
60219
|
}
|
|
60215
60220
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
60216
60221
|
var prop = getPropertyOfType(type, propName);
|
|
60217
|
-
|
|
60218
|
-
|
|
60219
|
-
|
|
60220
|
-
return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
|
|
60222
|
+
return prop ?
|
|
60223
|
+
!!(prop.flags & 16777216) || assumeTrue :
|
|
60224
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
60221
60225
|
}
|
|
60222
60226
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
60223
|
-
|
|
60224
|
-
|
|
60225
|
-
|| ts.isThisTypeParameter(type)
|
|
60226
|
-
|| type.flags & 2097152 && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
|
|
60227
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, true); });
|
|
60228
|
+
if (isKnownProperty) {
|
|
60227
60229
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
60228
60230
|
}
|
|
60231
|
+
if (assumeTrue) {
|
|
60232
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
60233
|
+
if (recordSymbol !== unknownSymbol) {
|
|
60234
|
+
var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
|
|
60235
|
+
return mapType(type, function (t) { return t.flags & 67108864 ? record_1 : getIntersectionType([t, record_1]); });
|
|
60236
|
+
}
|
|
60237
|
+
}
|
|
60229
60238
|
return type;
|
|
60230
60239
|
}
|
|
60231
60240
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -66876,19 +66885,9 @@ var ts;
|
|
|
66876
66885
|
}
|
|
66877
66886
|
}
|
|
66878
66887
|
else {
|
|
66879
|
-
|
|
66880
|
-
if (!(allTypesAssignableToKind(leftType, 402653316 | 296 | 12288) ||
|
|
66881
|
-
isTypeAssignableToKind(leftType, 4194304 | 134217728 | 268435456 | 262144))) {
|
|
66882
|
-
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
66883
|
-
}
|
|
66884
|
-
}
|
|
66885
|
-
rightType = checkNonNullType(rightType, right);
|
|
66886
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
66887
|
-
if (!allTypesAssignableToKind(rightType, 67108864 | 58982400) ||
|
|
66888
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 | 58982400) ||
|
|
66889
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 | 58982400 | 524288))) {
|
|
66890
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
66888
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
66891
66889
|
}
|
|
66890
|
+
checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
|
|
66892
66891
|
return booleanType;
|
|
66893
66892
|
}
|
|
66894
66893
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
package/lib/tsserver.js
CHANGED
|
@@ -8700,8 +8700,6 @@ var ts;
|
|
|
8700
8700
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
8701
8701
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
8702
8702
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
8703
|
-
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
8704
|
-
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
8705
8703
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8706
8704
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8707
8705
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -39899,6 +39897,7 @@ var ts;
|
|
|
39899
39897
|
shortName: "h",
|
|
39900
39898
|
type: "boolean",
|
|
39901
39899
|
showInSimplifiedHelpView: true,
|
|
39900
|
+
isCommandLineOnly: true,
|
|
39902
39901
|
category: ts.Diagnostics.Command_line_Options,
|
|
39903
39902
|
description: ts.Diagnostics.Print_this_message,
|
|
39904
39903
|
defaultValueDescription: false,
|
|
@@ -39907,6 +39906,8 @@ var ts;
|
|
|
39907
39906
|
name: "help",
|
|
39908
39907
|
shortName: "?",
|
|
39909
39908
|
type: "boolean",
|
|
39909
|
+
isCommandLineOnly: true,
|
|
39910
|
+
category: ts.Diagnostics.Command_line_Options,
|
|
39910
39911
|
defaultValueDescription: false,
|
|
39911
39912
|
},
|
|
39912
39913
|
{
|
|
@@ -49592,6 +49593,7 @@ var ts;
|
|
|
49592
49593
|
var deferredGlobalOmitSymbol;
|
|
49593
49594
|
var deferredGlobalAwaitedSymbol;
|
|
49594
49595
|
var deferredGlobalBigIntType;
|
|
49596
|
+
var deferredGlobalRecordSymbol;
|
|
49595
49597
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49596
49598
|
var flowLoopStart = 0;
|
|
49597
49599
|
var flowLoopCount = 0;
|
|
@@ -61670,6 +61672,9 @@ var ts;
|
|
|
61670
61672
|
function getGlobalBigIntType() {
|
|
61671
61673
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61672
61674
|
}
|
|
61675
|
+
function getGlobalRecordSymbol() {
|
|
61676
|
+
return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61677
|
+
}
|
|
61673
61678
|
/**
|
|
61674
61679
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61675
61680
|
*/
|
|
@@ -71957,18 +71962,26 @@ var ts;
|
|
|
71957
71962
|
}
|
|
71958
71963
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
71959
71964
|
var prop = getPropertyOfType(type, propName);
|
|
71960
|
-
|
|
71961
|
-
|
|
71962
|
-
|
|
71963
|
-
return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
|
|
71965
|
+
return prop ?
|
|
71966
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
71967
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
71964
71968
|
}
|
|
71965
71969
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71966
|
-
|
|
71967
|
-
|
|
71968
|
-
|
|
71969
|
-
|
|
71970
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
71971
|
+
if (isKnownProperty) {
|
|
71972
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
71973
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
71970
71974
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
71971
71975
|
}
|
|
71976
|
+
if (assumeTrue) {
|
|
71977
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
71978
|
+
// where X is the name of the property.
|
|
71979
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
71980
|
+
if (recordSymbol !== unknownSymbol) {
|
|
71981
|
+
var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
|
|
71982
|
+
return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
|
|
71983
|
+
}
|
|
71984
|
+
}
|
|
71972
71985
|
return type;
|
|
71973
71986
|
}
|
|
71974
71987
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -79763,40 +79776,12 @@ var ts;
|
|
|
79763
79776
|
}
|
|
79764
79777
|
}
|
|
79765
79778
|
else {
|
|
79766
|
-
|
|
79767
|
-
|
|
79768
|
-
// Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
|
|
79769
|
-
if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
|
|
79770
|
-
isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
|
|
79771
|
-
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
79772
|
-
}
|
|
79779
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
79780
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
79773
79781
|
}
|
|
79774
|
-
|
|
79775
|
-
|
|
79776
|
-
// The in operator requires the right operand to be
|
|
79777
|
-
//
|
|
79778
|
-
// 1. assignable to the non-primitive type,
|
|
79779
|
-
// 2. an unconstrained type parameter,
|
|
79780
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
79781
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
79782
|
-
// non-primitive type, or
|
|
79783
|
-
// 4. a type parameter whose constraint is
|
|
79784
|
-
// i. an object type,
|
|
79785
|
-
// ii. the non-primitive type, or
|
|
79786
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
79787
|
-
//
|
|
79788
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
79789
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
79790
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
79791
|
-
// unless *all* instantiations would result in an error.
|
|
79792
|
-
//
|
|
79782
|
+
// The type of the right operand must be assignable to 'object'.
|
|
79783
|
+
checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
|
|
79793
79784
|
// The result is always of the Boolean primitive type.
|
|
79794
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
79795
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79796
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79797
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
79798
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
79799
|
-
}
|
|
79800
79785
|
return booleanType;
|
|
79801
79786
|
}
|
|
79802
79787
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -8699,8 +8699,6 @@ var ts;
|
|
|
8699
8699
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
8700
8700
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
8701
8701
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
8702
|
-
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
8703
|
-
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
8704
8702
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8705
8703
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8706
8704
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -39898,6 +39896,7 @@ var ts;
|
|
|
39898
39896
|
shortName: "h",
|
|
39899
39897
|
type: "boolean",
|
|
39900
39898
|
showInSimplifiedHelpView: true,
|
|
39899
|
+
isCommandLineOnly: true,
|
|
39901
39900
|
category: ts.Diagnostics.Command_line_Options,
|
|
39902
39901
|
description: ts.Diagnostics.Print_this_message,
|
|
39903
39902
|
defaultValueDescription: false,
|
|
@@ -39906,6 +39905,8 @@ var ts;
|
|
|
39906
39905
|
name: "help",
|
|
39907
39906
|
shortName: "?",
|
|
39908
39907
|
type: "boolean",
|
|
39908
|
+
isCommandLineOnly: true,
|
|
39909
|
+
category: ts.Diagnostics.Command_line_Options,
|
|
39909
39910
|
defaultValueDescription: false,
|
|
39910
39911
|
},
|
|
39911
39912
|
{
|
|
@@ -49591,6 +49592,7 @@ var ts;
|
|
|
49591
49592
|
var deferredGlobalOmitSymbol;
|
|
49592
49593
|
var deferredGlobalAwaitedSymbol;
|
|
49593
49594
|
var deferredGlobalBigIntType;
|
|
49595
|
+
var deferredGlobalRecordSymbol;
|
|
49594
49596
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49595
49597
|
var flowLoopStart = 0;
|
|
49596
49598
|
var flowLoopCount = 0;
|
|
@@ -61669,6 +61671,9 @@ var ts;
|
|
|
61669
61671
|
function getGlobalBigIntType() {
|
|
61670
61672
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61671
61673
|
}
|
|
61674
|
+
function getGlobalRecordSymbol() {
|
|
61675
|
+
return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61676
|
+
}
|
|
61672
61677
|
/**
|
|
61673
61678
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61674
61679
|
*/
|
|
@@ -71956,18 +71961,26 @@ var ts;
|
|
|
71956
71961
|
}
|
|
71957
71962
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
71958
71963
|
var prop = getPropertyOfType(type, propName);
|
|
71959
|
-
|
|
71960
|
-
|
|
71961
|
-
|
|
71962
|
-
return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
|
|
71964
|
+
return prop ?
|
|
71965
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
71966
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
71963
71967
|
}
|
|
71964
71968
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71965
|
-
|
|
71966
|
-
|
|
71967
|
-
|
|
71968
|
-
|
|
71969
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
71970
|
+
if (isKnownProperty) {
|
|
71971
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
71972
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
71969
71973
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
71970
71974
|
}
|
|
71975
|
+
if (assumeTrue) {
|
|
71976
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
71977
|
+
// where X is the name of the property.
|
|
71978
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
71979
|
+
if (recordSymbol !== unknownSymbol) {
|
|
71980
|
+
var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
|
|
71981
|
+
return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
|
|
71982
|
+
}
|
|
71983
|
+
}
|
|
71971
71984
|
return type;
|
|
71972
71985
|
}
|
|
71973
71986
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -79762,40 +79775,12 @@ var ts;
|
|
|
79762
79775
|
}
|
|
79763
79776
|
}
|
|
79764
79777
|
else {
|
|
79765
|
-
|
|
79766
|
-
|
|
79767
|
-
// Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
|
|
79768
|
-
if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
|
|
79769
|
-
isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
|
|
79770
|
-
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
79771
|
-
}
|
|
79778
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
79779
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
79772
79780
|
}
|
|
79773
|
-
|
|
79774
|
-
|
|
79775
|
-
// The in operator requires the right operand to be
|
|
79776
|
-
//
|
|
79777
|
-
// 1. assignable to the non-primitive type,
|
|
79778
|
-
// 2. an unconstrained type parameter,
|
|
79779
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
79780
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
79781
|
-
// non-primitive type, or
|
|
79782
|
-
// 4. a type parameter whose constraint is
|
|
79783
|
-
// i. an object type,
|
|
79784
|
-
// ii. the non-primitive type, or
|
|
79785
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
79786
|
-
//
|
|
79787
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
79788
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
79789
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
79790
|
-
// unless *all* instantiations would result in an error.
|
|
79791
|
-
//
|
|
79781
|
+
// The type of the right operand must be assignable to 'object'.
|
|
79782
|
+
checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
|
|
79792
79783
|
// The result is always of the Boolean primitive type.
|
|
79793
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
79794
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79795
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79796
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
79797
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
79798
|
-
}
|
|
79799
79784
|
return booleanType;
|
|
79800
79785
|
}
|
|
79801
79786
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
package/lib/typescript.js
CHANGED
|
@@ -8690,8 +8690,6 @@ var ts;
|
|
|
8690
8690
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
8691
8691
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
8692
8692
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
8693
|
-
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
8694
|
-
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
8695
8693
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8696
8694
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8697
8695
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -39889,6 +39887,7 @@ var ts;
|
|
|
39889
39887
|
shortName: "h",
|
|
39890
39888
|
type: "boolean",
|
|
39891
39889
|
showInSimplifiedHelpView: true,
|
|
39890
|
+
isCommandLineOnly: true,
|
|
39892
39891
|
category: ts.Diagnostics.Command_line_Options,
|
|
39893
39892
|
description: ts.Diagnostics.Print_this_message,
|
|
39894
39893
|
defaultValueDescription: false,
|
|
@@ -39897,6 +39896,8 @@ var ts;
|
|
|
39897
39896
|
name: "help",
|
|
39898
39897
|
shortName: "?",
|
|
39899
39898
|
type: "boolean",
|
|
39899
|
+
isCommandLineOnly: true,
|
|
39900
|
+
category: ts.Diagnostics.Command_line_Options,
|
|
39900
39901
|
defaultValueDescription: false,
|
|
39901
39902
|
},
|
|
39902
39903
|
{
|
|
@@ -49582,6 +49583,7 @@ var ts;
|
|
|
49582
49583
|
var deferredGlobalOmitSymbol;
|
|
49583
49584
|
var deferredGlobalAwaitedSymbol;
|
|
49584
49585
|
var deferredGlobalBigIntType;
|
|
49586
|
+
var deferredGlobalRecordSymbol;
|
|
49585
49587
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49586
49588
|
var flowLoopStart = 0;
|
|
49587
49589
|
var flowLoopCount = 0;
|
|
@@ -61660,6 +61662,9 @@ var ts;
|
|
|
61660
61662
|
function getGlobalBigIntType() {
|
|
61661
61663
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61662
61664
|
}
|
|
61665
|
+
function getGlobalRecordSymbol() {
|
|
61666
|
+
return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61667
|
+
}
|
|
61663
61668
|
/**
|
|
61664
61669
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61665
61670
|
*/
|
|
@@ -71947,18 +71952,26 @@ var ts;
|
|
|
71947
71952
|
}
|
|
71948
71953
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
71949
71954
|
var prop = getPropertyOfType(type, propName);
|
|
71950
|
-
|
|
71951
|
-
|
|
71952
|
-
|
|
71953
|
-
return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
|
|
71955
|
+
return prop ?
|
|
71956
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
71957
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
71954
71958
|
}
|
|
71955
71959
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71956
|
-
|
|
71957
|
-
|
|
71958
|
-
|
|
71959
|
-
|
|
71960
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
71961
|
+
if (isKnownProperty) {
|
|
71962
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
71963
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
71960
71964
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
71961
71965
|
}
|
|
71966
|
+
if (assumeTrue) {
|
|
71967
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
71968
|
+
// where X is the name of the property.
|
|
71969
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
71970
|
+
if (recordSymbol !== unknownSymbol) {
|
|
71971
|
+
var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
|
|
71972
|
+
return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
|
|
71973
|
+
}
|
|
71974
|
+
}
|
|
71962
71975
|
return type;
|
|
71963
71976
|
}
|
|
71964
71977
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -79753,40 +79766,12 @@ var ts;
|
|
|
79753
79766
|
}
|
|
79754
79767
|
}
|
|
79755
79768
|
else {
|
|
79756
|
-
|
|
79757
|
-
|
|
79758
|
-
// Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
|
|
79759
|
-
if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
|
|
79760
|
-
isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
|
|
79761
|
-
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
79762
|
-
}
|
|
79769
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
79770
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
79763
79771
|
}
|
|
79764
|
-
|
|
79765
|
-
|
|
79766
|
-
// The in operator requires the right operand to be
|
|
79767
|
-
//
|
|
79768
|
-
// 1. assignable to the non-primitive type,
|
|
79769
|
-
// 2. an unconstrained type parameter,
|
|
79770
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
79771
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
79772
|
-
// non-primitive type, or
|
|
79773
|
-
// 4. a type parameter whose constraint is
|
|
79774
|
-
// i. an object type,
|
|
79775
|
-
// ii. the non-primitive type, or
|
|
79776
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
79777
|
-
//
|
|
79778
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
79779
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
79780
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
79781
|
-
// unless *all* instantiations would result in an error.
|
|
79782
|
-
//
|
|
79772
|
+
// The type of the right operand must be assignable to 'object'.
|
|
79773
|
+
checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
|
|
79783
79774
|
// The result is always of the Boolean primitive type.
|
|
79784
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
79785
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79786
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79787
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
79788
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
79789
|
-
}
|
|
79790
79775
|
return booleanType;
|
|
79791
79776
|
}
|
|
79792
79777
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
|
@@ -8690,8 +8690,6 @@ var ts;
|
|
|
8690
8690
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
8691
8691
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
8692
8692
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
8693
|
-
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
8694
|
-
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
8695
8693
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8696
8694
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8697
8695
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -39889,6 +39887,7 @@ var ts;
|
|
|
39889
39887
|
shortName: "h",
|
|
39890
39888
|
type: "boolean",
|
|
39891
39889
|
showInSimplifiedHelpView: true,
|
|
39890
|
+
isCommandLineOnly: true,
|
|
39892
39891
|
category: ts.Diagnostics.Command_line_Options,
|
|
39893
39892
|
description: ts.Diagnostics.Print_this_message,
|
|
39894
39893
|
defaultValueDescription: false,
|
|
@@ -39897,6 +39896,8 @@ var ts;
|
|
|
39897
39896
|
name: "help",
|
|
39898
39897
|
shortName: "?",
|
|
39899
39898
|
type: "boolean",
|
|
39899
|
+
isCommandLineOnly: true,
|
|
39900
|
+
category: ts.Diagnostics.Command_line_Options,
|
|
39900
39901
|
defaultValueDescription: false,
|
|
39901
39902
|
},
|
|
39902
39903
|
{
|
|
@@ -49582,6 +49583,7 @@ var ts;
|
|
|
49582
49583
|
var deferredGlobalOmitSymbol;
|
|
49583
49584
|
var deferredGlobalAwaitedSymbol;
|
|
49584
49585
|
var deferredGlobalBigIntType;
|
|
49586
|
+
var deferredGlobalRecordSymbol;
|
|
49585
49587
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49586
49588
|
var flowLoopStart = 0;
|
|
49587
49589
|
var flowLoopCount = 0;
|
|
@@ -61660,6 +61662,9 @@ var ts;
|
|
|
61660
61662
|
function getGlobalBigIntType() {
|
|
61661
61663
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61662
61664
|
}
|
|
61665
|
+
function getGlobalRecordSymbol() {
|
|
61666
|
+
return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61667
|
+
}
|
|
61663
61668
|
/**
|
|
61664
61669
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61665
61670
|
*/
|
|
@@ -71947,18 +71952,26 @@ var ts;
|
|
|
71947
71952
|
}
|
|
71948
71953
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
71949
71954
|
var prop = getPropertyOfType(type, propName);
|
|
71950
|
-
|
|
71951
|
-
|
|
71952
|
-
|
|
71953
|
-
return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
|
|
71955
|
+
return prop ?
|
|
71956
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
71957
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
71954
71958
|
}
|
|
71955
71959
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71956
|
-
|
|
71957
|
-
|
|
71958
|
-
|
|
71959
|
-
|
|
71960
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
71961
|
+
if (isKnownProperty) {
|
|
71962
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
71963
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
71960
71964
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
71961
71965
|
}
|
|
71966
|
+
if (assumeTrue) {
|
|
71967
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
71968
|
+
// where X is the name of the property.
|
|
71969
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
71970
|
+
if (recordSymbol !== unknownSymbol) {
|
|
71971
|
+
var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
|
|
71972
|
+
return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
|
|
71973
|
+
}
|
|
71974
|
+
}
|
|
71962
71975
|
return type;
|
|
71963
71976
|
}
|
|
71964
71977
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -79753,40 +79766,12 @@ var ts;
|
|
|
79753
79766
|
}
|
|
79754
79767
|
}
|
|
79755
79768
|
else {
|
|
79756
|
-
|
|
79757
|
-
|
|
79758
|
-
// Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
|
|
79759
|
-
if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
|
|
79760
|
-
isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
|
|
79761
|
-
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
79762
|
-
}
|
|
79769
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
79770
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
79763
79771
|
}
|
|
79764
|
-
|
|
79765
|
-
|
|
79766
|
-
// The in operator requires the right operand to be
|
|
79767
|
-
//
|
|
79768
|
-
// 1. assignable to the non-primitive type,
|
|
79769
|
-
// 2. an unconstrained type parameter,
|
|
79770
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
79771
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
79772
|
-
// non-primitive type, or
|
|
79773
|
-
// 4. a type parameter whose constraint is
|
|
79774
|
-
// i. an object type,
|
|
79775
|
-
// ii. the non-primitive type, or
|
|
79776
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
79777
|
-
//
|
|
79778
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
79779
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
79780
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
79781
|
-
// unless *all* instantiations would result in an error.
|
|
79782
|
-
//
|
|
79772
|
+
// The type of the right operand must be assignable to 'object'.
|
|
79773
|
+
checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
|
|
79783
79774
|
// The result is always of the Boolean primitive type.
|
|
79784
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
79785
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79786
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79787
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
79788
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
79789
|
-
}
|
|
79790
79775
|
return booleanType;
|
|
79791
79776
|
}
|
|
79792
79777
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -8680,8 +8680,6 @@ var ts;
|
|
|
8680
8680
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
8681
8681
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
8682
8682
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
8683
|
-
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
8684
|
-
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
8685
8683
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8686
8684
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8687
8685
|
The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
|
|
@@ -39879,6 +39877,7 @@ var ts;
|
|
|
39879
39877
|
shortName: "h",
|
|
39880
39878
|
type: "boolean",
|
|
39881
39879
|
showInSimplifiedHelpView: true,
|
|
39880
|
+
isCommandLineOnly: true,
|
|
39882
39881
|
category: ts.Diagnostics.Command_line_Options,
|
|
39883
39882
|
description: ts.Diagnostics.Print_this_message,
|
|
39884
39883
|
defaultValueDescription: false,
|
|
@@ -39887,6 +39886,8 @@ var ts;
|
|
|
39887
39886
|
name: "help",
|
|
39888
39887
|
shortName: "?",
|
|
39889
39888
|
type: "boolean",
|
|
39889
|
+
isCommandLineOnly: true,
|
|
39890
|
+
category: ts.Diagnostics.Command_line_Options,
|
|
39890
39891
|
defaultValueDescription: false,
|
|
39891
39892
|
},
|
|
39892
39893
|
{
|
|
@@ -49572,6 +49573,7 @@ var ts;
|
|
|
49572
49573
|
var deferredGlobalOmitSymbol;
|
|
49573
49574
|
var deferredGlobalAwaitedSymbol;
|
|
49574
49575
|
var deferredGlobalBigIntType;
|
|
49576
|
+
var deferredGlobalRecordSymbol;
|
|
49575
49577
|
var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
|
|
49576
49578
|
var flowLoopStart = 0;
|
|
49577
49579
|
var flowLoopCount = 0;
|
|
@@ -61650,6 +61652,9 @@ var ts;
|
|
|
61650
61652
|
function getGlobalBigIntType() {
|
|
61651
61653
|
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
|
|
61652
61654
|
}
|
|
61655
|
+
function getGlobalRecordSymbol() {
|
|
61656
|
+
return deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
|
|
61657
|
+
}
|
|
61653
61658
|
/**
|
|
61654
61659
|
* Instantiates a global type that is generic with some element type, and returns that instantiation.
|
|
61655
61660
|
*/
|
|
@@ -71937,18 +71942,26 @@ var ts;
|
|
|
71937
71942
|
}
|
|
71938
71943
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
71939
71944
|
var prop = getPropertyOfType(type, propName);
|
|
71940
|
-
|
|
71941
|
-
|
|
71942
|
-
|
|
71943
|
-
return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
|
|
71945
|
+
return prop ?
|
|
71946
|
+
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
71947
|
+
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
71944
71948
|
}
|
|
71945
71949
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71946
|
-
|
|
71947
|
-
|
|
71948
|
-
|
|
71949
|
-
|
|
71950
|
+
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
71951
|
+
if (isKnownProperty) {
|
|
71952
|
+
// If the check is for a known property (i.e. a property declared in some constituent of
|
|
71953
|
+
// the target type), we filter the target type by presence of absence of the property.
|
|
71950
71954
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
71951
71955
|
}
|
|
71956
|
+
if (assumeTrue) {
|
|
71957
|
+
// If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
|
|
71958
|
+
// where X is the name of the property.
|
|
71959
|
+
var recordSymbol = getGlobalRecordSymbol();
|
|
71960
|
+
if (recordSymbol !== unknownSymbol) {
|
|
71961
|
+
var record_1 = getTypeAliasInstantiation(recordSymbol, [getStringLiteralType(ts.unescapeLeadingUnderscores(name)), unknownType]);
|
|
71962
|
+
return mapType(type, function (t) { return t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? record_1 : getIntersectionType([t, record_1]); });
|
|
71963
|
+
}
|
|
71964
|
+
}
|
|
71952
71965
|
return type;
|
|
71953
71966
|
}
|
|
71954
71967
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
@@ -79743,40 +79756,12 @@ var ts;
|
|
|
79743
79756
|
}
|
|
79744
79757
|
}
|
|
79745
79758
|
else {
|
|
79746
|
-
|
|
79747
|
-
|
|
79748
|
-
// Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
|
|
79749
|
-
if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
|
|
79750
|
-
isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
|
|
79751
|
-
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
79752
|
-
}
|
|
79759
|
+
// The type of the lef operand must be assignable to string, number, or symbol.
|
|
79760
|
+
checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
|
|
79753
79761
|
}
|
|
79754
|
-
|
|
79755
|
-
|
|
79756
|
-
// The in operator requires the right operand to be
|
|
79757
|
-
//
|
|
79758
|
-
// 1. assignable to the non-primitive type,
|
|
79759
|
-
// 2. an unconstrained type parameter,
|
|
79760
|
-
// 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
|
|
79761
|
-
// the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
|
|
79762
|
-
// non-primitive type, or
|
|
79763
|
-
// 4. a type parameter whose constraint is
|
|
79764
|
-
// i. an object type,
|
|
79765
|
-
// ii. the non-primitive type, or
|
|
79766
|
-
// iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
|
|
79767
|
-
//
|
|
79768
|
-
// The divergent behavior for type parameters and unions containing type parameters is a workaround for type
|
|
79769
|
-
// parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
|
|
79770
|
-
// it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
|
|
79771
|
-
// unless *all* instantiations would result in an error.
|
|
79772
|
-
//
|
|
79762
|
+
// The type of the right operand must be assignable to 'object'.
|
|
79763
|
+
checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right);
|
|
79773
79764
|
// The result is always of the Boolean primitive type.
|
|
79774
|
-
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
79775
|
-
if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79776
|
-
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
|
|
79777
|
-
!maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
|
|
79778
|
-
error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
|
|
79779
|
-
}
|
|
79780
79765
|
return booleanType;
|
|
79781
79766
|
}
|
|
79782
79767
|
function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
|
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": "4.9.0-pr-
|
|
5
|
+
"version": "4.9.0-pr-50666-16",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|