@typescript-deploys/pr-build 5.4.0-pr-56736-6 → 5.4.0-pr-56742-5
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 +31 -64
- package/lib/tsserver.js +31 -64
- package/lib/typescript.js +31 -64
- package/lib/typingsInstaller.js +1 -3
- package/package.json +2 -3
package/lib/tsc.js
CHANGED
|
@@ -7794,9 +7794,7 @@ var Diagnostics = {
|
|
|
7794
7794
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7795
7795
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
7796
7796
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7797
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7798
|
-
A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolated_18055", "A member initializer in a enum declaration for a string value must be a string literal when 'isolatedModules' is enabled."),
|
|
7799
|
-
Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
|
|
7797
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7800
7798
|
};
|
|
7801
7799
|
|
|
7802
7800
|
// src/compiler/scanner.ts
|
|
@@ -61691,6 +61689,18 @@ function createTypeChecker(host) {
|
|
|
61691
61689
|
}
|
|
61692
61690
|
return result2;
|
|
61693
61691
|
}
|
|
61692
|
+
function getApparentMappedTypeKeys(nameType, targetType) {
|
|
61693
|
+
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
61694
|
+
const mappedKeys = [];
|
|
61695
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
61696
|
+
modifiersType,
|
|
61697
|
+
8576 /* StringOrNumberLiteralOrUnique */,
|
|
61698
|
+
/*stringsOnly*/
|
|
61699
|
+
false,
|
|
61700
|
+
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
61701
|
+
);
|
|
61702
|
+
return getUnionType(mappedKeys);
|
|
61703
|
+
}
|
|
61694
61704
|
function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) {
|
|
61695
61705
|
let result2;
|
|
61696
61706
|
let originalErrorInfo;
|
|
@@ -61873,16 +61883,8 @@ function createTypeChecker(host) {
|
|
|
61873
61883
|
const constraintType = getConstraintTypeFromMappedType(targetType);
|
|
61874
61884
|
let targetKeys;
|
|
61875
61885
|
if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) {
|
|
61876
|
-
const
|
|
61877
|
-
|
|
61878
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
61879
|
-
modifiersType,
|
|
61880
|
-
8576 /* StringOrNumberLiteralOrUnique */,
|
|
61881
|
-
/*stringsOnly*/
|
|
61882
|
-
false,
|
|
61883
|
-
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
61884
|
-
);
|
|
61885
|
-
targetKeys = getUnionType([...mappedKeys, nameType]);
|
|
61886
|
+
const mappedKeys = getApparentMappedTypeKeys(nameType, targetType);
|
|
61887
|
+
targetKeys = getUnionType([mappedKeys, nameType]);
|
|
61886
61888
|
} else {
|
|
61887
61889
|
targetKeys = nameType || constraintType;
|
|
61888
61890
|
}
|
|
@@ -62053,9 +62055,18 @@ function createTypeChecker(host) {
|
|
|
62053
62055
|
}
|
|
62054
62056
|
}
|
|
62055
62057
|
} else if (sourceFlags & 4194304 /* Index */) {
|
|
62056
|
-
|
|
62058
|
+
const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32 /* Mapped */;
|
|
62059
|
+
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
|
|
62057
62060
|
return result2;
|
|
62058
62061
|
}
|
|
62062
|
+
if (isDeferredMappedIndex) {
|
|
62063
|
+
const mappedType = source2.type;
|
|
62064
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
62065
|
+
const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
|
|
62066
|
+
if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
|
|
62067
|
+
return result2;
|
|
62068
|
+
}
|
|
62069
|
+
}
|
|
62059
62070
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
62060
62071
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
62061
62072
|
const constraint = getBaseConstraintOfType(source2);
|
|
@@ -80188,16 +80199,14 @@ function createTypeChecker(host) {
|
|
|
80188
80199
|
if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
|
|
80189
80200
|
nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
|
|
80190
80201
|
let autoValue = 0;
|
|
80191
|
-
let previous;
|
|
80192
80202
|
for (const member of node.members) {
|
|
80193
|
-
const value = computeMemberValue(member, autoValue
|
|
80203
|
+
const value = computeMemberValue(member, autoValue);
|
|
80194
80204
|
getNodeLinks(member).enumMemberValue = value;
|
|
80195
80205
|
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
80196
|
-
previous = member;
|
|
80197
80206
|
}
|
|
80198
80207
|
}
|
|
80199
80208
|
}
|
|
80200
|
-
function computeMemberValue(member, autoValue
|
|
80209
|
+
function computeMemberValue(member, autoValue) {
|
|
80201
80210
|
if (isComputedNonLiteralName(member.name)) {
|
|
80202
80211
|
error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
80203
80212
|
} else {
|
|
@@ -80212,17 +80221,11 @@ function createTypeChecker(host) {
|
|
|
80212
80221
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
80213
80222
|
return void 0;
|
|
80214
80223
|
}
|
|
80215
|
-
if (autoValue
|
|
80216
|
-
|
|
80217
|
-
return void 0;
|
|
80218
|
-
}
|
|
80219
|
-
if (compilerOptions.isolatedModules && (previous == null ? void 0 : previous.initializer) && !evaluatesToNumericLiteral(previous.initializer)) {
|
|
80220
|
-
error(
|
|
80221
|
-
member.name,
|
|
80222
|
-
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
80223
|
-
);
|
|
80224
|
+
if (autoValue !== void 0) {
|
|
80225
|
+
return autoValue;
|
|
80224
80226
|
}
|
|
80225
|
-
|
|
80227
|
+
error(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
80228
|
+
return void 0;
|
|
80226
80229
|
}
|
|
80227
80230
|
function computeConstantValue(member) {
|
|
80228
80231
|
const isConstEnum = isEnumConst(member.parent);
|
|
@@ -80234,11 +80237,6 @@ function createTypeChecker(host) {
|
|
|
80234
80237
|
initializer,
|
|
80235
80238
|
isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
|
|
80236
80239
|
);
|
|
80237
|
-
} else if (compilerOptions.isolatedModules && typeof value === "string" && !evaluatesToStringLiteral(initializer)) {
|
|
80238
|
-
error(
|
|
80239
|
-
initializer,
|
|
80240
|
-
Diagnostics.A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolatedModules_is_enabled
|
|
80241
|
-
);
|
|
80242
80240
|
}
|
|
80243
80241
|
} else if (isConstEnum) {
|
|
80244
80242
|
error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -80249,37 +80247,6 @@ function createTypeChecker(host) {
|
|
|
80249
80247
|
}
|
|
80250
80248
|
return value;
|
|
80251
80249
|
}
|
|
80252
|
-
function evaluatesToNumericLiteral(expr) {
|
|
80253
|
-
switch (expr.kind) {
|
|
80254
|
-
case 224 /* PrefixUnaryExpression */:
|
|
80255
|
-
return evaluatesToNumericLiteral(expr.operand);
|
|
80256
|
-
case 226 /* BinaryExpression */:
|
|
80257
|
-
return evaluatesToNumericLiteral(expr.left) && evaluatesToNumericLiteral(expr.right);
|
|
80258
|
-
case 217 /* ParenthesizedExpression */:
|
|
80259
|
-
return evaluatesToNumericLiteral(expr.expression);
|
|
80260
|
-
case 9 /* NumericLiteral */:
|
|
80261
|
-
return true;
|
|
80262
|
-
}
|
|
80263
|
-
return false;
|
|
80264
|
-
}
|
|
80265
|
-
function evaluatesToStringLiteral(expr) {
|
|
80266
|
-
switch (expr.kind) {
|
|
80267
|
-
case 226 /* BinaryExpression */:
|
|
80268
|
-
const left = expr.left;
|
|
80269
|
-
const right = expr.right;
|
|
80270
|
-
const leftIsNumeric = evaluatesToNumericLiteral(left);
|
|
80271
|
-
const rightIsNumeric = evaluatesToNumericLiteral(right);
|
|
80272
|
-
return !(leftIsNumeric && rightIsNumeric) && (evaluatesToStringLiteral(left) || leftIsNumeric) && (evaluatesToStringLiteral(right) || rightIsNumeric) && expr.operatorToken.kind === 40 /* PlusToken */;
|
|
80273
|
-
case 228 /* TemplateExpression */:
|
|
80274
|
-
return expr.templateSpans.every((span) => evaluatesToStringLiteral(span.expression));
|
|
80275
|
-
case 217 /* ParenthesizedExpression */:
|
|
80276
|
-
return evaluatesToStringLiteral(expr.expression);
|
|
80277
|
-
case 11 /* StringLiteral */:
|
|
80278
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
80279
|
-
return true;
|
|
80280
|
-
}
|
|
80281
|
-
return false;
|
|
80282
|
-
}
|
|
80283
80250
|
function evaluate(expr, location) {
|
|
80284
80251
|
switch (expr.kind) {
|
|
80285
80252
|
case 224 /* PrefixUnaryExpression */:
|
package/lib/tsserver.js
CHANGED
|
@@ -11349,9 +11349,7 @@ var Diagnostics = {
|
|
|
11349
11349
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
11350
11350
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
11351
11351
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
11352
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
11353
|
-
A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolated_18055", "A member initializer in a enum declaration for a string value must be a string literal when 'isolatedModules' is enabled."),
|
|
11354
|
-
Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
|
|
11352
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
11355
11353
|
};
|
|
11356
11354
|
|
|
11357
11355
|
// src/compiler/scanner.ts
|
|
@@ -66406,6 +66404,18 @@ function createTypeChecker(host) {
|
|
|
66406
66404
|
}
|
|
66407
66405
|
return result2;
|
|
66408
66406
|
}
|
|
66407
|
+
function getApparentMappedTypeKeys(nameType, targetType) {
|
|
66408
|
+
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
66409
|
+
const mappedKeys = [];
|
|
66410
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
66411
|
+
modifiersType,
|
|
66412
|
+
8576 /* StringOrNumberLiteralOrUnique */,
|
|
66413
|
+
/*stringsOnly*/
|
|
66414
|
+
false,
|
|
66415
|
+
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
66416
|
+
);
|
|
66417
|
+
return getUnionType(mappedKeys);
|
|
66418
|
+
}
|
|
66409
66419
|
function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) {
|
|
66410
66420
|
let result2;
|
|
66411
66421
|
let originalErrorInfo;
|
|
@@ -66588,16 +66598,8 @@ function createTypeChecker(host) {
|
|
|
66588
66598
|
const constraintType = getConstraintTypeFromMappedType(targetType);
|
|
66589
66599
|
let targetKeys;
|
|
66590
66600
|
if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) {
|
|
66591
|
-
const
|
|
66592
|
-
|
|
66593
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
66594
|
-
modifiersType,
|
|
66595
|
-
8576 /* StringOrNumberLiteralOrUnique */,
|
|
66596
|
-
/*stringsOnly*/
|
|
66597
|
-
false,
|
|
66598
|
-
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
66599
|
-
);
|
|
66600
|
-
targetKeys = getUnionType([...mappedKeys, nameType]);
|
|
66601
|
+
const mappedKeys = getApparentMappedTypeKeys(nameType, targetType);
|
|
66602
|
+
targetKeys = getUnionType([mappedKeys, nameType]);
|
|
66601
66603
|
} else {
|
|
66602
66604
|
targetKeys = nameType || constraintType;
|
|
66603
66605
|
}
|
|
@@ -66768,9 +66770,18 @@ function createTypeChecker(host) {
|
|
|
66768
66770
|
}
|
|
66769
66771
|
}
|
|
66770
66772
|
} else if (sourceFlags & 4194304 /* Index */) {
|
|
66771
|
-
|
|
66773
|
+
const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32 /* Mapped */;
|
|
66774
|
+
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
|
|
66772
66775
|
return result2;
|
|
66773
66776
|
}
|
|
66777
|
+
if (isDeferredMappedIndex) {
|
|
66778
|
+
const mappedType = source2.type;
|
|
66779
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
66780
|
+
const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
|
|
66781
|
+
if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
|
|
66782
|
+
return result2;
|
|
66783
|
+
}
|
|
66784
|
+
}
|
|
66774
66785
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
66775
66786
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
66776
66787
|
const constraint = getBaseConstraintOfType(source2);
|
|
@@ -84903,16 +84914,14 @@ function createTypeChecker(host) {
|
|
|
84903
84914
|
if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
|
|
84904
84915
|
nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
|
|
84905
84916
|
let autoValue = 0;
|
|
84906
|
-
let previous;
|
|
84907
84917
|
for (const member of node.members) {
|
|
84908
|
-
const value = computeMemberValue(member, autoValue
|
|
84918
|
+
const value = computeMemberValue(member, autoValue);
|
|
84909
84919
|
getNodeLinks(member).enumMemberValue = value;
|
|
84910
84920
|
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
84911
|
-
previous = member;
|
|
84912
84921
|
}
|
|
84913
84922
|
}
|
|
84914
84923
|
}
|
|
84915
|
-
function computeMemberValue(member, autoValue
|
|
84924
|
+
function computeMemberValue(member, autoValue) {
|
|
84916
84925
|
if (isComputedNonLiteralName(member.name)) {
|
|
84917
84926
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
84918
84927
|
} else {
|
|
@@ -84927,17 +84936,11 @@ function createTypeChecker(host) {
|
|
|
84927
84936
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
84928
84937
|
return void 0;
|
|
84929
84938
|
}
|
|
84930
|
-
if (autoValue
|
|
84931
|
-
|
|
84932
|
-
return void 0;
|
|
84933
|
-
}
|
|
84934
|
-
if (compilerOptions.isolatedModules && (previous == null ? void 0 : previous.initializer) && !evaluatesToNumericLiteral(previous.initializer)) {
|
|
84935
|
-
error2(
|
|
84936
|
-
member.name,
|
|
84937
|
-
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
84938
|
-
);
|
|
84939
|
+
if (autoValue !== void 0) {
|
|
84940
|
+
return autoValue;
|
|
84939
84941
|
}
|
|
84940
|
-
|
|
84942
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
84943
|
+
return void 0;
|
|
84941
84944
|
}
|
|
84942
84945
|
function computeConstantValue(member) {
|
|
84943
84946
|
const isConstEnum = isEnumConst(member.parent);
|
|
@@ -84949,11 +84952,6 @@ function createTypeChecker(host) {
|
|
|
84949
84952
|
initializer,
|
|
84950
84953
|
isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
|
|
84951
84954
|
);
|
|
84952
|
-
} else if (compilerOptions.isolatedModules && typeof value === "string" && !evaluatesToStringLiteral(initializer)) {
|
|
84953
|
-
error2(
|
|
84954
|
-
initializer,
|
|
84955
|
-
Diagnostics.A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolatedModules_is_enabled
|
|
84956
|
-
);
|
|
84957
84955
|
}
|
|
84958
84956
|
} else if (isConstEnum) {
|
|
84959
84957
|
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -84964,37 +84962,6 @@ function createTypeChecker(host) {
|
|
|
84964
84962
|
}
|
|
84965
84963
|
return value;
|
|
84966
84964
|
}
|
|
84967
|
-
function evaluatesToNumericLiteral(expr) {
|
|
84968
|
-
switch (expr.kind) {
|
|
84969
|
-
case 224 /* PrefixUnaryExpression */:
|
|
84970
|
-
return evaluatesToNumericLiteral(expr.operand);
|
|
84971
|
-
case 226 /* BinaryExpression */:
|
|
84972
|
-
return evaluatesToNumericLiteral(expr.left) && evaluatesToNumericLiteral(expr.right);
|
|
84973
|
-
case 217 /* ParenthesizedExpression */:
|
|
84974
|
-
return evaluatesToNumericLiteral(expr.expression);
|
|
84975
|
-
case 9 /* NumericLiteral */:
|
|
84976
|
-
return true;
|
|
84977
|
-
}
|
|
84978
|
-
return false;
|
|
84979
|
-
}
|
|
84980
|
-
function evaluatesToStringLiteral(expr) {
|
|
84981
|
-
switch (expr.kind) {
|
|
84982
|
-
case 226 /* BinaryExpression */:
|
|
84983
|
-
const left = expr.left;
|
|
84984
|
-
const right = expr.right;
|
|
84985
|
-
const leftIsNumeric = evaluatesToNumericLiteral(left);
|
|
84986
|
-
const rightIsNumeric = evaluatesToNumericLiteral(right);
|
|
84987
|
-
return !(leftIsNumeric && rightIsNumeric) && (evaluatesToStringLiteral(left) || leftIsNumeric) && (evaluatesToStringLiteral(right) || rightIsNumeric) && expr.operatorToken.kind === 40 /* PlusToken */;
|
|
84988
|
-
case 228 /* TemplateExpression */:
|
|
84989
|
-
return expr.templateSpans.every((span) => evaluatesToStringLiteral(span.expression));
|
|
84990
|
-
case 217 /* ParenthesizedExpression */:
|
|
84991
|
-
return evaluatesToStringLiteral(expr.expression);
|
|
84992
|
-
case 11 /* StringLiteral */:
|
|
84993
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
84994
|
-
return true;
|
|
84995
|
-
}
|
|
84996
|
-
return false;
|
|
84997
|
-
}
|
|
84998
84965
|
function evaluate(expr, location) {
|
|
84999
84966
|
switch (expr.kind) {
|
|
85000
84967
|
case 224 /* PrefixUnaryExpression */:
|
package/lib/typescript.js
CHANGED
|
@@ -9124,9 +9124,7 @@ ${lanes.join("\n")}
|
|
|
9124
9124
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
9125
9125
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
9126
9126
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
9127
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
9128
|
-
A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolated_18055", "A member initializer in a enum declaration for a string value must be a string literal when 'isolatedModules' is enabled."),
|
|
9129
|
-
Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
|
|
9127
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
9130
9128
|
};
|
|
9131
9129
|
}
|
|
9132
9130
|
});
|
|
@@ -64166,6 +64164,18 @@ ${lanes.join("\n")}
|
|
|
64166
64164
|
}
|
|
64167
64165
|
return result2;
|
|
64168
64166
|
}
|
|
64167
|
+
function getApparentMappedTypeKeys(nameType, targetType) {
|
|
64168
|
+
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
64169
|
+
const mappedKeys = [];
|
|
64170
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
64171
|
+
modifiersType,
|
|
64172
|
+
8576 /* StringOrNumberLiteralOrUnique */,
|
|
64173
|
+
/*stringsOnly*/
|
|
64174
|
+
false,
|
|
64175
|
+
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
64176
|
+
);
|
|
64177
|
+
return getUnionType(mappedKeys);
|
|
64178
|
+
}
|
|
64169
64179
|
function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) {
|
|
64170
64180
|
let result2;
|
|
64171
64181
|
let originalErrorInfo;
|
|
@@ -64348,16 +64358,8 @@ ${lanes.join("\n")}
|
|
|
64348
64358
|
const constraintType = getConstraintTypeFromMappedType(targetType);
|
|
64349
64359
|
let targetKeys;
|
|
64350
64360
|
if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) {
|
|
64351
|
-
const
|
|
64352
|
-
|
|
64353
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
64354
|
-
modifiersType,
|
|
64355
|
-
8576 /* StringOrNumberLiteralOrUnique */,
|
|
64356
|
-
/*stringsOnly*/
|
|
64357
|
-
false,
|
|
64358
|
-
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
64359
|
-
);
|
|
64360
|
-
targetKeys = getUnionType([...mappedKeys, nameType]);
|
|
64361
|
+
const mappedKeys = getApparentMappedTypeKeys(nameType, targetType);
|
|
64362
|
+
targetKeys = getUnionType([mappedKeys, nameType]);
|
|
64361
64363
|
} else {
|
|
64362
64364
|
targetKeys = nameType || constraintType;
|
|
64363
64365
|
}
|
|
@@ -64528,9 +64530,18 @@ ${lanes.join("\n")}
|
|
|
64528
64530
|
}
|
|
64529
64531
|
}
|
|
64530
64532
|
} else if (sourceFlags & 4194304 /* Index */) {
|
|
64531
|
-
|
|
64533
|
+
const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32 /* Mapped */;
|
|
64534
|
+
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
|
|
64532
64535
|
return result2;
|
|
64533
64536
|
}
|
|
64537
|
+
if (isDeferredMappedIndex) {
|
|
64538
|
+
const mappedType = source2.type;
|
|
64539
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
64540
|
+
const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
|
|
64541
|
+
if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
|
|
64542
|
+
return result2;
|
|
64543
|
+
}
|
|
64544
|
+
}
|
|
64534
64545
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
64535
64546
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
64536
64547
|
const constraint = getBaseConstraintOfType(source2);
|
|
@@ -82663,16 +82674,14 @@ ${lanes.join("\n")}
|
|
|
82663
82674
|
if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
|
|
82664
82675
|
nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
|
|
82665
82676
|
let autoValue = 0;
|
|
82666
|
-
let previous;
|
|
82667
82677
|
for (const member of node.members) {
|
|
82668
|
-
const value = computeMemberValue(member, autoValue
|
|
82678
|
+
const value = computeMemberValue(member, autoValue);
|
|
82669
82679
|
getNodeLinks(member).enumMemberValue = value;
|
|
82670
82680
|
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
82671
|
-
previous = member;
|
|
82672
82681
|
}
|
|
82673
82682
|
}
|
|
82674
82683
|
}
|
|
82675
|
-
function computeMemberValue(member, autoValue
|
|
82684
|
+
function computeMemberValue(member, autoValue) {
|
|
82676
82685
|
if (isComputedNonLiteralName(member.name)) {
|
|
82677
82686
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
82678
82687
|
} else {
|
|
@@ -82687,17 +82696,11 @@ ${lanes.join("\n")}
|
|
|
82687
82696
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
82688
82697
|
return void 0;
|
|
82689
82698
|
}
|
|
82690
|
-
if (autoValue
|
|
82691
|
-
|
|
82692
|
-
return void 0;
|
|
82693
|
-
}
|
|
82694
|
-
if (compilerOptions.isolatedModules && (previous == null ? void 0 : previous.initializer) && !evaluatesToNumericLiteral(previous.initializer)) {
|
|
82695
|
-
error2(
|
|
82696
|
-
member.name,
|
|
82697
|
-
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
82698
|
-
);
|
|
82699
|
+
if (autoValue !== void 0) {
|
|
82700
|
+
return autoValue;
|
|
82699
82701
|
}
|
|
82700
|
-
|
|
82702
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
82703
|
+
return void 0;
|
|
82701
82704
|
}
|
|
82702
82705
|
function computeConstantValue(member) {
|
|
82703
82706
|
const isConstEnum = isEnumConst(member.parent);
|
|
@@ -82709,11 +82712,6 @@ ${lanes.join("\n")}
|
|
|
82709
82712
|
initializer,
|
|
82710
82713
|
isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
|
|
82711
82714
|
);
|
|
82712
|
-
} else if (compilerOptions.isolatedModules && typeof value === "string" && !evaluatesToStringLiteral(initializer)) {
|
|
82713
|
-
error2(
|
|
82714
|
-
initializer,
|
|
82715
|
-
Diagnostics.A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolatedModules_is_enabled
|
|
82716
|
-
);
|
|
82717
82715
|
}
|
|
82718
82716
|
} else if (isConstEnum) {
|
|
82719
82717
|
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -82724,37 +82722,6 @@ ${lanes.join("\n")}
|
|
|
82724
82722
|
}
|
|
82725
82723
|
return value;
|
|
82726
82724
|
}
|
|
82727
|
-
function evaluatesToNumericLiteral(expr) {
|
|
82728
|
-
switch (expr.kind) {
|
|
82729
|
-
case 224 /* PrefixUnaryExpression */:
|
|
82730
|
-
return evaluatesToNumericLiteral(expr.operand);
|
|
82731
|
-
case 226 /* BinaryExpression */:
|
|
82732
|
-
return evaluatesToNumericLiteral(expr.left) && evaluatesToNumericLiteral(expr.right);
|
|
82733
|
-
case 217 /* ParenthesizedExpression */:
|
|
82734
|
-
return evaluatesToNumericLiteral(expr.expression);
|
|
82735
|
-
case 9 /* NumericLiteral */:
|
|
82736
|
-
return true;
|
|
82737
|
-
}
|
|
82738
|
-
return false;
|
|
82739
|
-
}
|
|
82740
|
-
function evaluatesToStringLiteral(expr) {
|
|
82741
|
-
switch (expr.kind) {
|
|
82742
|
-
case 226 /* BinaryExpression */:
|
|
82743
|
-
const left = expr.left;
|
|
82744
|
-
const right = expr.right;
|
|
82745
|
-
const leftIsNumeric = evaluatesToNumericLiteral(left);
|
|
82746
|
-
const rightIsNumeric = evaluatesToNumericLiteral(right);
|
|
82747
|
-
return !(leftIsNumeric && rightIsNumeric) && (evaluatesToStringLiteral(left) || leftIsNumeric) && (evaluatesToStringLiteral(right) || rightIsNumeric) && expr.operatorToken.kind === 40 /* PlusToken */;
|
|
82748
|
-
case 228 /* TemplateExpression */:
|
|
82749
|
-
return expr.templateSpans.every((span) => evaluatesToStringLiteral(span.expression));
|
|
82750
|
-
case 217 /* ParenthesizedExpression */:
|
|
82751
|
-
return evaluatesToStringLiteral(expr.expression);
|
|
82752
|
-
case 11 /* StringLiteral */:
|
|
82753
|
-
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
82754
|
-
return true;
|
|
82755
|
-
}
|
|
82756
|
-
return false;
|
|
82757
|
-
}
|
|
82758
82725
|
function evaluate(expr, location) {
|
|
82759
82726
|
switch (expr.kind) {
|
|
82760
82727
|
case 224 /* PrefixUnaryExpression */:
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -7171,9 +7171,7 @@ var Diagnostics = {
|
|
|
7171
7171
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7172
7172
|
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
7173
7173
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7174
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7175
|
-
A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_for_a_string_value_must_be_a_string_literal_when_isolated_18055", "A member initializer in a enum declaration for a string value must be a string literal when 'isolatedModules' is enabled."),
|
|
7176
|
-
Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
|
|
7174
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7177
7175
|
};
|
|
7178
7176
|
|
|
7179
7177
|
// src/compiler/scanner.ts
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-56742-5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -91,7 +91,6 @@
|
|
|
91
91
|
"build:compiler": "hereby local",
|
|
92
92
|
"build:tests": "hereby tests",
|
|
93
93
|
"build:tests:notypecheck": "hereby tests --no-typecheck",
|
|
94
|
-
"start": "node lib/tsc",
|
|
95
94
|
"clean": "hereby clean",
|
|
96
95
|
"gulp": "hereby",
|
|
97
96
|
"lint": "hereby lint",
|
|
@@ -115,5 +114,5 @@
|
|
|
115
114
|
"node": "20.1.0",
|
|
116
115
|
"npm": "8.19.4"
|
|
117
116
|
},
|
|
118
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "7dd081f0666f6b01d3999586e2e2f8684bec1400"
|
|
119
118
|
}
|