typescript 5.5.0-dev.20240430 → 5.5.0-dev.20240501
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 +70 -56
- package/lib/typescript.js +1131 -226
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240501`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7716,6 +7716,16 @@ var Diagnostics = {
|
|
|
7716
7716
|
Export_0_from_module_1: diag(90059, 3 /* Message */, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
|
|
7717
7717
|
Export_all_referenced_locals: diag(90060, 3 /* Message */, "Export_all_referenced_locals_90060", "Export all referenced locals"),
|
|
7718
7718
|
Update_modifiers_of_0: diag(90061, 3 /* Message */, "Update_modifiers_of_0_90061", "Update modifiers of '{0}'"),
|
|
7719
|
+
Add_annotation_of_type_0: diag(90062, 3 /* Message */, "Add_annotation_of_type_0_90062", "Add annotation of type '{0}'"),
|
|
7720
|
+
Add_return_type_0: diag(90063, 3 /* Message */, "Add_return_type_0_90063", "Add return type '{0}'"),
|
|
7721
|
+
Extract_base_class_to_variable: diag(90064, 3 /* Message */, "Extract_base_class_to_variable_90064", "Extract base class to variable"),
|
|
7722
|
+
Extract_default_export_to_variable: diag(90065, 3 /* Message */, "Extract_default_export_to_variable_90065", "Extract default export to variable"),
|
|
7723
|
+
Extract_binding_expressions_to_variable: diag(90066, 3 /* Message */, "Extract_binding_expressions_to_variable_90066", "Extract binding expressions to variable"),
|
|
7724
|
+
Add_all_missing_type_annotations: diag(90067, 3 /* Message */, "Add_all_missing_type_annotations_90067", "Add all missing type annotations"),
|
|
7725
|
+
Add_satisfies_and_an_inline_type_assertion_with_0: diag(90068, 3 /* Message */, "Add_satisfies_and_an_inline_type_assertion_with_0_90068", "Add satisfies and an inline type assertion with '{0}'"),
|
|
7726
|
+
Extract_to_variable_and_replace_with_0_as_typeof_0: diag(90069, 3 /* Message */, "Extract_to_variable_and_replace_with_0_as_typeof_0_90069", "Extract to variable and replace with '{0} as typeof {0}'"),
|
|
7727
|
+
Mark_array_literal_as_const: diag(90070, 3 /* Message */, "Mark_array_literal_as_const_90070", "Mark array literal as const"),
|
|
7728
|
+
Annotate_types_of_properties_expando_function_in_a_namespace: diag(90071, 3 /* Message */, "Annotate_types_of_properties_expando_function_in_a_namespace_90071", "Annotate types of properties expando function in a namespace"),
|
|
7719
7729
|
Convert_function_to_an_ES2015_class: diag(95001, 3 /* Message */, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
7720
7730
|
Convert_0_to_1_in_0: diag(95003, 3 /* Message */, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
7721
7731
|
Extract_to_0_in_1: diag(95004, 3 /* Message */, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -45553,6 +45563,7 @@ function createTypeChecker(host) {
|
|
|
45553
45563
|
getBaseTypes,
|
|
45554
45564
|
getBaseTypeOfLiteralType,
|
|
45555
45565
|
getWidenedType,
|
|
45566
|
+
getWidenedLiteralType,
|
|
45556
45567
|
getTypeFromTypeNode: (nodeIn) => {
|
|
45557
45568
|
const node = getParseTreeNode(nodeIn, isTypeNode);
|
|
45558
45569
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
@@ -48130,12 +48141,6 @@ function createTypeChecker(host) {
|
|
|
48130
48141
|
}
|
|
48131
48142
|
}
|
|
48132
48143
|
}
|
|
48133
|
-
function markConstEnumAliasAsReferenced(symbol) {
|
|
48134
|
-
const links = getSymbolLinks(symbol);
|
|
48135
|
-
if (!links.constEnumReferenced) {
|
|
48136
|
-
links.constEnumReferenced = true;
|
|
48137
|
-
}
|
|
48138
|
-
}
|
|
48139
48144
|
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
|
|
48140
48145
|
if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
|
48141
48146
|
entityName = entityName.parent;
|
|
@@ -69520,8 +69525,6 @@ function createTypeChecker(host) {
|
|
|
69520
69525
|
) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
|
|
69521
69526
|
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
|
|
69522
69527
|
markAliasSymbolAsReferenced(symbol);
|
|
69523
|
-
} else {
|
|
69524
|
-
markConstEnumAliasAsReferenced(symbol);
|
|
69525
69528
|
}
|
|
69526
69529
|
}
|
|
69527
69530
|
}
|
|
@@ -70778,60 +70781,71 @@ function createTypeChecker(host) {
|
|
|
70778
70781
|
return false;
|
|
70779
70782
|
}
|
|
70780
70783
|
function discriminateContextualTypeByObjectMembers(node, contextualType) {
|
|
70781
|
-
|
|
70782
|
-
|
|
70783
|
-
|
|
70784
|
-
|
|
70785
|
-
|
|
70786
|
-
|
|
70784
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
70785
|
+
return getCachedType(key) ?? setCachedType(
|
|
70786
|
+
key,
|
|
70787
|
+
getMatchingUnionConstituentForObjectLiteral(contextualType, node) ?? discriminateTypeByDiscriminableItems(
|
|
70788
|
+
contextualType,
|
|
70789
|
+
concatenate(
|
|
70790
|
+
map(
|
|
70791
|
+
filter(node.properties, (p) => {
|
|
70792
|
+
if (!p.symbol) {
|
|
70793
|
+
return false;
|
|
70794
|
+
}
|
|
70795
|
+
if (p.kind === 303 /* PropertyAssignment */) {
|
|
70796
|
+
return isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
70797
|
+
}
|
|
70798
|
+
if (p.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
70799
|
+
return isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
70800
|
+
}
|
|
70787
70801
|
return false;
|
|
70788
|
-
}
|
|
70789
|
-
|
|
70790
|
-
|
|
70791
|
-
|
|
70792
|
-
|
|
70793
|
-
|
|
70794
|
-
|
|
70795
|
-
|
|
70796
|
-
|
|
70797
|
-
|
|
70802
|
+
}),
|
|
70803
|
+
(prop) => [() => getContextFreeTypeOfExpression(prop.kind === 303 /* PropertyAssignment */ ? prop.initializer : prop.name), prop.symbol.escapedName]
|
|
70804
|
+
),
|
|
70805
|
+
map(
|
|
70806
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70807
|
+
var _a;
|
|
70808
|
+
return !!(s.flags & 16777216 /* Optional */) && !!((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
70809
|
+
}),
|
|
70810
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
70811
|
+
)
|
|
70798
70812
|
),
|
|
70799
|
-
|
|
70800
|
-
|
|
70801
|
-
var _a;
|
|
70802
|
-
return !!(s.flags & 16777216 /* Optional */) && !!((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
70803
|
-
}),
|
|
70804
|
-
(s) => [() => undefinedType, s.escapedName]
|
|
70805
|
-
)
|
|
70806
|
-
),
|
|
70807
|
-
isTypeAssignableTo
|
|
70813
|
+
isTypeAssignableTo
|
|
70814
|
+
)
|
|
70808
70815
|
);
|
|
70809
70816
|
}
|
|
70810
70817
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
70818
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
70819
|
+
const cached = getCachedType(key);
|
|
70820
|
+
if (cached)
|
|
70821
|
+
return cached;
|
|
70811
70822
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
70812
|
-
return
|
|
70813
|
-
|
|
70814
|
-
|
|
70815
|
-
|
|
70816
|
-
|
|
70817
|
-
(
|
|
70823
|
+
return setCachedType(
|
|
70824
|
+
key,
|
|
70825
|
+
discriminateTypeByDiscriminableItems(
|
|
70826
|
+
contextualType,
|
|
70827
|
+
concatenate(
|
|
70828
|
+
map(
|
|
70829
|
+
filter(node.properties, (p) => !!p.symbol && p.kind === 291 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))),
|
|
70830
|
+
(prop) => [!prop.initializer ? () => trueType : () => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName]
|
|
70831
|
+
),
|
|
70832
|
+
map(
|
|
70833
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70834
|
+
var _a;
|
|
70835
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
70836
|
+
return false;
|
|
70837
|
+
}
|
|
70838
|
+
const element = node.parent.parent;
|
|
70839
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
70840
|
+
return false;
|
|
70841
|
+
}
|
|
70842
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
70843
|
+
}),
|
|
70844
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
70845
|
+
)
|
|
70818
70846
|
),
|
|
70819
|
-
|
|
70820
|
-
|
|
70821
|
-
var _a;
|
|
70822
|
-
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
70823
|
-
return false;
|
|
70824
|
-
}
|
|
70825
|
-
const element = node.parent.parent;
|
|
70826
|
-
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
70827
|
-
return false;
|
|
70828
|
-
}
|
|
70829
|
-
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
70830
|
-
}),
|
|
70831
|
-
(s) => [() => undefinedType, s.escapedName]
|
|
70832
|
-
)
|
|
70833
|
-
),
|
|
70834
|
-
isTypeAssignableTo
|
|
70847
|
+
isTypeAssignableTo
|
|
70848
|
+
)
|
|
70835
70849
|
);
|
|
70836
70850
|
}
|
|
70837
70851
|
function getApparentTypeOfContextualType(node, contextFlags) {
|