typescript 5.5.0-dev.20240430 → 5.5.0-dev.20240502
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 +83 -58
- package/lib/typescript.js +1147 -228
- 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.20240502`;
|
|
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}"),
|
|
@@ -13524,7 +13534,7 @@ function entityNameToString(name) {
|
|
|
13524
13534
|
return Debug.assertNever(name.name);
|
|
13525
13535
|
}
|
|
13526
13536
|
case 311 /* JSDocMemberName */:
|
|
13527
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
13537
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
13528
13538
|
case 295 /* JsxNamespacedName */:
|
|
13529
13539
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
13530
13540
|
default:
|
|
@@ -36958,6 +36968,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
36958
36968
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
36959
36969
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
36960
36970
|
);
|
|
36971
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
36972
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
36973
|
+
return !isString(option.type);
|
|
36974
|
+
}
|
|
36961
36975
|
var optionsForBuild = [
|
|
36962
36976
|
{
|
|
36963
36977
|
name: "verbose",
|
|
@@ -45553,6 +45567,7 @@ function createTypeChecker(host) {
|
|
|
45553
45567
|
getBaseTypes,
|
|
45554
45568
|
getBaseTypeOfLiteralType,
|
|
45555
45569
|
getWidenedType,
|
|
45570
|
+
getWidenedLiteralType,
|
|
45556
45571
|
getTypeFromTypeNode: (nodeIn) => {
|
|
45557
45572
|
const node = getParseTreeNode(nodeIn, isTypeNode);
|
|
45558
45573
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
@@ -48130,12 +48145,6 @@ function createTypeChecker(host) {
|
|
|
48130
48145
|
}
|
|
48131
48146
|
}
|
|
48132
48147
|
}
|
|
48133
|
-
function markConstEnumAliasAsReferenced(symbol) {
|
|
48134
|
-
const links = getSymbolLinks(symbol);
|
|
48135
|
-
if (!links.constEnumReferenced) {
|
|
48136
|
-
links.constEnumReferenced = true;
|
|
48137
|
-
}
|
|
48138
|
-
}
|
|
48139
48148
|
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
|
|
48140
48149
|
if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
|
48141
48150
|
entityName = entityName.parent;
|
|
@@ -68998,7 +69007,7 @@ function createTypeChecker(host) {
|
|
|
68998
69007
|
if (!hasDefaultClause) {
|
|
68999
69008
|
return caseType;
|
|
69000
69009
|
}
|
|
69001
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69010
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69002
69011
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
69003
69012
|
}
|
|
69004
69013
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -69520,8 +69529,6 @@ function createTypeChecker(host) {
|
|
|
69520
69529
|
) & (111551 /* Value */ | 1048576 /* ExportValue */)) {
|
|
69521
69530
|
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) {
|
|
69522
69531
|
markAliasSymbolAsReferenced(symbol);
|
|
69523
|
-
} else {
|
|
69524
|
-
markConstEnumAliasAsReferenced(symbol);
|
|
69525
69532
|
}
|
|
69526
69533
|
}
|
|
69527
69534
|
}
|
|
@@ -70778,60 +70785,71 @@ function createTypeChecker(host) {
|
|
|
70778
70785
|
return false;
|
|
70779
70786
|
}
|
|
70780
70787
|
function discriminateContextualTypeByObjectMembers(node, contextualType) {
|
|
70781
|
-
|
|
70782
|
-
|
|
70783
|
-
|
|
70784
|
-
|
|
70785
|
-
|
|
70786
|
-
|
|
70788
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
70789
|
+
return getCachedType(key) ?? setCachedType(
|
|
70790
|
+
key,
|
|
70791
|
+
getMatchingUnionConstituentForObjectLiteral(contextualType, node) ?? discriminateTypeByDiscriminableItems(
|
|
70792
|
+
contextualType,
|
|
70793
|
+
concatenate(
|
|
70794
|
+
map(
|
|
70795
|
+
filter(node.properties, (p) => {
|
|
70796
|
+
if (!p.symbol) {
|
|
70797
|
+
return false;
|
|
70798
|
+
}
|
|
70799
|
+
if (p.kind === 303 /* PropertyAssignment */) {
|
|
70800
|
+
return isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
70801
|
+
}
|
|
70802
|
+
if (p.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
70803
|
+
return isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
70804
|
+
}
|
|
70787
70805
|
return false;
|
|
70788
|
-
}
|
|
70789
|
-
|
|
70790
|
-
|
|
70791
|
-
|
|
70792
|
-
|
|
70793
|
-
|
|
70794
|
-
|
|
70795
|
-
|
|
70796
|
-
|
|
70797
|
-
|
|
70806
|
+
}),
|
|
70807
|
+
(prop) => [() => getContextFreeTypeOfExpression(prop.kind === 303 /* PropertyAssignment */ ? prop.initializer : prop.name), prop.symbol.escapedName]
|
|
70808
|
+
),
|
|
70809
|
+
map(
|
|
70810
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70811
|
+
var _a;
|
|
70812
|
+
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);
|
|
70813
|
+
}),
|
|
70814
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
70815
|
+
)
|
|
70798
70816
|
),
|
|
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
|
|
70817
|
+
isTypeAssignableTo
|
|
70818
|
+
)
|
|
70808
70819
|
);
|
|
70809
70820
|
}
|
|
70810
70821
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
70822
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
70823
|
+
const cached = getCachedType(key);
|
|
70824
|
+
if (cached)
|
|
70825
|
+
return cached;
|
|
70811
70826
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
70812
|
-
return
|
|
70813
|
-
|
|
70814
|
-
|
|
70815
|
-
|
|
70816
|
-
|
|
70817
|
-
(
|
|
70827
|
+
return setCachedType(
|
|
70828
|
+
key,
|
|
70829
|
+
discriminateTypeByDiscriminableItems(
|
|
70830
|
+
contextualType,
|
|
70831
|
+
concatenate(
|
|
70832
|
+
map(
|
|
70833
|
+
filter(node.properties, (p) => !!p.symbol && p.kind === 291 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))),
|
|
70834
|
+
(prop) => [!prop.initializer ? () => trueType : () => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName]
|
|
70835
|
+
),
|
|
70836
|
+
map(
|
|
70837
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70838
|
+
var _a;
|
|
70839
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
70840
|
+
return false;
|
|
70841
|
+
}
|
|
70842
|
+
const element = node.parent.parent;
|
|
70843
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
70844
|
+
return false;
|
|
70845
|
+
}
|
|
70846
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
70847
|
+
}),
|
|
70848
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
70849
|
+
)
|
|
70818
70850
|
),
|
|
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
|
|
70851
|
+
isTypeAssignableTo
|
|
70852
|
+
)
|
|
70835
70853
|
);
|
|
70836
70854
|
}
|
|
70837
70855
|
function getApparentTypeOfContextualType(node, contextFlags) {
|
|
@@ -119005,6 +119023,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119005
119023
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
119006
119024
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions;
|
|
119007
119025
|
let { oldProgram } = createProgramOptions;
|
|
119026
|
+
for (const option of commandLineOptionOfCustomType) {
|
|
119027
|
+
if (hasProperty(options, option.name)) {
|
|
119028
|
+
if (typeof options[option.name] === "string") {
|
|
119029
|
+
throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
|
|
119030
|
+
}
|
|
119031
|
+
}
|
|
119032
|
+
}
|
|
119008
119033
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
119009
119034
|
let processingDefaultLibFiles;
|
|
119010
119035
|
let processingOtherFiles;
|