typescript 5.7.2 → 5.8.0-beta
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/README.md +1 -1
- package/lib/_tsc.js +1369 -552
- package/lib/_tsserver.js +43 -7
- package/lib/cs/diagnosticMessages.generated.json +10 -8
- package/lib/de/diagnosticMessages.generated.json +10 -8
- package/lib/es/diagnosticMessages.generated.json +10 -8
- package/lib/fr/diagnosticMessages.generated.json +10 -8
- package/lib/it/diagnosticMessages.generated.json +10 -8
- package/lib/ja/diagnosticMessages.generated.json +10 -8
- package/lib/ko/diagnosticMessages.generated.json +10 -8
- package/lib/lib.dom.d.ts +722 -123
- package/lib/lib.dom.iterable.d.ts +9 -7
- package/lib/lib.es2015.iterable.d.ts +69 -54
- package/lib/lib.es2020.bigint.d.ts +41 -7
- package/lib/lib.es2023.array.d.ts +24 -24
- package/lib/lib.es5.d.ts +60 -51
- package/lib/lib.esnext.d.ts +2 -0
- package/lib/lib.esnext.float16.d.ts +443 -0
- package/lib/lib.esnext.iterator.d.ts +1 -1
- package/lib/lib.esnext.promise.d.ts +34 -0
- package/lib/lib.webworker.d.ts +254 -47
- package/lib/lib.webworker.iterable.d.ts +6 -7
- package/lib/pl/diagnosticMessages.generated.json +10 -8
- package/lib/pt-br/diagnosticMessages.generated.json +10 -8
- package/lib/ru/diagnosticMessages.generated.json +10 -8
- package/lib/tr/diagnosticMessages.generated.json +10 -8
- package/lib/typescript.d.ts +23 -3
- package/lib/typescript.js +1548 -636
- package/lib/zh-cn/diagnosticMessages.generated.json +10 -8
- package/lib/zh-tw/diagnosticMessages.generated.json +10 -8
- package/package.json +22 -22
- package/lib/cancellationToken.js +0 -90
package/lib/typescript.js
CHANGED
@@ -436,6 +436,7 @@ __export(typescript_exports, {
|
|
436
436
|
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
|
437
437
|
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
438
438
|
createProgram: () => createProgram,
|
439
|
+
createProgramDiagnostics: () => createProgramDiagnostics,
|
439
440
|
createProgramHost: () => createProgramHost,
|
440
441
|
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
|
441
442
|
createQueue: () => createQueue,
|
@@ -605,6 +606,8 @@ __export(typescript_exports, {
|
|
605
606
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
606
607
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
607
608
|
forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
|
609
|
+
forEachOptionsSyntaxByName: () => forEachOptionsSyntaxByName,
|
610
|
+
forEachProjectReference: () => forEachProjectReference,
|
608
611
|
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
609
612
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
610
613
|
forEachReturnStatement: () => forEachReturnStatement,
|
@@ -844,6 +847,8 @@ __export(typescript_exports, {
|
|
844
847
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
845
848
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
846
849
|
getLeftmostExpression: () => getLeftmostExpression,
|
850
|
+
getLibFileNameFromLibReference: () => getLibFileNameFromLibReference,
|
851
|
+
getLibNameFromLibReference: () => getLibNameFromLibReference,
|
847
852
|
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
848
853
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
849
854
|
getLineInfo: () => getLineInfo,
|
@@ -916,6 +921,8 @@ __export(typescript_exports, {
|
|
916
921
|
getOptionFromName: () => getOptionFromName,
|
917
922
|
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
918
923
|
getOptionsNameMap: () => getOptionsNameMap,
|
924
|
+
getOptionsSyntaxByArrayElementValue: () => getOptionsSyntaxByArrayElementValue,
|
925
|
+
getOptionsSyntaxByValue: () => getOptionsSyntaxByValue,
|
919
926
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
920
927
|
getOrUpdate: () => getOrUpdate,
|
921
928
|
getOriginalNode: () => getOriginalNode,
|
@@ -952,7 +959,6 @@ __export(typescript_exports, {
|
|
952
959
|
getPrivateIdentifier: () => getPrivateIdentifier,
|
953
960
|
getProperties: () => getProperties,
|
954
961
|
getProperty: () => getProperty,
|
955
|
-
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
|
956
962
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
957
963
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
958
964
|
getPropertyNameFromType: () => getPropertyNameFromType,
|
@@ -1863,6 +1869,7 @@ __export(typescript_exports, {
|
|
1863
1869
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
1864
1870
|
moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
|
1865
1871
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
1872
|
+
moduleSupportsImportAttributes: () => moduleSupportsImportAttributes,
|
1866
1873
|
moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
|
1867
1874
|
moveEmitHelpers: () => moveEmitHelpers,
|
1868
1875
|
moveRangeEnd: () => moveRangeEnd,
|
@@ -2277,8 +2284,8 @@ __export(typescript_exports, {
|
|
2277
2284
|
module.exports = __toCommonJS(typescript_exports);
|
2278
2285
|
|
2279
2286
|
// src/compiler/corePublic.ts
|
2280
|
-
var versionMajorMinor = "5.
|
2281
|
-
var version = "5.
|
2287
|
+
var versionMajorMinor = "5.8";
|
2288
|
+
var version = "5.8.0-beta";
|
2282
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2283
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2284
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -6531,6 +6538,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
6531
6538
|
ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
|
6532
6539
|
ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
|
6533
6540
|
ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType";
|
6541
|
+
ObjectFlags3[ObjectFlags3["IsNarrowingType"] = 16777216] = "IsNarrowingType";
|
6534
6542
|
ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections";
|
6535
6543
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
|
6536
6544
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
@@ -6727,6 +6735,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind3) => {
|
|
6727
6735
|
ModuleKind3[ModuleKind3["ES2022"] = 7] = "ES2022";
|
6728
6736
|
ModuleKind3[ModuleKind3["ESNext"] = 99] = "ESNext";
|
6729
6737
|
ModuleKind3[ModuleKind3["Node16"] = 100] = "Node16";
|
6738
|
+
ModuleKind3[ModuleKind3["Node18"] = 101] = "Node18";
|
6730
6739
|
ModuleKind3[ModuleKind3["NodeNext"] = 199] = "NodeNext";
|
6731
6740
|
ModuleKind3[ModuleKind3["Preserve"] = 200] = "Preserve";
|
6732
6741
|
return ModuleKind3;
|
@@ -7141,8 +7150,9 @@ var OuterExpressionKinds = /* @__PURE__ */ ((OuterExpressionKinds2) => {
|
|
7141
7150
|
OuterExpressionKinds2[OuterExpressionKinds2["NonNullAssertions"] = 4] = "NonNullAssertions";
|
7142
7151
|
OuterExpressionKinds2[OuterExpressionKinds2["PartiallyEmittedExpressions"] = 8] = "PartiallyEmittedExpressions";
|
7143
7152
|
OuterExpressionKinds2[OuterExpressionKinds2["ExpressionsWithTypeArguments"] = 16] = "ExpressionsWithTypeArguments";
|
7144
|
-
OuterExpressionKinds2[OuterExpressionKinds2["
|
7145
|
-
OuterExpressionKinds2[OuterExpressionKinds2["
|
7153
|
+
OuterExpressionKinds2[OuterExpressionKinds2["Satisfies"] = 32] = "Satisfies";
|
7154
|
+
OuterExpressionKinds2[OuterExpressionKinds2["Assertions"] = 38] = "Assertions";
|
7155
|
+
OuterExpressionKinds2[OuterExpressionKinds2["All"] = 63] = "All";
|
7146
7156
|
OuterExpressionKinds2[OuterExpressionKinds2["ExcludeJSDocTypeAssertion"] = -2147483648] = "ExcludeJSDocTypeAssertion";
|
7147
7157
|
return OuterExpressionKinds2;
|
7148
7158
|
})(OuterExpressionKinds || {});
|
@@ -8871,23 +8881,105 @@ function resolvePath(path, ...paths) {
|
|
8871
8881
|
function getNormalizedPathComponents(path, currentDirectory) {
|
8872
8882
|
return reducePathComponents(getPathComponents(path, currentDirectory));
|
8873
8883
|
}
|
8874
|
-
function getNormalizedAbsolutePath(
|
8875
|
-
|
8884
|
+
function getNormalizedAbsolutePath(path, currentDirectory) {
|
8885
|
+
let rootLength = getRootLength(path);
|
8886
|
+
if (rootLength === 0 && currentDirectory) {
|
8887
|
+
path = combinePaths(currentDirectory, path);
|
8888
|
+
rootLength = getRootLength(path);
|
8889
|
+
} else {
|
8890
|
+
path = normalizeSlashes(path);
|
8891
|
+
}
|
8892
|
+
const simpleNormalized = simpleNormalizePath(path);
|
8893
|
+
if (simpleNormalized !== void 0) {
|
8894
|
+
return simpleNormalized.length > rootLength ? removeTrailingDirectorySeparator(simpleNormalized) : simpleNormalized;
|
8895
|
+
}
|
8896
|
+
const length2 = path.length;
|
8897
|
+
const root = path.substring(0, rootLength);
|
8898
|
+
let normalized;
|
8899
|
+
let index = rootLength;
|
8900
|
+
let segmentStart = index;
|
8901
|
+
let normalizedUpTo = index;
|
8902
|
+
let seenNonDotDotSegment = rootLength !== 0;
|
8903
|
+
while (index < length2) {
|
8904
|
+
segmentStart = index;
|
8905
|
+
let ch = path.charCodeAt(index);
|
8906
|
+
while (ch === 47 /* slash */ && index + 1 < length2) {
|
8907
|
+
index++;
|
8908
|
+
ch = path.charCodeAt(index);
|
8909
|
+
}
|
8910
|
+
if (index > segmentStart) {
|
8911
|
+
normalized ?? (normalized = path.substring(0, segmentStart - 1));
|
8912
|
+
segmentStart = index;
|
8913
|
+
}
|
8914
|
+
let segmentEnd = path.indexOf(directorySeparator, index + 1);
|
8915
|
+
if (segmentEnd === -1) {
|
8916
|
+
segmentEnd = length2;
|
8917
|
+
}
|
8918
|
+
const segmentLength = segmentEnd - segmentStart;
|
8919
|
+
if (segmentLength === 1 && path.charCodeAt(index) === 46 /* dot */) {
|
8920
|
+
normalized ?? (normalized = path.substring(0, normalizedUpTo));
|
8921
|
+
} else if (segmentLength === 2 && path.charCodeAt(index) === 46 /* dot */ && path.charCodeAt(index + 1) === 46 /* dot */) {
|
8922
|
+
if (!seenNonDotDotSegment) {
|
8923
|
+
if (normalized !== void 0) {
|
8924
|
+
normalized += normalized.length === rootLength ? ".." : "/..";
|
8925
|
+
} else {
|
8926
|
+
normalizedUpTo = index + 2;
|
8927
|
+
}
|
8928
|
+
} else if (normalized === void 0) {
|
8929
|
+
if (normalizedUpTo - 2 >= 0) {
|
8930
|
+
normalized = path.substring(0, Math.max(rootLength, path.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
|
8931
|
+
} else {
|
8932
|
+
normalized = path.substring(0, normalizedUpTo);
|
8933
|
+
}
|
8934
|
+
} else {
|
8935
|
+
const lastSlash = normalized.lastIndexOf(directorySeparator);
|
8936
|
+
if (lastSlash !== -1) {
|
8937
|
+
normalized = normalized.substring(0, Math.max(rootLength, lastSlash));
|
8938
|
+
} else {
|
8939
|
+
normalized = root;
|
8940
|
+
}
|
8941
|
+
if (normalized.length === rootLength) {
|
8942
|
+
seenNonDotDotSegment = rootLength !== 0;
|
8943
|
+
}
|
8944
|
+
}
|
8945
|
+
} else if (normalized !== void 0) {
|
8946
|
+
if (normalized.length !== rootLength) {
|
8947
|
+
normalized += directorySeparator;
|
8948
|
+
}
|
8949
|
+
seenNonDotDotSegment = true;
|
8950
|
+
normalized += path.substring(segmentStart, segmentEnd);
|
8951
|
+
} else {
|
8952
|
+
seenNonDotDotSegment = true;
|
8953
|
+
normalizedUpTo = segmentEnd;
|
8954
|
+
}
|
8955
|
+
index = segmentEnd + 1;
|
8956
|
+
}
|
8957
|
+
return normalized ?? (length2 > rootLength ? removeTrailingDirectorySeparator(path) : path);
|
8876
8958
|
}
|
8877
8959
|
function normalizePath(path) {
|
8878
8960
|
path = normalizeSlashes(path);
|
8961
|
+
let normalized = simpleNormalizePath(path);
|
8962
|
+
if (normalized !== void 0) {
|
8963
|
+
return normalized;
|
8964
|
+
}
|
8965
|
+
normalized = getNormalizedAbsolutePath(path, "");
|
8966
|
+
return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
8967
|
+
}
|
8968
|
+
function simpleNormalizePath(path) {
|
8879
8969
|
if (!relativePathSegmentRegExp.test(path)) {
|
8880
8970
|
return path;
|
8881
8971
|
}
|
8882
|
-
|
8972
|
+
let simplified = path.replace(/\/\.\//g, "/");
|
8973
|
+
if (simplified.startsWith("./")) {
|
8974
|
+
simplified = simplified.slice(2);
|
8975
|
+
}
|
8883
8976
|
if (simplified !== path) {
|
8884
8977
|
path = simplified;
|
8885
8978
|
if (!relativePathSegmentRegExp.test(path)) {
|
8886
8979
|
return path;
|
8887
8980
|
}
|
8888
8981
|
}
|
8889
|
-
|
8890
|
-
return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
8982
|
+
return void 0;
|
8891
8983
|
}
|
8892
8984
|
function getPathWithoutRoot(pathComponents2) {
|
8893
8985
|
if (pathComponents2.length === 0) return "";
|
@@ -9315,6 +9407,7 @@ var Diagnostics = {
|
|
9315
9407
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
9316
9408
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
9317
9409
|
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
9410
|
+
This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
|
9318
9411
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
9319
9412
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
9320
9413
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
@@ -9329,8 +9422,8 @@ var Diagnostics = {
|
|
9329
9422
|
Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, 1 /* Error */, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
|
9330
9423
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, 1 /* Error */, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
9331
9424
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, 1 /* Error */, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
9332
|
-
|
9333
|
-
|
9425
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'."),
|
9426
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'."),
|
9334
9427
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, 1 /* Error */, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
9335
9428
|
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, 1 /* Error */, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
9336
9429
|
String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
@@ -9347,7 +9440,7 @@ var Diagnostics = {
|
|
9347
9440
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* Error */, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
9348
9441
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* Error */, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
9349
9442
|
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
|
9350
|
-
|
9443
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'."),
|
9351
9444
|
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
9352
9445
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
9353
9446
|
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, 1 /* Error */, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
|
@@ -9377,7 +9470,7 @@ var Diagnostics = {
|
|
9377
9470
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
9378
9471
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
9379
9472
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
9380
|
-
|
9473
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, 1 /* Error */, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
9381
9474
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
|
9382
9475
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
9383
9476
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
@@ -9428,7 +9521,7 @@ var Diagnostics = {
|
|
9428
9521
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
9429
9522
|
The_file_is_in_the_program_because_Colon: diag(1430, 3 /* Message */, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
9430
9523
|
for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, 1 /* Error */, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
9431
|
-
|
9524
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, 1 /* Error */, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
9432
9525
|
Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters: diag(1433, 1 /* Error */, "Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters_1433", "Neither decorators nor modifiers may be applied to 'this' parameters."),
|
9433
9526
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
9434
9527
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, 1 /* Error */, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
@@ -10070,9 +10163,9 @@ var Diagnostics = {
|
|
10070
10163
|
Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, 1 /* Error */, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
|
10071
10164
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
10072
10165
|
Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
|
10073
|
-
|
10166
|
+
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_pres_2821", "Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'."),
|
10074
10167
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
10075
|
-
|
10168
|
+
Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_pres_2823", "Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'."),
|
10076
10169
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
10077
10170
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
|
10078
10171
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
@@ -10092,7 +10185,7 @@ var Diagnostics = {
|
|
10092
10185
|
The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined: diag(2851, 1 /* Error */, "The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_2851", "The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'."),
|
10093
10186
|
await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
|
10094
10187
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
10095
|
-
|
10188
|
+
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
10096
10189
|
Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
|
10097
10190
|
Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2856, 1 /* Error */, "Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2856", "Import attributes are not allowed on statements that compile to CommonJS 'require' calls."),
|
10098
10191
|
Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
|
@@ -10118,6 +10211,7 @@ var Diagnostics = {
|
|
10118
10211
|
This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path: diag(2877, 1 /* Error */, "This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_duri_2877", "This import uses a '{0}' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path."),
|
10119
10212
|
This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
|
10120
10213
|
Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
|
10214
|
+
Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_asserts: diag(2880, 1 /* Error */, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_asserts_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'asserts'."),
|
10121
10215
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
10122
10216
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
10123
10217
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
@@ -10227,6 +10321,8 @@ var Diagnostics = {
|
|
10227
10321
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
10228
10322
|
Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
|
10229
10323
|
One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
|
10324
|
+
This_member_cannot_have_an_override_modifier_because_its_name_is_dynamic: diag(4127, 1 /* Error */, "This_member_cannot_have_an_override_modifier_because_its_name_is_dynamic_4127", "This member cannot have an 'override' modifier because its name is dynamic."),
|
10325
|
+
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_name_is_dynamic: diag(4128, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_name_is_dynamic_4128", "This member cannot have a JSDoc comment with an '@override' tag because its name is dynamic."),
|
10230
10326
|
The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
10231
10327
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
10232
10328
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
@@ -10799,11 +10895,13 @@ var Diagnostics = {
|
|
10799
10895
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
10800
10896
|
Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
|
10801
10897
|
Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any: diag(6720, 3 /* Message */, "Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any_6720", "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'."),
|
10898
|
+
Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript: diag(6721, 3 /* Message */, "Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript_6721", "Do not allow runtime constructs that are not part of ECMAScript."),
|
10802
10899
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
10803
10900
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
10804
10901
|
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
|
10805
10902
|
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
10806
10903
|
This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
|
10904
|
+
Enable_lib_replacement: diag(6808, 3 /* Message */, "Enable_lib_replacement_6808", "Enable lib replacement."),
|
10807
10905
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
10808
10906
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
10809
10907
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
@@ -14547,6 +14645,7 @@ function sortAndDeduplicateDiagnostics(diagnostics) {
|
|
14547
14645
|
}
|
14548
14646
|
var targetToLibMap = /* @__PURE__ */ new Map([
|
14549
14647
|
[99 /* ESNext */, "lib.esnext.full.d.ts"],
|
14648
|
+
[11 /* ES2024 */, "lib.es2024.full.d.ts"],
|
14550
14649
|
[10 /* ES2023 */, "lib.es2023.full.d.ts"],
|
14551
14650
|
[9 /* ES2022 */, "lib.es2022.full.d.ts"],
|
14552
14651
|
[8 /* ES2021 */, "lib.es2021.full.d.ts"],
|
@@ -14562,6 +14661,7 @@ function getDefaultLibFileName(options) {
|
|
14562
14661
|
const target = getEmitScriptTarget(options);
|
14563
14662
|
switch (target) {
|
14564
14663
|
case 99 /* ESNext */:
|
14664
|
+
case 11 /* ES2024 */:
|
14565
14665
|
case 10 /* ES2023 */:
|
14566
14666
|
case 9 /* ES2022 */:
|
14567
14667
|
case 8 /* ES2021 */:
|
@@ -16769,6 +16869,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
16769
16869
|
"trunc",
|
16770
16870
|
"fround",
|
16771
16871
|
"cbrt"
|
16872
|
+
],
|
16873
|
+
esnext: [
|
16874
|
+
"f16round"
|
16772
16875
|
]
|
16773
16876
|
})),
|
16774
16877
|
Map: new Map(Object.entries({
|
@@ -16938,6 +17041,10 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
16938
17041
|
"setBigUint64",
|
16939
17042
|
"getBigInt64",
|
16940
17043
|
"getBigUint64"
|
17044
|
+
],
|
17045
|
+
esnext: [
|
17046
|
+
"setFloat16",
|
17047
|
+
"getFloat16"
|
16941
17048
|
]
|
16942
17049
|
})),
|
16943
17050
|
BigInt: new Map(Object.entries({
|
@@ -17041,6 +17148,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
17041
17148
|
"with"
|
17042
17149
|
]
|
17043
17150
|
})),
|
17151
|
+
Float16Array: new Map(Object.entries({
|
17152
|
+
esnext: emptyArray
|
17153
|
+
})),
|
17044
17154
|
Float32Array: new Map(Object.entries({
|
17045
17155
|
es2022: [
|
17046
17156
|
"at"
|
@@ -17220,7 +17330,7 @@ function getNonAugmentationDeclaration(symbol) {
|
|
17220
17330
|
return (_a = symbol.declarations) == null ? void 0 : _a.find((d) => !isExternalModuleAugmentation(d) && !(isModuleDeclaration(d) && isGlobalScopeAugmentation(d)));
|
17221
17331
|
}
|
17222
17332
|
function isCommonJSContainingModuleKind(kind) {
|
17223
|
-
return kind === 1 /* CommonJS */ ||
|
17333
|
+
return kind === 1 /* CommonJS */ || 100 /* Node16 */ <= kind && kind <= 199 /* NodeNext */;
|
17224
17334
|
}
|
17225
17335
|
function isEffectiveExternalModule(node, compilerOptions) {
|
17226
17336
|
return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
@@ -17934,9 +18044,6 @@ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
17934
18044
|
return key === propName || key2 && key2 === propName ? callback(property) : void 0;
|
17935
18045
|
});
|
17936
18046
|
}
|
17937
|
-
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
17938
|
-
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
17939
|
-
}
|
17940
18047
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
17941
18048
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
17942
18049
|
const expression = tsConfigSourceFile.statements[0].expression;
|
@@ -21765,7 +21872,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
21765
21872
|
dependencies: ["module"],
|
21766
21873
|
computeValue: (compilerOptions) => {
|
21767
21874
|
const target = compilerOptions.target === 0 /* ES3 */ ? void 0 : compilerOptions.target;
|
21768
|
-
return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
21875
|
+
return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 101 /* Node18 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
21769
21876
|
}
|
21770
21877
|
},
|
21771
21878
|
module: {
|
@@ -21784,6 +21891,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
21784
21891
|
moduleResolution = 2 /* Node10 */;
|
21785
21892
|
break;
|
21786
21893
|
case 100 /* Node16 */:
|
21894
|
+
case 101 /* Node18 */:
|
21787
21895
|
moduleResolution = 3 /* Node16 */;
|
21788
21896
|
break;
|
21789
21897
|
case 199 /* NodeNext */:
|
@@ -21803,7 +21911,11 @@ var _computedOptions = createComputedCompilerOptions({
|
|
21803
21911
|
moduleDetection: {
|
21804
21912
|
dependencies: ["module", "target"],
|
21805
21913
|
computeValue: (compilerOptions) => {
|
21806
|
-
|
21914
|
+
if (compilerOptions.moduleDetection !== void 0) {
|
21915
|
+
return compilerOptions.moduleDetection;
|
21916
|
+
}
|
21917
|
+
const moduleKind = _computedOptions.module.computeValue(compilerOptions);
|
21918
|
+
return 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */;
|
21807
21919
|
}
|
21808
21920
|
},
|
21809
21921
|
isolatedModules: {
|
@@ -21820,6 +21932,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
21820
21932
|
}
|
21821
21933
|
switch (_computedOptions.module.computeValue(compilerOptions)) {
|
21822
21934
|
case 100 /* Node16 */:
|
21935
|
+
case 101 /* Node18 */:
|
21823
21936
|
case 199 /* NodeNext */:
|
21824
21937
|
case 200 /* Preserve */:
|
21825
21938
|
return true;
|
@@ -22013,6 +22126,9 @@ function unusedLabelIsError(options) {
|
|
22013
22126
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
22014
22127
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
22015
22128
|
}
|
22129
|
+
function moduleSupportsImportAttributes(moduleKind) {
|
22130
|
+
return 101 /* Node18 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */ || moduleKind === 99 /* ESNext */;
|
22131
|
+
}
|
22016
22132
|
function getStrictOptionValue(compilerOptions, flag) {
|
22017
22133
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
22018
22134
|
}
|
@@ -22763,7 +22879,7 @@ function isValidBigIntString(s, roundTripOnly) {
|
|
22763
22879
|
return success && result === 10 /* BigIntLiteral */ && scanner2.getTokenEnd() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) }));
|
22764
22880
|
}
|
22765
22881
|
function isValidTypeOnlyAliasUseSite(useSite) {
|
22766
|
-
return !!(useSite.flags & 33554432 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
22882
|
+
return !!(useSite.flags & 33554432 /* Ambient */) || isInJSDoc(useSite) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
22767
22883
|
}
|
22768
22884
|
function isShorthandPropertyNameUseSite(useSite) {
|
22769
22885
|
return isIdentifier(useSite) && isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite;
|
@@ -23935,6 +24051,64 @@ function getNodeAtPosition(sourceFile, position, includeJSDoc) {
|
|
23935
24051
|
function isNewScopeNode(node) {
|
23936
24052
|
return isFunctionLike(node) || isJSDocSignature(node) || isMappedTypeNode(node);
|
23937
24053
|
}
|
24054
|
+
function getLibNameFromLibReference(libReference) {
|
24055
|
+
return toFileNameLowerCase(libReference.fileName);
|
24056
|
+
}
|
24057
|
+
function getLibFileNameFromLibReference(libReference) {
|
24058
|
+
const libName = getLibNameFromLibReference(libReference);
|
24059
|
+
return libMap.get(libName);
|
24060
|
+
}
|
24061
|
+
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
24062
|
+
return forEachProjectReference(
|
24063
|
+
/*projectReferences*/
|
24064
|
+
void 0,
|
24065
|
+
resolvedProjectReferences,
|
24066
|
+
(resolvedRef, parent2) => resolvedRef && cb(resolvedRef, parent2)
|
24067
|
+
);
|
24068
|
+
}
|
24069
|
+
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
24070
|
+
let seenResolvedRefs;
|
24071
|
+
return worker(
|
24072
|
+
projectReferences,
|
24073
|
+
resolvedProjectReferences,
|
24074
|
+
/*parent*/
|
24075
|
+
void 0
|
24076
|
+
);
|
24077
|
+
function worker(projectReferences2, resolvedProjectReferences2, parent2) {
|
24078
|
+
if (cbRef) {
|
24079
|
+
const result = cbRef(projectReferences2, parent2);
|
24080
|
+
if (result) return result;
|
24081
|
+
}
|
24082
|
+
let skipChildren;
|
24083
|
+
return forEach(
|
24084
|
+
resolvedProjectReferences2,
|
24085
|
+
(resolvedRef, index) => {
|
24086
|
+
if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
|
24087
|
+
(skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
|
24088
|
+
return void 0;
|
24089
|
+
}
|
24090
|
+
const result = cbResolvedRef(resolvedRef, parent2, index);
|
24091
|
+
if (result || !resolvedRef) return result;
|
24092
|
+
(seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
|
24093
|
+
}
|
24094
|
+
) || forEach(
|
24095
|
+
resolvedProjectReferences2,
|
24096
|
+
(resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
|
24097
|
+
);
|
24098
|
+
}
|
24099
|
+
}
|
24100
|
+
function getOptionsSyntaxByArrayElementValue(optionsObject, name, value) {
|
24101
|
+
return optionsObject && getPropertyArrayElementValue(optionsObject, name, value);
|
24102
|
+
}
|
24103
|
+
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
24104
|
+
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
24105
|
+
}
|
24106
|
+
function getOptionsSyntaxByValue(optionsObject, name, value) {
|
24107
|
+
return forEachOptionsSyntaxByName(optionsObject, name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
24108
|
+
}
|
24109
|
+
function forEachOptionsSyntaxByName(optionsObject, name, callback) {
|
24110
|
+
return forEachPropertyAssignment(optionsObject, name, callback);
|
24111
|
+
}
|
23938
24112
|
|
23939
24113
|
// src/compiler/factory/baseNodeFactory.ts
|
23940
24114
|
function createBaseNodeFactory() {
|
@@ -26552,6 +26726,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
26552
26726
|
node.colonToken = colonToken ?? createToken(59 /* ColonToken */);
|
26553
26727
|
node.whenFalse = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenFalse);
|
26554
26728
|
node.transformFlags |= propagateChildFlags(node.condition) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.whenTrue) | propagateChildFlags(node.colonToken) | propagateChildFlags(node.whenFalse);
|
26729
|
+
node.flowNodeWhenFalse = void 0;
|
26730
|
+
node.flowNodeWhenTrue = void 0;
|
26555
26731
|
return node;
|
26556
26732
|
}
|
26557
26733
|
function updateConditionalExpression(node, condition, questionToken, whenTrue, colonToken, whenFalse) {
|
@@ -28355,7 +28531,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
28355
28531
|
function isIgnorableParen(node) {
|
28356
28532
|
return isParenthesizedExpression(node) && nodeIsSynthesized(node) && nodeIsSynthesized(getSourceMapRange(node)) && nodeIsSynthesized(getCommentRange(node)) && !some(getSyntheticLeadingComments(node)) && !some(getSyntheticTrailingComments(node));
|
28357
28533
|
}
|
28358
|
-
function restoreOuterExpressions(outerExpression, innerExpression, kinds =
|
28534
|
+
function restoreOuterExpressions(outerExpression, innerExpression, kinds = 63 /* All */) {
|
28359
28535
|
if (outerExpression && isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) {
|
28360
28536
|
return updateOuterExpression(
|
28361
28537
|
outerExpression,
|
@@ -28401,7 +28577,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
28401
28577
|
}
|
28402
28578
|
}
|
28403
28579
|
function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers = false) {
|
28404
|
-
const callee = skipOuterExpressions(expression,
|
28580
|
+
const callee = skipOuterExpressions(expression, 63 /* All */);
|
28405
28581
|
let thisArg;
|
28406
28582
|
let target;
|
28407
28583
|
if (isSuperProperty(callee)) {
|
@@ -31404,7 +31580,7 @@ function getJSDocTypeAssertionType(node) {
|
|
31404
31580
|
Debug.assertIsDefined(type);
|
31405
31581
|
return type;
|
31406
31582
|
}
|
31407
|
-
function isOuterExpression(node, kinds =
|
31583
|
+
function isOuterExpression(node, kinds = 63 /* All */) {
|
31408
31584
|
switch (node.kind) {
|
31409
31585
|
case 217 /* ParenthesizedExpression */:
|
31410
31586
|
if (kinds & -2147483648 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) {
|
@@ -31413,8 +31589,9 @@ function isOuterExpression(node, kinds = 31 /* All */) {
|
|
31413
31589
|
return (kinds & 1 /* Parentheses */) !== 0;
|
31414
31590
|
case 216 /* TypeAssertionExpression */:
|
31415
31591
|
case 234 /* AsExpression */:
|
31416
|
-
case 238 /* SatisfiesExpression */:
|
31417
31592
|
return (kinds & 2 /* TypeAssertions */) !== 0;
|
31593
|
+
case 238 /* SatisfiesExpression */:
|
31594
|
+
return (kinds & (2 /* TypeAssertions */ | 32 /* Satisfies */)) !== 0;
|
31418
31595
|
case 233 /* ExpressionWithTypeArguments */:
|
31419
31596
|
return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
|
31420
31597
|
case 235 /* NonNullExpression */:
|
@@ -31424,13 +31601,13 @@ function isOuterExpression(node, kinds = 31 /* All */) {
|
|
31424
31601
|
}
|
31425
31602
|
return false;
|
31426
31603
|
}
|
31427
|
-
function skipOuterExpressions(node, kinds =
|
31604
|
+
function skipOuterExpressions(node, kinds = 63 /* All */) {
|
31428
31605
|
while (isOuterExpression(node, kinds)) {
|
31429
31606
|
node = node.expression;
|
31430
31607
|
}
|
31431
31608
|
return node;
|
31432
31609
|
}
|
31433
|
-
function walkUpOuterExpressions(node, kinds =
|
31610
|
+
function walkUpOuterExpressions(node, kinds = 63 /* All */) {
|
31434
31611
|
let parent2 = node.parent;
|
31435
31612
|
while (isOuterExpression(parent2, kinds)) {
|
31436
31613
|
parent2 = parent2.parent;
|
@@ -39306,6 +39483,7 @@ var Parser;
|
|
39306
39483
|
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
|
39307
39484
|
const res = finishNode(node, pos);
|
39308
39485
|
if (usedBrace) {
|
39486
|
+
skipWhitespace();
|
39309
39487
|
parseExpected(20 /* CloseBraceToken */);
|
39310
39488
|
}
|
39311
39489
|
return res;
|
@@ -40351,6 +40529,8 @@ var libEntries = [
|
|
40351
40529
|
["esnext.regexp", "lib.es2024.regexp.d.ts"],
|
40352
40530
|
["esnext.string", "lib.es2024.string.d.ts"],
|
40353
40531
|
["esnext.iterator", "lib.esnext.iterator.d.ts"],
|
40532
|
+
["esnext.promise", "lib.esnext.promise.d.ts"],
|
40533
|
+
["esnext.float16", "lib.esnext.float16.d.ts"],
|
40354
40534
|
["decorators", "lib.decorators.d.ts"],
|
40355
40535
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
40356
40536
|
];
|
@@ -40677,6 +40857,7 @@ var moduleOptionDeclaration = {
|
|
40677
40857
|
es2022: 7 /* ES2022 */,
|
40678
40858
|
esnext: 99 /* ESNext */,
|
40679
40859
|
node16: 100 /* Node16 */,
|
40860
|
+
node18: 101 /* Node18 */,
|
40680
40861
|
nodenext: 199 /* NodeNext */,
|
40681
40862
|
preserve: 200 /* Preserve */
|
40682
40863
|
})),
|
@@ -40929,6 +41110,23 @@ var commandOptionsWithoutBuild = [
|
|
40929
41110
|
affectsBuildInfo: true,
|
40930
41111
|
affectsSemanticDiagnostics: true
|
40931
41112
|
},
|
41113
|
+
{
|
41114
|
+
name: "erasableSyntaxOnly",
|
41115
|
+
type: "boolean",
|
41116
|
+
category: Diagnostics.Interop_Constraints,
|
41117
|
+
description: Diagnostics.Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript,
|
41118
|
+
defaultValueDescription: false,
|
41119
|
+
affectsBuildInfo: true,
|
41120
|
+
affectsSemanticDiagnostics: true
|
41121
|
+
},
|
41122
|
+
{
|
41123
|
+
name: "libReplacement",
|
41124
|
+
type: "boolean",
|
41125
|
+
affectsProgramStructure: true,
|
41126
|
+
category: Diagnostics.Language_and_Environment,
|
41127
|
+
description: Diagnostics.Enable_lib_replacement,
|
41128
|
+
defaultValueDescription: true
|
41129
|
+
},
|
40932
41130
|
// Strict Type Checks
|
40933
41131
|
{
|
40934
41132
|
name: "strict",
|
@@ -45099,9 +45297,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
45099
45297
|
}
|
45100
45298
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
45101
45299
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
45102
|
-
|
45103
|
-
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
45104
|
-
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths), state);
|
45300
|
+
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo), state);
|
45105
45301
|
}
|
45106
45302
|
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
|
45107
45303
|
if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== void 0) {
|
@@ -45119,8 +45315,7 @@ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache
|
|
45119
45315
|
/*onlyRecordFailures*/
|
45120
45316
|
false,
|
45121
45317
|
loadPackageJsonMainState,
|
45122
|
-
packageJsonInfo
|
45123
|
-
getVersionPathsOfPackageJsonInfo(packageJsonInfo, loadPackageJsonMainState)
|
45318
|
+
packageJsonInfo
|
45124
45319
|
);
|
45125
45320
|
entrypoints = append(entrypoints, mainResolution == null ? void 0 : mainResolution.path);
|
45126
45321
|
if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
|
@@ -45323,13 +45518,14 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
45323
45518
|
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
45324
45519
|
}
|
45325
45520
|
}
|
45326
|
-
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state,
|
45521
|
+
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJson) {
|
45522
|
+
const versionPaths = packageJson && getVersionPathsOfPackageJsonInfo(packageJson, state);
|
45327
45523
|
let packageFile;
|
45328
|
-
if (
|
45524
|
+
if (packageJson && arePathsEqual(packageJson == null ? void 0 : packageJson.packageDirectory, candidate, state.host)) {
|
45329
45525
|
if (state.isConfigLookup) {
|
45330
|
-
packageFile = readPackageJsonTSConfigField(
|
45526
|
+
packageFile = readPackageJsonTSConfigField(packageJson.contents.packageJsonContent, packageJson.packageDirectory, state);
|
45331
45527
|
} else {
|
45332
|
-
packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(
|
45528
|
+
packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(packageJson.contents.packageJsonContent, packageJson.packageDirectory, state) || extensions & (3 /* ImplementationFiles */ | 4 /* Declaration */) && readPackageJsonMainField(packageJson.contents.packageJsonContent, packageJson.packageDirectory, state) || void 0;
|
45333
45529
|
}
|
45334
45530
|
}
|
45335
45531
|
const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
|
@@ -45348,7 +45544,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
45348
45544
|
const features = state2.features;
|
45349
45545
|
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
45350
45546
|
state2.candidateIsFromPackageJsonField = true;
|
45351
|
-
if ((
|
45547
|
+
if ((packageJson == null ? void 0 : packageJson.contents.packageJsonContent.type) !== "module") {
|
45352
45548
|
state2.features &= ~32 /* EsmMode */;
|
45353
45549
|
}
|
45354
45550
|
const result = nodeLoadModuleByRelativeName(
|
@@ -45619,6 +45815,7 @@ function hasOneAsterisk(patternKey) {
|
|
45619
45815
|
function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
45620
45816
|
return loadModuleFromTargetExportOrImport;
|
45621
45817
|
function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
|
45818
|
+
var _a, _b;
|
45622
45819
|
if (typeof target === "string") {
|
45623
45820
|
if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
|
45624
45821
|
if (state.traceEnabled) {
|
@@ -45647,6 +45844,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
45647
45844
|
redirectedReference,
|
45648
45845
|
state.conditions
|
45649
45846
|
);
|
45847
|
+
(_a = state.failedLookupLocations) == null ? void 0 : _a.push(...result.failedLookupLocations ?? emptyArray);
|
45848
|
+
(_b = state.affectingLocations) == null ? void 0 : _b.push(...result.affectingLocations ?? emptyArray);
|
45650
45849
|
return toSearchResult(
|
45651
45850
|
result.resolvedModule ? {
|
45652
45851
|
path: result.resolvedModule.resolvedFileName,
|
@@ -45756,20 +45955,20 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
45756
45955
|
void 0
|
45757
45956
|
);
|
45758
45957
|
function toAbsolutePath(path) {
|
45759
|
-
var
|
45958
|
+
var _a2, _b2;
|
45760
45959
|
if (path === void 0) return path;
|
45761
|
-
return getNormalizedAbsolutePath(path, (
|
45960
|
+
return getNormalizedAbsolutePath(path, (_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2));
|
45762
45961
|
}
|
45763
45962
|
function combineDirectoryPath(root, dir) {
|
45764
45963
|
return ensureTrailingDirectorySeparator(combinePaths(root, dir));
|
45765
45964
|
}
|
45766
45965
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
45767
|
-
var
|
45966
|
+
var _a2, _b2, _c, _d;
|
45768
45967
|
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
|
45769
45968
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
|
45770
45969
|
const commonSourceDirGuesses = [];
|
45771
45970
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
45772
|
-
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((
|
45971
|
+
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName));
|
45773
45972
|
commonSourceDirGuesses.push(commonDir);
|
45774
45973
|
} else if (state.requestContainingDirectory) {
|
45775
45974
|
const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts"));
|
@@ -45825,8 +46024,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
45825
46024
|
}
|
45826
46025
|
return void 0;
|
45827
46026
|
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
45828
|
-
var
|
45829
|
-
const currentDir = state.compilerOptions.configFile ? ((
|
46027
|
+
var _a3, _b3;
|
46028
|
+
const currentDir = state.compilerOptions.configFile ? ((_b3 = (_a3 = state.host).getCurrentDirectory) == null ? void 0 : _b3.call(_a3)) || "" : commonSourceDirGuess;
|
45830
46029
|
const candidateDirectories = [];
|
45831
46030
|
if (state.compilerOptions.declarationDir) {
|
45832
46031
|
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
@@ -45873,7 +46072,7 @@ function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directo
|
|
45873
46072
|
);
|
45874
46073
|
}
|
45875
46074
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
45876
|
-
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */;
|
46075
|
+
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ || state.conditions.includes("import") ? 99 /* ESNext */ : 1 /* CommonJS */;
|
45877
46076
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
45878
46077
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
45879
46078
|
if (priorityExtensions) {
|
@@ -45951,8 +46150,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
45951
46150
|
candidate,
|
45952
46151
|
!nodeModulesDirectoryExists,
|
45953
46152
|
state,
|
45954
|
-
packageInfo
|
45955
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
46153
|
+
packageInfo
|
45956
46154
|
);
|
45957
46155
|
return withPackageId(packageInfo, fromDirectory, state);
|
45958
46156
|
}
|
@@ -45962,8 +46160,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
45962
46160
|
candidate2,
|
45963
46161
|
onlyRecordFailures,
|
45964
46162
|
state2,
|
45965
|
-
packageInfo
|
45966
|
-
packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
|
46163
|
+
packageInfo
|
45967
46164
|
);
|
45968
46165
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
45969
46166
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
@@ -46411,6 +46608,7 @@ function createBinder() {
|
|
46411
46608
|
var preSwitchCaseFlow;
|
46412
46609
|
var activeLabelList;
|
46413
46610
|
var hasExplicitReturn;
|
46611
|
+
var inReturnPosition;
|
46414
46612
|
var hasFlowEffects;
|
46415
46613
|
var emitFlags;
|
46416
46614
|
var inStrictMode;
|
@@ -46483,6 +46681,7 @@ function createBinder() {
|
|
46483
46681
|
currentExceptionTarget = void 0;
|
46484
46682
|
activeLabelList = void 0;
|
46485
46683
|
hasExplicitReturn = false;
|
46684
|
+
inReturnPosition = false;
|
46486
46685
|
hasFlowEffects = false;
|
46487
46686
|
inAssignmentPattern = false;
|
46488
46687
|
emitFlags = 0 /* None */;
|
@@ -46719,6 +46918,8 @@ function createBinder() {
|
|
46719
46918
|
const saveContainer = container;
|
46720
46919
|
const saveThisParentContainer = thisParentContainer;
|
46721
46920
|
const savedBlockScopeContainer = blockScopeContainer;
|
46921
|
+
const savedInReturnPosition = inReturnPosition;
|
46922
|
+
if (node.kind === 219 /* ArrowFunction */ && node.body.kind !== 241 /* Block */) inReturnPosition = true;
|
46722
46923
|
if (containerFlags & 1 /* IsContainer */) {
|
46723
46924
|
if (node.kind !== 219 /* ArrowFunction */) {
|
46724
46925
|
thisParentContainer = container;
|
@@ -46796,6 +46997,7 @@ function createBinder() {
|
|
46796
46997
|
} else {
|
46797
46998
|
bindChildren(node);
|
46798
46999
|
}
|
47000
|
+
inReturnPosition = savedInReturnPosition;
|
46799
47001
|
container = saveContainer;
|
46800
47002
|
thisParentContainer = saveThisParentContainer;
|
46801
47003
|
blockScopeContainer = savedBlockScopeContainer;
|
@@ -46817,6 +47019,9 @@ function createBinder() {
|
|
46817
47019
|
const saveInAssignmentPattern = inAssignmentPattern;
|
46818
47020
|
inAssignmentPattern = false;
|
46819
47021
|
if (checkUnreachable(node)) {
|
47022
|
+
if (canHaveFlowNode(node) && node.flowNode) {
|
47023
|
+
node.flowNode = void 0;
|
47024
|
+
}
|
46820
47025
|
bindEachChild(node);
|
46821
47026
|
bindJSDoc(node);
|
46822
47027
|
inAssignmentPattern = saveInAssignmentPattern;
|
@@ -47012,7 +47217,9 @@ function createBinder() {
|
|
47012
47217
|
case 36 /* ExclamationEqualsToken */:
|
47013
47218
|
case 37 /* EqualsEqualsEqualsToken */:
|
47014
47219
|
case 38 /* ExclamationEqualsEqualsToken */:
|
47015
|
-
|
47220
|
+
const left = skipParentheses(expr.left);
|
47221
|
+
const right = skipParentheses(expr.right);
|
47222
|
+
return isNarrowableOperand(left) || isNarrowableOperand(right) || isNarrowingTypeofOperands(right, left) || isNarrowingTypeofOperands(left, right) || (isBooleanLiteral(right) && isNarrowingExpression(left) || isBooleanLiteral(left) && isNarrowingExpression(right));
|
47016
47223
|
case 104 /* InstanceOfKeyword */:
|
47017
47224
|
return isNarrowableOperand(expr.left);
|
47018
47225
|
case 103 /* InKeyword */:
|
@@ -47204,13 +47411,16 @@ function createBinder() {
|
|
47204
47411
|
function bindForStatement(node) {
|
47205
47412
|
const preLoopLabel = setContinueTarget(node, createLoopLabel());
|
47206
47413
|
const preBodyLabel = createBranchLabel();
|
47414
|
+
const preIncrementorLabel = createBranchLabel();
|
47207
47415
|
const postLoopLabel = createBranchLabel();
|
47208
47416
|
bind(node.initializer);
|
47209
47417
|
addAntecedent(preLoopLabel, currentFlow);
|
47210
47418
|
currentFlow = preLoopLabel;
|
47211
47419
|
bindCondition(node.condition, preBodyLabel, postLoopLabel);
|
47212
47420
|
currentFlow = finishFlowLabel(preBodyLabel);
|
47213
|
-
bindIterativeStatement(node.statement, postLoopLabel,
|
47421
|
+
bindIterativeStatement(node.statement, postLoopLabel, preIncrementorLabel);
|
47422
|
+
addAntecedent(preIncrementorLabel, currentFlow);
|
47423
|
+
currentFlow = finishFlowLabel(preIncrementorLabel);
|
47214
47424
|
bind(node.incrementor);
|
47215
47425
|
addAntecedent(preLoopLabel, currentFlow);
|
47216
47426
|
currentFlow = finishFlowLabel(postLoopLabel);
|
@@ -47247,7 +47457,10 @@ function createBinder() {
|
|
47247
47457
|
currentFlow = finishFlowLabel(postIfLabel);
|
47248
47458
|
}
|
47249
47459
|
function bindReturnOrThrow(node) {
|
47460
|
+
const savedInReturnPosition = inReturnPosition;
|
47461
|
+
inReturnPosition = true;
|
47250
47462
|
bind(node.expression);
|
47463
|
+
inReturnPosition = savedInReturnPosition;
|
47251
47464
|
if (node.kind === 253 /* ReturnStatement */) {
|
47252
47465
|
hasExplicitReturn = true;
|
47253
47466
|
if (currentReturnTarget) {
|
@@ -47608,10 +47821,16 @@ function createBinder() {
|
|
47608
47821
|
hasFlowEffects = false;
|
47609
47822
|
bindCondition(node.condition, trueLabel, falseLabel);
|
47610
47823
|
currentFlow = finishFlowLabel(trueLabel);
|
47824
|
+
if (inReturnPosition) {
|
47825
|
+
node.flowNodeWhenTrue = currentFlow;
|
47826
|
+
}
|
47611
47827
|
bind(node.questionToken);
|
47612
47828
|
bind(node.whenTrue);
|
47613
47829
|
addAntecedent(postExpressionLabel, currentFlow);
|
47614
47830
|
currentFlow = finishFlowLabel(falseLabel);
|
47831
|
+
if (inReturnPosition) {
|
47832
|
+
node.flowNodeWhenFalse = currentFlow;
|
47833
|
+
}
|
47615
47834
|
bind(node.colonToken);
|
47616
47835
|
bind(node.whenFalse);
|
47617
47836
|
addAntecedent(postExpressionLabel, currentFlow);
|
@@ -50768,8 +50987,8 @@ function createTypeChecker(host) {
|
|
50768
50987
|
writeSignature: (signature, enclosingDeclaration, flags, kind, writer) => {
|
50769
50988
|
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer);
|
50770
50989
|
},
|
50771
|
-
writeType: (type, enclosingDeclaration, flags, writer) => {
|
50772
|
-
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer);
|
50990
|
+
writeType: (type, enclosingDeclaration, flags, writer, verbosityLevel, out) => {
|
50991
|
+
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, verbosityLevel, out);
|
50773
50992
|
},
|
50774
50993
|
writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => {
|
50775
50994
|
return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
|
@@ -50885,6 +51104,7 @@ function createTypeChecker(host) {
|
|
50885
51104
|
getNumberLiteralType,
|
50886
51105
|
getBigIntType: () => bigintType,
|
50887
51106
|
getBigIntLiteralType,
|
51107
|
+
getUnknownType: () => unknownType,
|
50888
51108
|
createPromiseType,
|
50889
51109
|
createArrayType,
|
50890
51110
|
getElementTypeOfArrayType,
|
@@ -51001,8 +51221,13 @@ function createTypeChecker(host) {
|
|
51001
51221
|
getMemberOverrideModifierStatus,
|
51002
51222
|
isTypeParameterPossiblyReferenced,
|
51003
51223
|
typeHasCallOrConstructSignatures,
|
51004
|
-
getSymbolFlags
|
51224
|
+
getSymbolFlags,
|
51225
|
+
getTypeArgumentsForResolvedSignature
|
51005
51226
|
};
|
51227
|
+
function getTypeArgumentsForResolvedSignature(signature) {
|
51228
|
+
if (signature.mapper === void 0) return void 0;
|
51229
|
+
return instantiateTypes((signature.target || signature).typeParameters, signature.mapper);
|
51230
|
+
}
|
51006
51231
|
function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
|
51007
51232
|
const candidatesSet = /* @__PURE__ */ new Set();
|
51008
51233
|
const candidates = [];
|
@@ -51379,6 +51604,12 @@ function createTypeChecker(host) {
|
|
51379
51604
|
/*isReadonly*/
|
51380
51605
|
true
|
51381
51606
|
);
|
51607
|
+
var anyBaseTypeIndexInfo = createIndexInfo(
|
51608
|
+
stringType,
|
51609
|
+
anyType,
|
51610
|
+
/*isReadonly*/
|
51611
|
+
false
|
51612
|
+
);
|
51382
51613
|
var iterationTypesCache = /* @__PURE__ */ new Map();
|
51383
51614
|
var noIterationTypes = {
|
51384
51615
|
get yieldType() {
|
@@ -51555,6 +51786,7 @@ function createTypeChecker(host) {
|
|
51555
51786
|
[".jsx", ".jsx"],
|
51556
51787
|
[".json", ".json"]
|
51557
51788
|
];
|
51789
|
+
var narrowableReturnTypeCache = /* @__PURE__ */ new Map();
|
51558
51790
|
initializeTypeChecker();
|
51559
51791
|
return checker;
|
51560
51792
|
function isDefinitelyReferenceToGlobalSymbolObject(node) {
|
@@ -52418,9 +52650,9 @@ function createTypeChecker(host) {
|
|
52418
52650
|
const containerKind = grandparent.parent.kind;
|
52419
52651
|
if (containerKind === 264 /* InterfaceDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
|
52420
52652
|
error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_It_can_only_extend_other_named_object_types, unescapeLeadingUnderscores(name));
|
52421
|
-
} else if (
|
52653
|
+
} else if (isClassLike(grandparent.parent) && heritageKind === 96 /* ExtendsKeyword */) {
|
52422
52654
|
error2(errorLocation, Diagnostics.A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values, unescapeLeadingUnderscores(name));
|
52423
|
-
} else if (
|
52655
|
+
} else if (isClassLike(grandparent.parent) && heritageKind === 119 /* ImplementsKeyword */) {
|
52424
52656
|
error2(errorLocation, Diagnostics.A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types, unescapeLeadingUnderscores(name));
|
52425
52657
|
}
|
52426
52658
|
} else {
|
@@ -53596,7 +53828,7 @@ function createTypeChecker(host) {
|
|
53596
53828
|
moduleReference
|
53597
53829
|
);
|
53598
53830
|
}
|
53599
|
-
if (errorNode && (
|
53831
|
+
if (errorNode && (moduleKind === 100 /* Node16 */ || moduleKind === 101 /* Node18 */)) {
|
53600
53832
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
53601
53833
|
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
|
53602
53834
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
@@ -54690,14 +54922,18 @@ function createTypeChecker(host) {
|
|
54690
54922
|
return writer2;
|
54691
54923
|
}
|
54692
54924
|
}
|
54693
|
-
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
54694
|
-
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation
|
54925
|
+
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter(""), verbosityLevel, out) {
|
54926
|
+
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */ || verbosityLevel !== void 0;
|
54695
54927
|
const typeNode = nodeBuilder.typeToTypeNode(
|
54696
54928
|
type,
|
54697
54929
|
enclosingDeclaration,
|
54698
|
-
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0
|
54930
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0),
|
54699
54931
|
/*internalFlags*/
|
54700
|
-
void 0
|
54932
|
+
void 0,
|
54933
|
+
/*tracker*/
|
54934
|
+
void 0,
|
54935
|
+
verbosityLevel,
|
54936
|
+
out
|
54701
54937
|
);
|
54702
54938
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
54703
54939
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
@@ -54837,12 +55073,7 @@ function createTypeChecker(host) {
|
|
54837
55073
|
enterNewScope(context, node) {
|
54838
55074
|
if (isFunctionLike(node) || isJSDocSignature(node)) {
|
54839
55075
|
const signature = getSignatureFromDeclaration(node);
|
54840
|
-
|
54841
|
-
signature,
|
54842
|
-
/*skipUnionExpanding*/
|
54843
|
-
true
|
54844
|
-
)[0];
|
54845
|
-
return enterNewScope(context, node, expandedParams, signature.typeParameters);
|
55076
|
+
return enterNewScope(context, node, signature.parameters, signature.typeParameters);
|
54846
55077
|
} else {
|
54847
55078
|
const typeParameters = isConditionalTypeNode(node) ? getInferTypeParameters(node) : [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))];
|
54848
55079
|
return enterNewScope(
|
@@ -54922,38 +55153,134 @@ function createTypeChecker(host) {
|
|
54922
55153
|
return true;
|
54923
55154
|
}
|
54924
55155
|
if (requiresAddingUndefined && annotationType) {
|
54925
|
-
annotationType =
|
55156
|
+
annotationType = addOptionality(annotationType, !isParameter(node));
|
54926
55157
|
}
|
54927
55158
|
return !!annotationType && typeNodeIsEquivalentToType(node, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type);
|
54928
55159
|
}
|
54929
55160
|
};
|
54930
55161
|
return {
|
54931
55162
|
syntacticBuilderResolver,
|
54932
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
54933
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
54934
|
-
|
54935
|
-
|
54936
|
-
|
54937
|
-
|
54938
|
-
|
54939
|
-
|
54940
|
-
|
54941
|
-
|
54942
|
-
)
|
54943
|
-
|
54944
|
-
|
54945
|
-
|
54946
|
-
|
54947
|
-
|
54948
|
-
|
54949
|
-
|
54950
|
-
)
|
54951
|
-
|
54952
|
-
|
54953
|
-
|
54954
|
-
|
54955
|
-
|
54956
|
-
|
55163
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeToTypeNodeHelper(type, context), out),
|
55164
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55165
|
+
enclosingDeclaration,
|
55166
|
+
flags,
|
55167
|
+
internalFlags,
|
55168
|
+
tracker,
|
55169
|
+
/*verbosityLevel*/
|
55170
|
+
void 0,
|
55171
|
+
(context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)
|
55172
|
+
),
|
55173
|
+
serializeTypeForDeclaration: (declaration, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55174
|
+
enclosingDeclaration,
|
55175
|
+
flags,
|
55176
|
+
internalFlags,
|
55177
|
+
tracker,
|
55178
|
+
/*verbosityLevel*/
|
55179
|
+
void 0,
|
55180
|
+
(context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)
|
55181
|
+
),
|
55182
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55183
|
+
enclosingDeclaration,
|
55184
|
+
flags,
|
55185
|
+
internalFlags,
|
55186
|
+
tracker,
|
55187
|
+
/*verbosityLevel*/
|
55188
|
+
void 0,
|
55189
|
+
(context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)
|
55190
|
+
),
|
55191
|
+
serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55192
|
+
enclosingDeclaration,
|
55193
|
+
flags,
|
55194
|
+
internalFlags,
|
55195
|
+
tracker,
|
55196
|
+
/*verbosityLevel*/
|
55197
|
+
void 0,
|
55198
|
+
(context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)
|
55199
|
+
),
|
55200
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55201
|
+
enclosingDeclaration,
|
55202
|
+
flags,
|
55203
|
+
internalFlags,
|
55204
|
+
tracker,
|
55205
|
+
/*verbosityLevel*/
|
55206
|
+
void 0,
|
55207
|
+
(context) => indexInfoToIndexSignatureDeclarationHelper(
|
55208
|
+
indexInfo,
|
55209
|
+
context,
|
55210
|
+
/*typeNode*/
|
55211
|
+
void 0
|
55212
|
+
)
|
55213
|
+
),
|
55214
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55215
|
+
enclosingDeclaration,
|
55216
|
+
flags,
|
55217
|
+
internalFlags,
|
55218
|
+
tracker,
|
55219
|
+
/*verbosityLevel*/
|
55220
|
+
void 0,
|
55221
|
+
(context) => signatureToSignatureDeclarationHelper(signature, kind, context)
|
55222
|
+
),
|
55223
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55224
|
+
enclosingDeclaration,
|
55225
|
+
flags,
|
55226
|
+
internalFlags,
|
55227
|
+
tracker,
|
55228
|
+
/*verbosityLevel*/
|
55229
|
+
void 0,
|
55230
|
+
(context) => symbolToName(
|
55231
|
+
symbol,
|
55232
|
+
context,
|
55233
|
+
meaning,
|
55234
|
+
/*expectsIdentifier*/
|
55235
|
+
false
|
55236
|
+
)
|
55237
|
+
),
|
55238
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55239
|
+
enclosingDeclaration,
|
55240
|
+
flags,
|
55241
|
+
internalFlags,
|
55242
|
+
tracker,
|
55243
|
+
/*verbosityLevel*/
|
55244
|
+
void 0,
|
55245
|
+
(context) => symbolToExpression(symbol, context, meaning)
|
55246
|
+
),
|
55247
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55248
|
+
enclosingDeclaration,
|
55249
|
+
flags,
|
55250
|
+
internalFlags,
|
55251
|
+
tracker,
|
55252
|
+
/*verbosityLevel*/
|
55253
|
+
void 0,
|
55254
|
+
(context) => typeParametersToTypeParameterDeclarations(symbol, context)
|
55255
|
+
),
|
55256
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55257
|
+
enclosingDeclaration,
|
55258
|
+
flags,
|
55259
|
+
internalFlags,
|
55260
|
+
tracker,
|
55261
|
+
/*verbosityLevel*/
|
55262
|
+
void 0,
|
55263
|
+
(context) => symbolToParameterDeclaration(symbol, context)
|
55264
|
+
),
|
55265
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeParameterToDeclaration(parameter, context)),
|
55266
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55267
|
+
enclosingDeclaration,
|
55268
|
+
flags,
|
55269
|
+
internalFlags,
|
55270
|
+
tracker,
|
55271
|
+
/*verbosityLevel*/
|
55272
|
+
void 0,
|
55273
|
+
(context) => symbolTableToDeclarationStatements(symbolTable, context)
|
55274
|
+
),
|
55275
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55276
|
+
enclosingDeclaration,
|
55277
|
+
flags,
|
55278
|
+
internalFlags,
|
55279
|
+
tracker,
|
55280
|
+
/*verbosityLevel*/
|
55281
|
+
void 0,
|
55282
|
+
(context) => symbolToNode(symbol, context, meaning)
|
55283
|
+
)
|
54957
55284
|
};
|
54958
55285
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
54959
55286
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
@@ -54995,7 +55322,7 @@ function createTypeChecker(host) {
|
|
54995
55322
|
}
|
54996
55323
|
return symbolToExpression(symbol, context, meaning);
|
54997
55324
|
}
|
54998
|
-
function withContext2(enclosingDeclaration, flags, internalFlags, tracker, cb) {
|
55325
|
+
function withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, cb, out) {
|
54999
55326
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
55000
55327
|
const context = {
|
55001
55328
|
enclosingDeclaration,
|
@@ -55003,6 +55330,7 @@ function createTypeChecker(host) {
|
|
55003
55330
|
flags: flags || 0 /* None */,
|
55004
55331
|
internalFlags: internalFlags || 0 /* None */,
|
55005
55332
|
tracker: void 0,
|
55333
|
+
unfoldDepth: verbosityLevel ?? -1,
|
55006
55334
|
encounteredError: false,
|
55007
55335
|
suppressReportInferenceFallback: false,
|
55008
55336
|
reportedDiagnostic: false,
|
@@ -55024,13 +55352,18 @@ function createTypeChecker(host) {
|
|
55024
55352
|
typeParameterNamesByText: void 0,
|
55025
55353
|
typeParameterNamesByTextNextNameCount: void 0,
|
55026
55354
|
enclosingSymbolTypes: /* @__PURE__ */ new Map(),
|
55027
|
-
mapper: void 0
|
55355
|
+
mapper: void 0,
|
55356
|
+
depth: 0,
|
55357
|
+
couldUnfoldMore: false
|
55028
55358
|
};
|
55029
55359
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
55030
55360
|
const resultingNode = cb(context);
|
55031
55361
|
if (context.truncating && context.flags & 1 /* NoTruncation */) {
|
55032
55362
|
context.tracker.reportTruncationError();
|
55033
55363
|
}
|
55364
|
+
if (out) {
|
55365
|
+
out.couldUnfoldMore = context.couldUnfoldMore;
|
55366
|
+
}
|
55034
55367
|
return context.encounteredError ? void 0 : resultingNode;
|
55035
55368
|
}
|
55036
55369
|
function addSymbolTypeToContext(context, symbol, type) {
|
@@ -55049,16 +55382,36 @@ function createTypeChecker(host) {
|
|
55049
55382
|
function saveRestoreFlags(context) {
|
55050
55383
|
const flags = context.flags;
|
55051
55384
|
const internalFlags = context.internalFlags;
|
55385
|
+
const depth = context.depth;
|
55052
55386
|
return restore;
|
55053
55387
|
function restore() {
|
55054
55388
|
context.flags = flags;
|
55055
55389
|
context.internalFlags = internalFlags;
|
55390
|
+
context.depth = depth;
|
55056
55391
|
}
|
55057
55392
|
}
|
55058
55393
|
function checkTruncationLength(context) {
|
55059
55394
|
if (context.truncating) return context.truncating;
|
55060
55395
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
55061
55396
|
}
|
55397
|
+
function couldUnfoldType(type, context) {
|
55398
|
+
var _a;
|
55399
|
+
if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
|
55400
|
+
return false;
|
55401
|
+
}
|
55402
|
+
return context.depth < context.unfoldDepth || context.depth === context.unfoldDepth && !context.couldUnfoldMore;
|
55403
|
+
}
|
55404
|
+
function canUnfoldType(type, context) {
|
55405
|
+
var _a;
|
55406
|
+
if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
|
55407
|
+
return false;
|
55408
|
+
}
|
55409
|
+
const result = context.depth < context.unfoldDepth;
|
55410
|
+
if (!result) {
|
55411
|
+
context.couldUnfoldMore = true;
|
55412
|
+
}
|
55413
|
+
return result;
|
55414
|
+
}
|
55062
55415
|
function typeToTypeNodeHelper(type, context) {
|
55063
55416
|
const restoreFlags = saveRestoreFlags(context);
|
55064
55417
|
const typeNode = typeToTypeNodeWorker(type, context);
|
@@ -55206,16 +55559,27 @@ function createTypeChecker(host) {
|
|
55206
55559
|
return factory.createThisTypeNode();
|
55207
55560
|
}
|
55208
55561
|
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
|
55209
|
-
|
55210
|
-
|
55211
|
-
|
55212
|
-
|
55562
|
+
if (!canUnfoldType(type, context)) {
|
55563
|
+
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
55564
|
+
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
|
55565
|
+
if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
|
55566
|
+
return factory.createArrayTypeNode(typeArgumentNodes[0]);
|
55567
|
+
}
|
55568
|
+
return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
|
55213
55569
|
}
|
55214
|
-
|
55570
|
+
context.depth += 1;
|
55215
55571
|
}
|
55216
55572
|
const objectFlags = getObjectFlags(type);
|
55217
55573
|
if (objectFlags & 4 /* Reference */) {
|
55218
55574
|
Debug.assert(!!(type.flags & 524288 /* Object */));
|
55575
|
+
if (canUnfoldType(type, context)) {
|
55576
|
+
context.depth += 1;
|
55577
|
+
return createAnonymousTypeNode(
|
55578
|
+
type,
|
55579
|
+
/*forceClassExpansion*/
|
55580
|
+
true
|
55581
|
+
);
|
55582
|
+
}
|
55219
55583
|
return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
|
55220
55584
|
}
|
55221
55585
|
if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
|
@@ -55245,6 +55609,14 @@ function createTypeChecker(host) {
|
|
55245
55609
|
void 0
|
55246
55610
|
);
|
55247
55611
|
}
|
55612
|
+
if (objectFlags & 3 /* ClassOrInterface */ && canUnfoldType(type, context)) {
|
55613
|
+
context.depth += 1;
|
55614
|
+
return createAnonymousTypeNode(
|
55615
|
+
type,
|
55616
|
+
/*forceClassExpansion*/
|
55617
|
+
true
|
55618
|
+
);
|
55619
|
+
}
|
55248
55620
|
if (type.symbol) {
|
55249
55621
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
55250
55622
|
}
|
@@ -55448,7 +55820,7 @@ function createTypeChecker(host) {
|
|
55448
55820
|
}
|
55449
55821
|
return result;
|
55450
55822
|
}
|
55451
|
-
function createAnonymousTypeNode(type2) {
|
55823
|
+
function createAnonymousTypeNode(type2, forceClassExpansion = false) {
|
55452
55824
|
var _a2, _b2;
|
55453
55825
|
const typeId = type2.id;
|
55454
55826
|
const symbol = type2.symbol;
|
@@ -55471,7 +55843,7 @@ function createTypeChecker(host) {
|
|
55471
55843
|
const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
|
55472
55844
|
if (isJSConstructor(symbol.valueDeclaration)) {
|
55473
55845
|
return symbolToTypeNode(symbol, context, isInstanceType);
|
55474
|
-
} else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
55846
|
+
} else if (symbol.flags & 32 /* Class */ && !forceClassExpansion && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
55475
55847
|
symbol,
|
55476
55848
|
context.enclosingDeclaration,
|
55477
55849
|
isInstanceType,
|
@@ -55495,7 +55867,7 @@ function createTypeChecker(host) {
|
|
55495
55867
|
function shouldWriteTypeOfFunctionSymbol() {
|
55496
55868
|
var _a3;
|
55497
55869
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
55498
|
-
some(symbol.declarations, (declaration) => isStatic(declaration));
|
55870
|
+
some(symbol.declarations, (declaration) => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)));
|
55499
55871
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
55500
55872
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
55501
55873
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
@@ -55515,7 +55887,7 @@ function createTypeChecker(host) {
|
|
55515
55887
|
if (id && !context.symbolDepth) {
|
55516
55888
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
55517
55889
|
}
|
55518
|
-
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
55890
|
+
const links = context.unfoldDepth >= 0 ? void 0 : context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
55519
55891
|
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
55520
55892
|
if (links) {
|
55521
55893
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
@@ -55798,6 +56170,38 @@ function createTypeChecker(host) {
|
|
55798
56170
|
ids.unshift(state);
|
55799
56171
|
return ids;
|
55800
56172
|
}
|
56173
|
+
function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo, context2, typeNode) {
|
56174
|
+
if (indexInfo.components) {
|
56175
|
+
const allComponentComputedNamesSerializable = every(indexInfo.components, (e) => {
|
56176
|
+
var _a2;
|
56177
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context2.enclosingDeclaration && ((_a2 = isEntityNameVisible(
|
56178
|
+
e.name.expression,
|
56179
|
+
context2.enclosingDeclaration,
|
56180
|
+
/*shouldComputeAliasToMakeVisible*/
|
56181
|
+
false
|
56182
|
+
)) == null ? void 0 : _a2.accessibility) === 0 /* Accessible */);
|
56183
|
+
});
|
56184
|
+
if (allComponentComputedNamesSerializable) {
|
56185
|
+
const newComponents = filter(indexInfo.components, (e) => {
|
56186
|
+
return !hasLateBindableName(e);
|
56187
|
+
});
|
56188
|
+
return map(newComponents, (e) => {
|
56189
|
+
trackComputedName(e.name.expression, context2.enclosingDeclaration, context2);
|
56190
|
+
return setTextRange2(
|
56191
|
+
context2,
|
56192
|
+
factory.createPropertySignature(
|
56193
|
+
indexInfo.isReadonly ? [factory.createModifier(148 /* ReadonlyKeyword */)] : void 0,
|
56194
|
+
e.name,
|
56195
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
56196
|
+
typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context2)
|
56197
|
+
),
|
56198
|
+
e
|
56199
|
+
);
|
56200
|
+
});
|
56201
|
+
}
|
56202
|
+
}
|
56203
|
+
return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context2, typeNode)];
|
56204
|
+
}
|
55801
56205
|
function createTypeNodesFromResolvedType(resolvedType) {
|
55802
56206
|
if (checkTruncationLength(context)) {
|
55803
56207
|
if (context.flags & 1 /* NoTruncation */) {
|
@@ -55822,7 +56226,7 @@ function createTypeChecker(host) {
|
|
55822
56226
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context));
|
55823
56227
|
}
|
55824
56228
|
for (const info of resolvedType.indexInfos) {
|
55825
|
-
typeElements.push(
|
56229
|
+
typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
|
55826
56230
|
}
|
55827
56231
|
const properties = resolvedType.properties;
|
55828
56232
|
if (!properties) {
|
@@ -56430,7 +56834,7 @@ function createTypeChecker(host) {
|
|
56430
56834
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
56431
56835
|
}
|
56432
56836
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
56433
|
-
return typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
56837
|
+
return !couldUnfoldType(type, context) && typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
56434
56838
|
}
|
56435
56839
|
function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
|
56436
56840
|
const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
|
@@ -56511,7 +56915,7 @@ function createTypeChecker(host) {
|
|
56511
56915
|
if (!context.tracker.canTrackSymbol) return;
|
56512
56916
|
const firstIdentifier = getFirstIdentifier(accessExpression);
|
56513
56917
|
const name = resolveName(
|
56514
|
-
|
56918
|
+
enclosingDeclaration,
|
56515
56919
|
firstIdentifier.escapedText,
|
56516
56920
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
56517
56921
|
/*nameNotFoundMessage*/
|
@@ -56521,6 +56925,19 @@ function createTypeChecker(host) {
|
|
56521
56925
|
);
|
56522
56926
|
if (name) {
|
56523
56927
|
context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
|
56928
|
+
} else {
|
56929
|
+
const fallback = resolveName(
|
56930
|
+
firstIdentifier,
|
56931
|
+
firstIdentifier.escapedText,
|
56932
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
56933
|
+
/*nameNotFoundMessage*/
|
56934
|
+
void 0,
|
56935
|
+
/*isUse*/
|
56936
|
+
true
|
56937
|
+
);
|
56938
|
+
if (fallback) {
|
56939
|
+
context.tracker.trackSymbol(fallback, enclosingDeclaration, 111551 /* Value */);
|
56940
|
+
}
|
56524
56941
|
}
|
56525
56942
|
}
|
56526
56943
|
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
|
@@ -57064,7 +57481,7 @@ function createTypeChecker(host) {
|
|
57064
57481
|
let result;
|
57065
57482
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
57066
57483
|
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
57067
|
-
if (decl) {
|
57484
|
+
if (!couldUnfoldType(type, context) && decl) {
|
57068
57485
|
if (isAccessor(decl)) {
|
57069
57486
|
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
|
57070
57487
|
} else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
|
@@ -61180,12 +61597,7 @@ function createTypeChecker(host) {
|
|
61180
61597
|
addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType));
|
61181
61598
|
callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */));
|
61182
61599
|
constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */));
|
61183
|
-
const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [
|
61184
|
-
stringType,
|
61185
|
-
anyType,
|
61186
|
-
/*isReadonly*/
|
61187
|
-
false
|
61188
|
-
)];
|
61600
|
+
const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [anyBaseTypeIndexInfo];
|
61189
61601
|
indexInfos = concatenate(indexInfos, filter(inheritedIndexInfos, (info) => !findIndexInfo(indexInfos, info.keyType)));
|
61190
61602
|
}
|
61191
61603
|
}
|
@@ -61711,12 +62123,7 @@ function createTypeChecker(host) {
|
|
61711
62123
|
members = createSymbolTable(getNamedOrIndexSignatureMembers(members));
|
61712
62124
|
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
|
61713
62125
|
} else if (baseConstructorType === anyType) {
|
61714
|
-
baseConstructorIndexInfo =
|
61715
|
-
stringType,
|
61716
|
-
anyType,
|
61717
|
-
/*isReadonly*/
|
61718
|
-
false
|
61719
|
-
);
|
62126
|
+
baseConstructorIndexInfo = anyBaseTypeIndexInfo;
|
61720
62127
|
}
|
61721
62128
|
}
|
61722
62129
|
const indexSymbol = getIndexSymbolFromSymbolTable(members);
|
@@ -63345,8 +63752,8 @@ function createTypeChecker(host) {
|
|
63345
63752
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
63346
63753
|
return symbolTable.get("__index" /* Index */);
|
63347
63754
|
}
|
63348
|
-
function createIndexInfo(keyType, type, isReadonly, declaration) {
|
63349
|
-
return { keyType, type, isReadonly, declaration };
|
63755
|
+
function createIndexInfo(keyType, type, isReadonly, declaration, components) {
|
63756
|
+
return { keyType, type, isReadonly, declaration, components };
|
63350
63757
|
}
|
63351
63758
|
function getIndexInfosOfSymbol(symbol) {
|
63352
63759
|
const indexSymbol = getIndexSymbol(symbol);
|
@@ -63786,11 +64193,14 @@ function createTypeChecker(host) {
|
|
63786
64193
|
function isNoInferType(type) {
|
63787
64194
|
return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
|
63788
64195
|
}
|
63789
|
-
function
|
63790
|
-
return
|
64196
|
+
function isNarrowingSubstitutionType(type) {
|
64197
|
+
return !!(type.flags & 33554432 /* Substitution */ && type.objectFlags & 16777216 /* IsNarrowingType */);
|
63791
64198
|
}
|
63792
|
-
function
|
63793
|
-
|
64199
|
+
function getSubstitutionType(baseType, constraint, isNarrowed) {
|
64200
|
+
return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint, isNarrowed);
|
64201
|
+
}
|
64202
|
+
function getOrCreateSubstitutionType(baseType, constraint, isNarrowed) {
|
64203
|
+
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}${isNarrowed ? ">N" : ""}`;
|
63794
64204
|
const cached = substitutionTypes.get(id);
|
63795
64205
|
if (cached) {
|
63796
64206
|
return cached;
|
@@ -63798,6 +64208,9 @@ function createTypeChecker(host) {
|
|
63798
64208
|
const result = createType(33554432 /* Substitution */);
|
63799
64209
|
result.baseType = baseType;
|
63800
64210
|
result.constraint = constraint;
|
64211
|
+
if (isNarrowed) {
|
64212
|
+
result.objectFlags |= 16777216 /* IsNarrowingType */;
|
64213
|
+
}
|
63801
64214
|
substitutionTypes.set(id, result);
|
63802
64215
|
return result;
|
63803
64216
|
}
|
@@ -63859,6 +64272,9 @@ function createTypeChecker(host) {
|
|
63859
64272
|
case "Number":
|
63860
64273
|
checkNoTypeArguments(node);
|
63861
64274
|
return numberType;
|
64275
|
+
case "BigInt":
|
64276
|
+
checkNoTypeArguments(node);
|
64277
|
+
return bigintType;
|
63862
64278
|
case "Boolean":
|
63863
64279
|
checkNoTypeArguments(node);
|
63864
64280
|
return booleanType;
|
@@ -66000,7 +66416,7 @@ function createTypeChecker(host) {
|
|
66000
66416
|
function isDeferredType(type, checkTuples) {
|
66001
66417
|
return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
|
66002
66418
|
}
|
66003
|
-
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
|
66419
|
+
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing) {
|
66004
66420
|
let result;
|
66005
66421
|
let extraTypes;
|
66006
66422
|
let tailCount = 0;
|
@@ -66017,10 +66433,11 @@ function createTypeChecker(host) {
|
|
66017
66433
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
66018
66434
|
return wildcardType;
|
66019
66435
|
}
|
66436
|
+
const effectiveCheckType = forNarrowing && isNarrowingSubstitutionType(checkType) ? checkType.constraint : checkType;
|
66020
66437
|
const checkTypeNode = skipTypeParentheses(root.node.checkType);
|
66021
66438
|
const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
|
66022
66439
|
const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
|
66023
|
-
const checkTypeDeferred = isDeferredType(
|
66440
|
+
const checkTypeDeferred = isDeferredType(effectiveCheckType, checkTuples);
|
66024
66441
|
let combinedMapper;
|
66025
66442
|
if (root.inferTypeParameters) {
|
66026
66443
|
const context = createInferenceContext(
|
@@ -66039,8 +66456,8 @@ function createTypeChecker(host) {
|
|
66039
66456
|
}
|
66040
66457
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
66041
66458
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
66042
|
-
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (
|
66043
|
-
if (
|
66459
|
+
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (effectiveCheckType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(effectiveCheckType), getPermissiveInstantiation(inferredExtendsType)))) {
|
66460
|
+
if (effectiveCheckType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(effectiveCheckType)))) {
|
66044
66461
|
(extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
|
66045
66462
|
}
|
66046
66463
|
const falseType2 = getTypeFromTypeNode(root.node.falseType);
|
@@ -66057,7 +66474,7 @@ function createTypeChecker(host) {
|
|
66057
66474
|
result = instantiateType(falseType2, mapper);
|
66058
66475
|
break;
|
66059
66476
|
}
|
66060
|
-
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(
|
66477
|
+
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(effectiveCheckType), getRestrictiveInstantiation(inferredExtendsType))) {
|
66061
66478
|
const trueType2 = getTypeFromTypeNode(root.node.trueType);
|
66062
66479
|
const trueMapper = combinedMapper || mapper;
|
66063
66480
|
if (canTailRecurse(trueType2, trueMapper)) {
|
@@ -66412,7 +66829,7 @@ function createTypeChecker(host) {
|
|
66412
66829
|
return result;
|
66413
66830
|
}
|
66414
66831
|
function getIndexInfoWithReadonly(info, readonly) {
|
66415
|
-
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
|
66832
|
+
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration, info.components) : info;
|
66416
66833
|
}
|
66417
66834
|
function createLiteralType(flags, value, symbol, regularType) {
|
66418
66835
|
const type = createTypeWithSymbol(flags, symbol);
|
@@ -67023,8 +67440,39 @@ function createTypeChecker(host) {
|
|
67023
67440
|
if (!result) {
|
67024
67441
|
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
|
67025
67442
|
const checkType = root.checkType;
|
67026
|
-
|
67027
|
-
|
67443
|
+
let distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
|
67444
|
+
let narrowingBaseType;
|
67445
|
+
const forNarrowing = distributionType && isNarrowingSubstitutionType(distributionType) && isNarrowableConditionalType(type, mapper);
|
67446
|
+
if (forNarrowing) {
|
67447
|
+
narrowingBaseType = distributionType.baseType;
|
67448
|
+
distributionType = getReducedType(distributionType.constraint);
|
67449
|
+
}
|
67450
|
+
if (distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */)) {
|
67451
|
+
if (narrowingBaseType) {
|
67452
|
+
result = mapTypeToIntersection(
|
67453
|
+
distributionType,
|
67454
|
+
(t) => getConditionalType(
|
67455
|
+
root,
|
67456
|
+
prependTypeMapping(checkType, getSubstitutionType(
|
67457
|
+
narrowingBaseType,
|
67458
|
+
t,
|
67459
|
+
/*isNarrowed*/
|
67460
|
+
true
|
67461
|
+
), newMapper),
|
67462
|
+
forConstraint,
|
67463
|
+
/*aliasSymbol*/
|
67464
|
+
void 0,
|
67465
|
+
/*aliasTypeArguments*/
|
67466
|
+
void 0,
|
67467
|
+
forNarrowing
|
67468
|
+
)
|
67469
|
+
);
|
67470
|
+
} else {
|
67471
|
+
result = mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments);
|
67472
|
+
}
|
67473
|
+
} else {
|
67474
|
+
result = getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing);
|
67475
|
+
}
|
67028
67476
|
root.instantiations.set(id, result);
|
67029
67477
|
}
|
67030
67478
|
return result;
|
@@ -67171,7 +67619,7 @@ function createTypeChecker(host) {
|
|
67171
67619
|
return type.restrictiveInstantiation;
|
67172
67620
|
}
|
67173
67621
|
function instantiateIndexInfo(info, mapper) {
|
67174
|
-
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
|
67622
|
+
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration, info.components);
|
67175
67623
|
}
|
67176
67624
|
function isContextSensitive(node) {
|
67177
67625
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
@@ -68167,10 +68615,12 @@ function createTypeChecker(host) {
|
|
68167
68615
|
function shouldNormalizeIntersection(type) {
|
68168
68616
|
let hasInstantiable = false;
|
68169
68617
|
let hasNullableOrEmpty = false;
|
68618
|
+
let hasSubstitution = false;
|
68170
68619
|
for (const t of type.types) {
|
68171
68620
|
hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
|
68172
68621
|
hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
|
68173
|
-
|
68622
|
+
hasSubstitution || (hasSubstitution = isNarrowingSubstitutionType(t));
|
68623
|
+
if (hasInstantiable && hasNullableOrEmpty || hasSubstitution) return true;
|
68174
68624
|
}
|
68175
68625
|
return false;
|
68176
68626
|
}
|
@@ -71302,7 +71752,7 @@ function createTypeChecker(host) {
|
|
71302
71752
|
}
|
71303
71753
|
}
|
71304
71754
|
}
|
71305
|
-
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
|
71755
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly, info.declaration, info.components)));
|
71306
71756
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
71307
71757
|
return result;
|
71308
71758
|
}
|
@@ -72744,6 +73194,7 @@ function createTypeChecker(host) {
|
|
72744
73194
|
return target.kind === 108 /* SuperKeyword */;
|
72745
73195
|
case 235 /* NonNullExpression */:
|
72746
73196
|
case 217 /* ParenthesizedExpression */:
|
73197
|
+
case 238 /* SatisfiesExpression */:
|
72747
73198
|
return isMatchingReference(source.expression, target);
|
72748
73199
|
case 211 /* PropertyAccessExpression */:
|
72749
73200
|
case 212 /* ElementAccessExpression */:
|
@@ -73329,6 +73780,18 @@ function createTypeChecker(host) {
|
|
73329
73780
|
}
|
73330
73781
|
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
|
73331
73782
|
}
|
73783
|
+
function mapTypeToIntersection(type, mapper) {
|
73784
|
+
if (type.flags & 131072 /* Never */) {
|
73785
|
+
return type;
|
73786
|
+
}
|
73787
|
+
if (!(type.flags & 1048576 /* Union */)) {
|
73788
|
+
return mapper(type);
|
73789
|
+
}
|
73790
|
+
const origin = type.origin;
|
73791
|
+
const types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
73792
|
+
const mappedTypes = types.map((t) => t.flags & 1048576 /* Union */ ? mapTypeToIntersection(t, mapper) : mapper(t));
|
73793
|
+
return getIntersectionType(mappedTypes);
|
73794
|
+
}
|
73332
73795
|
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
73333
73796
|
return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper);
|
73334
73797
|
}
|
@@ -74594,6 +75057,7 @@ function createTypeChecker(host) {
|
|
74594
75057
|
if (checkDerived) {
|
74595
75058
|
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
74596
75059
|
}
|
75060
|
+
type = type.flags & 2 /* Unknown */ ? unknownUnionType : type;
|
74597
75061
|
const trueType2 = getNarrowedType(
|
74598
75062
|
type,
|
74599
75063
|
candidate,
|
@@ -74602,7 +75066,7 @@ function createTypeChecker(host) {
|
|
74602
75066
|
/*checkDerived*/
|
74603
75067
|
false
|
74604
75068
|
);
|
74605
|
-
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
75069
|
+
return recombineUnknownType(filterType(type, (t) => !isTypeSubsetOf(t, trueType2)));
|
74606
75070
|
}
|
74607
75071
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
74608
75072
|
return candidate;
|
@@ -74700,6 +75164,7 @@ function createTypeChecker(host) {
|
|
74700
75164
|
return narrowTypeByCallExpression(type, expr, assumeTrue);
|
74701
75165
|
case 217 /* ParenthesizedExpression */:
|
74702
75166
|
case 235 /* NonNullExpression */:
|
75167
|
+
case 238 /* SatisfiesExpression */:
|
74703
75168
|
return narrowType(type, expr.expression, assumeTrue);
|
74704
75169
|
case 226 /* BinaryExpression */:
|
74705
75170
|
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
|
@@ -74911,11 +75376,11 @@ function createTypeChecker(host) {
|
|
74911
75376
|
));
|
74912
75377
|
return contextualType && !isGenericType(contextualType);
|
74913
75378
|
}
|
74914
|
-
function getNarrowableTypeForReference(type, reference, checkMode) {
|
75379
|
+
function getNarrowableTypeForReference(type, reference, checkMode, forReturnTypeNarrowing) {
|
74915
75380
|
if (isNoInferType(type)) {
|
74916
75381
|
type = type.baseType;
|
74917
75382
|
}
|
74918
|
-
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
75383
|
+
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (forReturnTypeNarrowing || isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
74919
75384
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
74920
75385
|
}
|
74921
75386
|
function isExportOrExportExpression(location) {
|
@@ -75063,12 +75528,13 @@ function createTypeChecker(host) {
|
|
75063
75528
|
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found : void 0;
|
75064
75529
|
const jsxFactoryNamespace = getJsxNamespace(node);
|
75065
75530
|
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
75531
|
+
const shouldFactoryRefErr = compilerOptions.jsx !== 1 /* Preserve */ && compilerOptions.jsx !== 3 /* ReactNative */;
|
75066
75532
|
let jsxFactorySym;
|
75067
75533
|
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
75068
75534
|
jsxFactorySym = resolveName(
|
75069
75535
|
jsxFactoryLocation,
|
75070
75536
|
jsxFactoryNamespace,
|
75071
|
-
|
75537
|
+
shouldFactoryRefErr ? 111551 /* Value */ : 111551 /* Value */ & ~384 /* Enum */,
|
75072
75538
|
jsxFactoryRefErr,
|
75073
75539
|
/*isUse*/
|
75074
75540
|
true
|
@@ -75082,12 +75548,13 @@ function createTypeChecker(host) {
|
|
75082
75548
|
}
|
75083
75549
|
if (isJsxOpeningFragment(node)) {
|
75084
75550
|
const file = getSourceFileOfNode(node);
|
75085
|
-
const
|
75086
|
-
if (
|
75551
|
+
const entity = getJsxFactoryEntity(file);
|
75552
|
+
if (entity) {
|
75553
|
+
const localJsxNamespace = getFirstIdentifier(entity).escapedText;
|
75087
75554
|
resolveName(
|
75088
75555
|
jsxFactoryLocation,
|
75089
75556
|
localJsxNamespace,
|
75090
|
-
|
75557
|
+
shouldFactoryRefErr ? 111551 /* Value */ : 111551 /* Value */ & ~384 /* Enum */,
|
75091
75558
|
jsxFactoryRefErr,
|
75092
75559
|
/*isUse*/
|
75093
75560
|
true
|
@@ -76040,9 +76507,16 @@ function createTypeChecker(host) {
|
|
76040
76507
|
function getContextualTypeForReturnExpression(node, contextFlags) {
|
76041
76508
|
const func = getContainingFunction(node);
|
76042
76509
|
if (func) {
|
76510
|
+
const functionFlags = getFunctionFlags(func);
|
76511
|
+
const links = getNodeLinks(node);
|
76512
|
+
if (links.contextualReturnType) {
|
76513
|
+
if (functionFlags & 2 /* Async */) {
|
76514
|
+
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
76515
|
+
}
|
76516
|
+
return links.contextualReturnType;
|
76517
|
+
}
|
76043
76518
|
let contextualReturnType = getContextualReturnType(func, contextFlags);
|
76044
76519
|
if (contextualReturnType) {
|
76045
|
-
const functionFlags = getFunctionFlags(func);
|
76046
76520
|
if (functionFlags & 1 /* Generator */) {
|
76047
76521
|
const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0;
|
76048
76522
|
if (contextualReturnType.flags & 1048576 /* Union */) {
|
@@ -76740,6 +77214,13 @@ function createTypeChecker(host) {
|
|
76740
77214
|
if (index >= 0) {
|
76741
77215
|
return contextualTypes[index];
|
76742
77216
|
}
|
77217
|
+
const links = getNodeLinks(node);
|
77218
|
+
if (links.contextualReturnType) {
|
77219
|
+
if (node.flags & 65536 /* AwaitContext */) {
|
77220
|
+
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
77221
|
+
}
|
77222
|
+
return links.contextualReturnType;
|
77223
|
+
}
|
76743
77224
|
const { parent: parent2 } = node;
|
76744
77225
|
switch (parent2.kind) {
|
76745
77226
|
case 260 /* VariableDeclaration */:
|
@@ -77321,16 +77802,33 @@ function createTypeChecker(host) {
|
|
77321
77802
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
77322
77803
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
77323
77804
|
}
|
77805
|
+
function isSymbolWithComputedName(symbol) {
|
77806
|
+
var _a;
|
77807
|
+
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
77808
|
+
return firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name);
|
77809
|
+
}
|
77324
77810
|
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
77811
|
+
var _a;
|
77325
77812
|
const propTypes = [];
|
77813
|
+
let components;
|
77326
77814
|
for (let i = offset; i < properties.length; i++) {
|
77327
77815
|
const prop = properties[i];
|
77328
77816
|
if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
|
77329
77817
|
propTypes.push(getTypeOfSymbol(properties[i]));
|
77818
|
+
if (isSymbolWithComputedName(properties[i])) {
|
77819
|
+
components = append(components, (_a = properties[i].declarations) == null ? void 0 : _a[0]);
|
77820
|
+
}
|
77330
77821
|
}
|
77331
77822
|
}
|
77332
77823
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
77333
|
-
return createIndexInfo(
|
77824
|
+
return createIndexInfo(
|
77825
|
+
keyType,
|
77826
|
+
unionType,
|
77827
|
+
isReadonly,
|
77828
|
+
/*declaration*/
|
77829
|
+
void 0,
|
77830
|
+
components
|
77831
|
+
);
|
77334
77832
|
}
|
77335
77833
|
function getImmediateAliasedSymbol(symbol) {
|
77336
77834
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
@@ -77865,6 +78363,9 @@ function createTypeChecker(host) {
|
|
77865
78363
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
|
77866
78364
|
}
|
77867
78365
|
function getJsxElementChildrenPropertyName(jsxNamespace) {
|
78366
|
+
if (compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
78367
|
+
return "children";
|
78368
|
+
}
|
77868
78369
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
|
77869
78370
|
}
|
77870
78371
|
function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
|
@@ -78648,6 +79149,13 @@ function createTypeChecker(host) {
|
|
78648
79149
|
return getIntersectionType(x);
|
78649
79150
|
}
|
78650
79151
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
79152
|
+
const links = getNodeLinks(propNode);
|
79153
|
+
const cache = links.nonExistentPropCheckCache || (links.nonExistentPropCheckCache = /* @__PURE__ */ new Set());
|
79154
|
+
const key = `${getTypeId(containingType)}|${isUncheckedJS}`;
|
79155
|
+
if (cache.has(key)) {
|
79156
|
+
return;
|
79157
|
+
}
|
79158
|
+
cache.add(key);
|
78651
79159
|
let errorInfo;
|
78652
79160
|
let relatedInfo;
|
78653
79161
|
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 402784252 /* Primitive */)) {
|
@@ -79416,8 +79924,8 @@ function createTypeChecker(host) {
|
|
79416
79924
|
}
|
79417
79925
|
}
|
79418
79926
|
function getEffectiveCheckNode(argument) {
|
79419
|
-
|
79420
|
-
return
|
79927
|
+
const flags = isInJSFile(argument) ? 1 /* Parentheses */ | 32 /* Satisfies */ | -2147483648 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */ | 32 /* Satisfies */;
|
79928
|
+
return skipOuterExpressions(argument, flags);
|
79421
79929
|
}
|
79422
79930
|
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
|
79423
79931
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
@@ -79842,11 +80350,16 @@ function createTypeChecker(host) {
|
|
79842
80350
|
if (!result) {
|
79843
80351
|
result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
79844
80352
|
}
|
80353
|
+
const links = getNodeLinks(node);
|
80354
|
+
if (links.resolvedSignature !== resolvingSignature && !candidatesOutArray) {
|
80355
|
+
Debug.assert(links.resolvedSignature);
|
80356
|
+
return links.resolvedSignature;
|
80357
|
+
}
|
79845
80358
|
if (result) {
|
79846
80359
|
return result;
|
79847
80360
|
}
|
79848
80361
|
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
79849
|
-
|
80362
|
+
links.resolvedSignature = result;
|
79850
80363
|
if (reportErrors2) {
|
79851
80364
|
if (!headMessage && isInstanceof) {
|
79852
80365
|
headMessage = Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method;
|
@@ -80606,12 +81119,14 @@ function createTypeChecker(host) {
|
|
80606
81119
|
const sourceFileLinks = getNodeLinks(getSourceFileOfNode(node));
|
80607
81120
|
if (sourceFileLinks.jsxFragmentType !== void 0) return sourceFileLinks.jsxFragmentType;
|
80608
81121
|
const jsxFragmentFactoryName = getJsxNamespace(node);
|
80609
|
-
|
81122
|
+
const shouldResolveFactoryReference = (compilerOptions.jsx === 2 /* React */ || compilerOptions.jsxFragmentFactory !== void 0) && jsxFragmentFactoryName !== "null";
|
81123
|
+
if (!shouldResolveFactoryReference) return sourceFileLinks.jsxFragmentType = anyType;
|
81124
|
+
const shouldModuleRefErr = compilerOptions.jsx !== 1 /* Preserve */ && compilerOptions.jsx !== 3 /* ReactNative */;
|
80610
81125
|
const jsxFactoryRefErr = diagnostics ? Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found : void 0;
|
80611
81126
|
const jsxFactorySymbol = getJsxNamespaceContainerForImplicitImport(node) ?? resolveName(
|
80612
81127
|
node,
|
80613
81128
|
jsxFragmentFactoryName,
|
80614
|
-
|
81129
|
+
shouldModuleRefErr ? 111551 /* Value */ : 111551 /* Value */ & ~384 /* Enum */,
|
80615
81130
|
/*nameNotFoundMessage*/
|
80616
81131
|
jsxFactoryRefErr,
|
80617
81132
|
/*isUse*/
|
@@ -80730,12 +81245,9 @@ function createTypeChecker(host) {
|
|
80730
81245
|
resolutionStart = resolutionTargets.length;
|
80731
81246
|
}
|
80732
81247
|
links.resolvedSignature = resolvingSignature;
|
80733
|
-
|
81248
|
+
const result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
|
80734
81249
|
resolutionStart = saveResolutionStart;
|
80735
81250
|
if (result !== resolvingSignature) {
|
80736
|
-
if (links.resolvedSignature !== resolvingSignature) {
|
80737
|
-
result = links.resolvedSignature;
|
80738
|
-
}
|
80739
81251
|
links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
|
80740
81252
|
}
|
80741
81253
|
return result;
|
@@ -81314,12 +81826,12 @@ function createTypeChecker(host) {
|
|
81314
81826
|
}
|
81315
81827
|
}
|
81316
81828
|
function checkImportMetaProperty(node) {
|
81317
|
-
if (
|
81829
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
81318
81830
|
if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
|
81319
81831
|
error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
81320
81832
|
}
|
81321
81833
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
81322
|
-
error2(node, Diagnostics.
|
81834
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_or_nodenext);
|
81323
81835
|
}
|
81324
81836
|
const file = getSourceFileOfNode(node);
|
81325
81837
|
Debug.assert(!!(file.flags & 8388608 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
@@ -82148,7 +82660,7 @@ function createTypeChecker(host) {
|
|
82148
82660
|
}
|
82149
82661
|
return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
82150
82662
|
}
|
82151
|
-
const type = checkExpressionCached(node.expression);
|
82663
|
+
const type = getBaseConstraintOrType(checkExpressionCached(node.expression));
|
82152
82664
|
if (!isLiteralType(type)) {
|
82153
82665
|
return false;
|
82154
82666
|
}
|
@@ -82411,19 +82923,7 @@ function createTypeChecker(host) {
|
|
82411
82923
|
const exprType = checkExpression(node.body);
|
82412
82924
|
const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
|
82413
82925
|
if (returnOrPromisedType) {
|
82414
|
-
|
82415
|
-
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
82416
|
-
const awaitedType = checkAwaitedType(
|
82417
|
-
exprType,
|
82418
|
-
/*withAlias*/
|
82419
|
-
false,
|
82420
|
-
effectiveCheckNode,
|
82421
|
-
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
82422
|
-
);
|
82423
|
-
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
82424
|
-
} else {
|
82425
|
-
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
82426
|
-
}
|
82926
|
+
checkReturnExpression(node, returnOrPromisedType, node.body, node.body, exprType);
|
82427
82927
|
}
|
82428
82928
|
}
|
82429
82929
|
}
|
@@ -82477,7 +82977,7 @@ function createTypeChecker(host) {
|
|
82477
82977
|
}
|
82478
82978
|
if (isReadonlySymbol(symbol)) {
|
82479
82979
|
if (symbol.flags & 4 /* Property */ && isAccessExpression(expr) && expr.expression.kind === 110 /* ThisKeyword */) {
|
82480
|
-
const ctor =
|
82980
|
+
const ctor = getControlFlowContainer(expr);
|
82481
82981
|
if (!(ctor && (ctor.kind === 176 /* Constructor */ || isJSConstructor(ctor)))) {
|
82482
82982
|
return true;
|
82483
82983
|
}
|
@@ -82506,7 +83006,7 @@ function createTypeChecker(host) {
|
|
82506
83006
|
return false;
|
82507
83007
|
}
|
82508
83008
|
function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
|
82509
|
-
const node = skipOuterExpressions(expr,
|
83009
|
+
const node = skipOuterExpressions(expr, 38 /* Assertions */ | 1 /* Parentheses */);
|
82510
83010
|
if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
|
82511
83011
|
error2(expr, invalidReferenceMessage);
|
82512
83012
|
return false;
|
@@ -82573,6 +83073,7 @@ function createTypeChecker(host) {
|
|
82573
83073
|
}
|
82574
83074
|
switch (moduleKind) {
|
82575
83075
|
case 100 /* Node16 */:
|
83076
|
+
case 101 /* Node18 */:
|
82576
83077
|
case 199 /* NodeNext */:
|
82577
83078
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
82578
83079
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
@@ -82593,7 +83094,7 @@ function createTypeChecker(host) {
|
|
82593
83094
|
// fallthrough
|
82594
83095
|
default:
|
82595
83096
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
82596
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
83097
|
+
const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
|
82597
83098
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
82598
83099
|
hasError = true;
|
82599
83100
|
break;
|
@@ -83157,7 +83658,7 @@ function createTypeChecker(host) {
|
|
83157
83658
|
if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
83158
83659
|
grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
|
83159
83660
|
}
|
83160
|
-
const leftTarget = skipOuterExpressions(left,
|
83661
|
+
const leftTarget = skipOuterExpressions(left, 63 /* All */);
|
83161
83662
|
const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
|
83162
83663
|
if (nullishSemantics !== 3 /* Sometimes */) {
|
83163
83664
|
if (node.parent.kind === 226 /* BinaryExpression */) {
|
@@ -83177,7 +83678,9 @@ function createTypeChecker(host) {
|
|
83177
83678
|
switch (node.kind) {
|
83178
83679
|
case 223 /* AwaitExpression */:
|
83179
83680
|
case 213 /* CallExpression */:
|
83681
|
+
case 215 /* TaggedTemplateExpression */:
|
83180
83682
|
case 212 /* ElementAccessExpression */:
|
83683
|
+
case 236 /* MetaProperty */:
|
83181
83684
|
case 214 /* NewExpression */:
|
83182
83685
|
case 211 /* PropertyAccessExpression */:
|
83183
83686
|
case 229 /* YieldExpression */:
|
@@ -83193,6 +83696,8 @@ function createTypeChecker(host) {
|
|
83193
83696
|
case 56 /* AmpersandAmpersandToken */:
|
83194
83697
|
case 77 /* AmpersandAmpersandEqualsToken */:
|
83195
83698
|
return 3 /* Sometimes */;
|
83699
|
+
case 28 /* CommaToken */:
|
83700
|
+
return getSyntacticNullishnessSemantics(node.right);
|
83196
83701
|
}
|
83197
83702
|
return 2 /* Never */;
|
83198
83703
|
case 227 /* ConditionalExpression */:
|
@@ -84372,6 +84877,9 @@ function createTypeChecker(host) {
|
|
84372
84877
|
checkVariableLikeDeclaration(node);
|
84373
84878
|
const func = getContainingFunction(node);
|
84374
84879
|
if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
84880
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
84881
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
84882
|
+
}
|
84375
84883
|
if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
|
84376
84884
|
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
84377
84885
|
}
|
@@ -87645,7 +88153,6 @@ function createTypeChecker(host) {
|
|
87645
88153
|
}
|
87646
88154
|
const signature = getSignatureFromDeclaration(container);
|
87647
88155
|
const returnType = getReturnTypeOfSignature(signature);
|
87648
|
-
const functionFlags = getFunctionFlags(container);
|
87649
88156
|
if (strictNullChecks || node.expression || returnType.flags & 131072 /* Never */) {
|
87650
88157
|
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
87651
88158
|
if (container.kind === 178 /* SetAccessor */) {
|
@@ -87653,26 +88160,249 @@ function createTypeChecker(host) {
|
|
87653
88160
|
error2(node, Diagnostics.Setters_cannot_return_a_value);
|
87654
88161
|
}
|
87655
88162
|
} else if (container.kind === 176 /* Constructor */) {
|
87656
|
-
|
88163
|
+
const exprType2 = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
88164
|
+
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType2, returnType, node, node.expression)) {
|
87657
88165
|
error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
87658
88166
|
}
|
87659
88167
|
} else if (getReturnTypeFromAnnotation(container)) {
|
87660
|
-
const unwrappedReturnType = unwrapReturnType(returnType,
|
87661
|
-
|
87662
|
-
exprType,
|
87663
|
-
/*withAlias*/
|
87664
|
-
false,
|
87665
|
-
node,
|
87666
|
-
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
87667
|
-
) : exprType;
|
87668
|
-
if (unwrappedReturnType) {
|
87669
|
-
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression);
|
87670
|
-
}
|
88168
|
+
const unwrappedReturnType = unwrapReturnType(returnType, getFunctionFlags(container)) ?? returnType;
|
88169
|
+
checkReturnExpression(container, unwrappedReturnType, node, node.expression, exprType);
|
87671
88170
|
}
|
87672
88171
|
} else if (container.kind !== 176 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
87673
88172
|
error2(node, Diagnostics.Not_all_code_paths_return_a_value);
|
87674
88173
|
}
|
87675
88174
|
}
|
88175
|
+
function checkReturnExpression(container, unwrappedReturnType, node, expr, exprType, inConditionalExpression = false) {
|
88176
|
+
const excludeJSDocTypeAssertions = isInJSFile(node);
|
88177
|
+
const functionFlags = getFunctionFlags(container);
|
88178
|
+
if (expr) {
|
88179
|
+
const unwrappedExpr = skipParentheses(expr, excludeJSDocTypeAssertions);
|
88180
|
+
if (isConditionalExpression(unwrappedExpr)) {
|
88181
|
+
checkReturnExpression(
|
88182
|
+
container,
|
88183
|
+
unwrappedReturnType,
|
88184
|
+
node,
|
88185
|
+
unwrappedExpr.whenTrue,
|
88186
|
+
checkExpression(unwrappedExpr.whenTrue),
|
88187
|
+
/*inConditionalExpression*/
|
88188
|
+
true
|
88189
|
+
);
|
88190
|
+
checkReturnExpression(
|
88191
|
+
container,
|
88192
|
+
unwrappedReturnType,
|
88193
|
+
node,
|
88194
|
+
unwrappedExpr.whenFalse,
|
88195
|
+
checkExpression(unwrappedExpr.whenFalse),
|
88196
|
+
/*inConditionalExpression*/
|
88197
|
+
true
|
88198
|
+
);
|
88199
|
+
return;
|
88200
|
+
}
|
88201
|
+
}
|
88202
|
+
const inReturnStatement = node.kind === 253 /* ReturnStatement */;
|
88203
|
+
const unwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
88204
|
+
exprType,
|
88205
|
+
/*withAlias*/
|
88206
|
+
false,
|
88207
|
+
node,
|
88208
|
+
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
88209
|
+
) : exprType;
|
88210
|
+
const effectiveExpr = expr && getEffectiveCheckNode(expr);
|
88211
|
+
const errorNode = inReturnStatement && !inConditionalExpression ? node : effectiveExpr;
|
88212
|
+
if (!(unwrappedReturnType.flags & (8388608 /* IndexedAccess */ | 16777216 /* Conditional */)) || !couldContainTypeVariables(unwrappedReturnType)) {
|
88213
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
88214
|
+
return;
|
88215
|
+
}
|
88216
|
+
if (checkTypeAssignableTo(
|
88217
|
+
unwrappedExprType,
|
88218
|
+
unwrappedReturnType,
|
88219
|
+
/*errorNode*/
|
88220
|
+
void 0
|
88221
|
+
)) {
|
88222
|
+
return;
|
88223
|
+
}
|
88224
|
+
let narrowPosition = node;
|
88225
|
+
let narrowFlowNode = inReturnStatement && node.flowNode;
|
88226
|
+
if (expr && isConditionalExpression(expr.parent)) {
|
88227
|
+
narrowFlowNode = expr.parent.whenTrue === expr ? expr.parent.flowNodeWhenTrue : expr.parent.flowNodeWhenFalse;
|
88228
|
+
narrowPosition = expr;
|
88229
|
+
}
|
88230
|
+
if (!narrowFlowNode) {
|
88231
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
88232
|
+
return;
|
88233
|
+
}
|
88234
|
+
const allTypeParameters = appendTypeParameters(getOuterTypeParameters(
|
88235
|
+
container,
|
88236
|
+
/*includeThisTypes*/
|
88237
|
+
false
|
88238
|
+
), getEffectiveTypeParameterDeclarations(container));
|
88239
|
+
const narrowableTypeParameters = allTypeParameters && getNarrowableTypeParameters(allTypeParameters);
|
88240
|
+
if (!narrowableTypeParameters || !narrowableTypeParameters.length || !isNarrowableReturnType(unwrappedReturnType)) {
|
88241
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
88242
|
+
return;
|
88243
|
+
}
|
88244
|
+
const narrowedTypeParameters = [];
|
88245
|
+
const narrowedTypes = [];
|
88246
|
+
for (const [typeParam, symbol, reference] of narrowableTypeParameters) {
|
88247
|
+
const narrowReference = factory.cloneNode(reference);
|
88248
|
+
narrowReference.id = void 0;
|
88249
|
+
getNodeLinks(narrowReference).resolvedSymbol = symbol;
|
88250
|
+
setParent(narrowReference, narrowPosition.parent);
|
88251
|
+
narrowReference.flowNode = narrowFlowNode;
|
88252
|
+
const initialType = getNarrowableTypeForReference(
|
88253
|
+
typeParam,
|
88254
|
+
narrowReference,
|
88255
|
+
/*checkMode*/
|
88256
|
+
void 0,
|
88257
|
+
/*forReturnTypeNarrowing*/
|
88258
|
+
true
|
88259
|
+
);
|
88260
|
+
if (initialType === typeParam) {
|
88261
|
+
continue;
|
88262
|
+
}
|
88263
|
+
const flowType = getFlowTypeOfReference(narrowReference, initialType);
|
88264
|
+
const exprType2 = getTypeFromFlowType(flowType);
|
88265
|
+
if (exprType2.flags & 3 /* AnyOrUnknown */ || isErrorType(exprType2) || exprType2 === typeParam || exprType2 === mapType(typeParam, getBaseConstraintOrType)) {
|
88266
|
+
continue;
|
88267
|
+
}
|
88268
|
+
const narrowedType = getSubstitutionType(
|
88269
|
+
typeParam,
|
88270
|
+
exprType2,
|
88271
|
+
/*isNarrowed*/
|
88272
|
+
true
|
88273
|
+
);
|
88274
|
+
narrowedTypeParameters.push(typeParam);
|
88275
|
+
narrowedTypes.push(narrowedType);
|
88276
|
+
}
|
88277
|
+
const narrowMapper = createTypeMapper(narrowedTypeParameters, narrowedTypes);
|
88278
|
+
const narrowedReturnType = instantiateType(
|
88279
|
+
unwrappedReturnType,
|
88280
|
+
narrowMapper
|
88281
|
+
);
|
88282
|
+
if (expr) {
|
88283
|
+
const links = getNodeLinks(expr);
|
88284
|
+
if (!links.contextualReturnType) {
|
88285
|
+
links.contextualReturnType = narrowedReturnType;
|
88286
|
+
}
|
88287
|
+
}
|
88288
|
+
const narrowedExprType = expr ? checkExpression(expr) : undefinedType;
|
88289
|
+
const narrowedUnwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
88290
|
+
narrowedExprType,
|
88291
|
+
/*withAlias*/
|
88292
|
+
false,
|
88293
|
+
node,
|
88294
|
+
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
88295
|
+
) : narrowedExprType;
|
88296
|
+
checkTypeAssignableToAndOptionallyElaborate(narrowedUnwrappedExprType, narrowedReturnType, errorNode, effectiveExpr);
|
88297
|
+
}
|
88298
|
+
function getNarrowableTypeParameters(candidates) {
|
88299
|
+
const narrowableParams = [];
|
88300
|
+
for (const typeParam of candidates) {
|
88301
|
+
const constraint = getConstraintOfTypeParameter(typeParam);
|
88302
|
+
if (!constraint || !(constraint.flags & 1048576 /* Union */)) continue;
|
88303
|
+
if (typeParam.symbol && typeParam.symbol.declarations && typeParam.symbol.declarations.length === 1) {
|
88304
|
+
const declaration = typeParam.symbol.declarations[0];
|
88305
|
+
const container = isJSDocTemplateTag(declaration.parent) ? getJSDocHost(declaration.parent) : declaration.parent;
|
88306
|
+
if (!isFunctionLike(container)) continue;
|
88307
|
+
let reference;
|
88308
|
+
let hasInvalidReference = false;
|
88309
|
+
for (const paramDecl of container.parameters) {
|
88310
|
+
const typeNode = getEffectiveTypeAnnotationNode(paramDecl);
|
88311
|
+
if (!typeNode) continue;
|
88312
|
+
if (isTypeParameterReferenced(typeParam, typeNode)) {
|
88313
|
+
let candidateReference;
|
88314
|
+
if (isTypeReferenceNode(typeNode) && isReferenceToTypeParameter(typeParam, typeNode) && (candidateReference = getValidParameterReference(paramDecl, constraint))) {
|
88315
|
+
if (reference) {
|
88316
|
+
hasInvalidReference = true;
|
88317
|
+
break;
|
88318
|
+
}
|
88319
|
+
reference = candidateReference;
|
88320
|
+
} else {
|
88321
|
+
hasInvalidReference = true;
|
88322
|
+
break;
|
88323
|
+
}
|
88324
|
+
}
|
88325
|
+
}
|
88326
|
+
if (!hasInvalidReference && reference) {
|
88327
|
+
const symbol = getResolvedSymbol(reference);
|
88328
|
+
if (symbol !== unknownSymbol) narrowableParams.push([typeParam, symbol, reference]);
|
88329
|
+
}
|
88330
|
+
}
|
88331
|
+
}
|
88332
|
+
return narrowableParams;
|
88333
|
+
function getValidParameterReference(paramDecl, constraint) {
|
88334
|
+
if (!isIdentifier(paramDecl.name)) return;
|
88335
|
+
const isOptional = !!paramDecl.questionToken || isJSDocOptionalParameter(paramDecl);
|
88336
|
+
if (isOptional && !containsUndefinedType(constraint)) return;
|
88337
|
+
return paramDecl.name;
|
88338
|
+
}
|
88339
|
+
function isReferenceToTypeParameter(typeParam, node) {
|
88340
|
+
return getTypeFromTypeReference(node) === typeParam;
|
88341
|
+
}
|
88342
|
+
function isTypeParameterReferenced(typeParam, node) {
|
88343
|
+
return isReferenced(node);
|
88344
|
+
function isReferenced(node2) {
|
88345
|
+
if (isTypeReferenceNode(node2)) {
|
88346
|
+
return isReferenceToTypeParameter(typeParam, node2);
|
88347
|
+
}
|
88348
|
+
if (isTypeQueryNode(node2)) {
|
88349
|
+
return isTypeParameterPossiblyReferenced(typeParam, node2);
|
88350
|
+
}
|
88351
|
+
return !!forEachChild(node2, isReferenced);
|
88352
|
+
}
|
88353
|
+
}
|
88354
|
+
}
|
88355
|
+
function isNarrowableReturnType(returnType) {
|
88356
|
+
return isConditionalType(returnType) ? isNarrowableConditionalType(returnType) : !!(returnType.indexType.flags & 262144 /* TypeParameter */);
|
88357
|
+
}
|
88358
|
+
function isNarrowableConditionalType(type, mapper) {
|
88359
|
+
const typeArguments = mapper && map(type.root.outerTypeParameters, (t) => {
|
88360
|
+
const mapped = getMappedType(t, mapper);
|
88361
|
+
if (isNarrowingSubstitutionType(mapped)) {
|
88362
|
+
return mapped.baseType;
|
88363
|
+
}
|
88364
|
+
return mapped;
|
88365
|
+
});
|
88366
|
+
const id = `${type.id}:${getTypeListId(typeArguments)}`;
|
88367
|
+
let result = narrowableReturnTypeCache.get(id);
|
88368
|
+
if (result === void 0) {
|
88369
|
+
const nonNarrowingMapper = type.root.outerTypeParameters && typeArguments && createTypeMapper(type.root.outerTypeParameters, typeArguments);
|
88370
|
+
const instantiatedType = instantiateType(type, nonNarrowingMapper);
|
88371
|
+
result = isConditionalType(instantiatedType) && isNarrowableConditionalTypeWorker(instantiatedType);
|
88372
|
+
narrowableReturnTypeCache.set(id, result);
|
88373
|
+
}
|
88374
|
+
return result;
|
88375
|
+
}
|
88376
|
+
function isNarrowableConditionalTypeWorker(type) {
|
88377
|
+
if (!type.root.isDistributive) {
|
88378
|
+
return false;
|
88379
|
+
}
|
88380
|
+
if (type.root.inferTypeParameters) {
|
88381
|
+
return false;
|
88382
|
+
}
|
88383
|
+
if (!(type.checkType.flags & 262144 /* TypeParameter */)) {
|
88384
|
+
return false;
|
88385
|
+
}
|
88386
|
+
const constraintType = getConstraintOfTypeParameter(type.checkType);
|
88387
|
+
if (!constraintType || !(constraintType.flags & 1048576 /* Union */)) {
|
88388
|
+
return false;
|
88389
|
+
}
|
88390
|
+
if (!everyType(type.extendsType, (extendsType) => some(
|
88391
|
+
constraintType.types,
|
88392
|
+
(constraintType2) => isTypeIdenticalTo(constraintType2, extendsType)
|
88393
|
+
))) {
|
88394
|
+
return false;
|
88395
|
+
}
|
88396
|
+
const trueType2 = getTrueTypeFromConditionalType(type);
|
88397
|
+
const isValidTrueType = isConditionalType(trueType2) ? isNarrowableConditionalType(trueType2) : true;
|
88398
|
+
if (!isValidTrueType) return false;
|
88399
|
+
const falseType2 = getFalseTypeFromConditionalType(type);
|
88400
|
+
const isValidFalseType = isConditionalType(falseType2) ? isNarrowableConditionalType(falseType2) : falseType2 === neverType;
|
88401
|
+
return isValidFalseType;
|
88402
|
+
}
|
88403
|
+
function isConditionalType(type) {
|
88404
|
+
return !!(type.flags & 16777216 /* Conditional */);
|
88405
|
+
}
|
87676
88406
|
function checkWithStatement(node) {
|
87677
88407
|
if (!checkGrammarStatementInAmbientContext(node)) {
|
87678
88408
|
if (node.flags & 65536 /* AwaitContext */) {
|
@@ -87804,7 +88534,7 @@ function createTypeChecker(host) {
|
|
87804
88534
|
const typeDeclaration = symbol.valueDeclaration;
|
87805
88535
|
if (typeDeclaration && isClassLike(typeDeclaration)) {
|
87806
88536
|
for (const member of typeDeclaration.members) {
|
87807
|
-
if (!isStatic(member) && !hasBindableName(member)) {
|
88537
|
+
if ((!isStaticIndex && !isStatic(member) || isStaticIndex && isStatic(member)) && !hasBindableName(member)) {
|
87808
88538
|
const symbol2 = getSymbolOfDeclaration(member);
|
87809
88539
|
checkIndexConstraintForProperty(type, symbol2, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol2));
|
87810
88540
|
}
|
@@ -88255,6 +88985,13 @@ function createTypeChecker(host) {
|
|
88255
88985
|
function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, member, errorNode) {
|
88256
88986
|
const isJs = isInJSFile(node);
|
88257
88987
|
const nodeInAmbientContext = !!(node.flags & 33554432 /* Ambient */);
|
88988
|
+
if (memberHasOverrideModifier && (member == null ? void 0 : member.valueDeclaration) && isClassElement(member.valueDeclaration) && member.valueDeclaration.name && isNonBindableDynamicName(member.valueDeclaration.name)) {
|
88989
|
+
error2(
|
88990
|
+
errorNode,
|
88991
|
+
isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_name_is_dynamic : Diagnostics.This_member_cannot_have_an_override_modifier_because_its_name_is_dynamic
|
88992
|
+
);
|
88993
|
+
return 2 /* HasInvalidOverride */;
|
88994
|
+
}
|
88258
88995
|
if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
|
88259
88996
|
const thisType = memberIsStatic ? staticType : typeWithThis;
|
88260
88997
|
const baseType = memberIsStatic ? baseStaticType : baseWithThis;
|
@@ -88847,6 +89584,9 @@ function createTypeChecker(host) {
|
|
88847
89584
|
checkCollisionsForDeclarationName(node, node.name);
|
88848
89585
|
checkExportsOnMergedDeclarations(node);
|
88849
89586
|
node.members.forEach(checkEnumMember);
|
89587
|
+
if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
|
89588
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
89589
|
+
}
|
88850
89590
|
computeEnumMemberValues(node);
|
88851
89591
|
const enumSymbol = getSymbolOfDeclaration(node);
|
88852
89592
|
const firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
|
@@ -88948,6 +89688,9 @@ function createTypeChecker(host) {
|
|
88948
89688
|
checkExportsOnMergedDeclarations(node);
|
88949
89689
|
const symbol = getSymbolOfDeclaration(node);
|
88950
89690
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
89691
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
89692
|
+
error2(node.name, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
89693
|
+
}
|
88951
89694
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
88952
89695
|
error2(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName);
|
88953
89696
|
}
|
@@ -89261,10 +90004,20 @@ function createTypeChecker(host) {
|
|
89261
90004
|
if (validForTypeAttributes && override) {
|
89262
90005
|
return;
|
89263
90006
|
}
|
89264
|
-
|
89265
|
-
|
89266
|
-
|
89267
|
-
|
90007
|
+
if (!moduleSupportsImportAttributes(moduleKind)) {
|
90008
|
+
return grammarErrorOnNode(
|
90009
|
+
node,
|
90010
|
+
isImportAttributes2 ? Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve
|
90011
|
+
);
|
90012
|
+
}
|
90013
|
+
if (moduleKind === 199 /* NodeNext */ && !isImportAttributes2) {
|
90014
|
+
return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_asserts);
|
90015
|
+
}
|
90016
|
+
if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === 1 /* CommonJS */) {
|
90017
|
+
return grammarErrorOnNode(
|
90018
|
+
node,
|
90019
|
+
isImportAttributes2 ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls
|
90020
|
+
);
|
89268
90021
|
}
|
89269
90022
|
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly);
|
89270
90023
|
if (isTypeOnly) {
|
@@ -89305,7 +90058,7 @@ function createTypeChecker(host) {
|
|
89305
90058
|
}
|
89306
90059
|
}
|
89307
90060
|
}
|
89308
|
-
if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
90061
|
+
if (!importClause.isTypeOnly && 101 /* Node18 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
89309
90062
|
error2(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]);
|
89310
90063
|
}
|
89311
90064
|
} else if (noUncheckedSideEffectImports && !importClause) {
|
@@ -89325,7 +90078,11 @@ function createTypeChecker(host) {
|
|
89325
90078
|
return;
|
89326
90079
|
}
|
89327
90080
|
checkGrammarModifiers(node);
|
89328
|
-
|
90081
|
+
const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
|
90082
|
+
if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
90083
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
90084
|
+
}
|
90085
|
+
if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
|
89329
90086
|
checkImportBinding(node);
|
89330
90087
|
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
89331
90088
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
@@ -91589,6 +92346,36 @@ function createTypeChecker(host) {
|
|
91589
92346
|
result || (result = []);
|
91590
92347
|
for (const info of infoList) {
|
91591
92348
|
if (info.declaration) continue;
|
92349
|
+
if (info === anyBaseTypeIndexInfo) continue;
|
92350
|
+
if (info.components) {
|
92351
|
+
const allComponentComputedNamesSerializable = every(info.components, (e) => {
|
92352
|
+
var _a;
|
92353
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && enclosing && ((_a = isEntityNameVisible(
|
92354
|
+
e.name.expression,
|
92355
|
+
enclosing,
|
92356
|
+
/*shouldComputeAliasToMakeVisible*/
|
92357
|
+
false
|
92358
|
+
)) == null ? void 0 : _a.accessibility) === 0 /* Accessible */);
|
92359
|
+
});
|
92360
|
+
if (allComponentComputedNamesSerializable) {
|
92361
|
+
const newComponents = filter(info.components, (e) => {
|
92362
|
+
return !hasLateBindableName(e);
|
92363
|
+
});
|
92364
|
+
result.push(...map(newComponents, (e) => {
|
92365
|
+
trackComputedName(e.name.expression);
|
92366
|
+
const mods = infoList === staticInfos ? [factory.createModifier(126 /* StaticKeyword */)] : void 0;
|
92367
|
+
return factory.createPropertyDeclaration(
|
92368
|
+
append(mods, info.isReadonly ? factory.createModifier(148 /* ReadonlyKeyword */) : void 0),
|
92369
|
+
e.name,
|
92370
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
92371
|
+
nodeBuilder.typeToTypeNode(getTypeOfSymbol(e.symbol), enclosing, flags, internalFlags, tracker),
|
92372
|
+
/*initializer*/
|
92373
|
+
void 0
|
92374
|
+
);
|
92375
|
+
}));
|
92376
|
+
continue;
|
92377
|
+
}
|
92378
|
+
}
|
91592
92379
|
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
91593
92380
|
if (node && infoList === staticInfos) {
|
91594
92381
|
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
@@ -91599,6 +92386,22 @@ function createTypeChecker(host) {
|
|
91599
92386
|
}
|
91600
92387
|
}
|
91601
92388
|
return result;
|
92389
|
+
function trackComputedName(accessExpression) {
|
92390
|
+
if (!tracker.trackSymbol) return;
|
92391
|
+
const firstIdentifier = getFirstIdentifier(accessExpression);
|
92392
|
+
const name = resolveName(
|
92393
|
+
firstIdentifier,
|
92394
|
+
firstIdentifier.escapedText,
|
92395
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
92396
|
+
/*nameNotFoundMessage*/
|
92397
|
+
void 0,
|
92398
|
+
/*isUse*/
|
92399
|
+
true
|
92400
|
+
);
|
92401
|
+
if (name) {
|
92402
|
+
tracker.trackSymbol(name, enclosing, 111551 /* Value */);
|
92403
|
+
}
|
92404
|
+
}
|
91602
92405
|
}
|
91603
92406
|
};
|
91604
92407
|
function isImportRequiredByAugmentation(node) {
|
@@ -92680,6 +93483,7 @@ function createTypeChecker(host) {
|
|
92680
93483
|
}
|
92681
93484
|
switch (moduleKind) {
|
92682
93485
|
case 100 /* Node16 */:
|
93486
|
+
case 101 /* Node18 */:
|
92683
93487
|
case 199 /* NodeNext */:
|
92684
93488
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
92685
93489
|
diagnostics.add(
|
@@ -92698,7 +93502,7 @@ function createTypeChecker(host) {
|
|
92698
93502
|
// fallthrough
|
92699
93503
|
default:
|
92700
93504
|
diagnostics.add(
|
92701
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
93505
|
+
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
|
92702
93506
|
);
|
92703
93507
|
break;
|
92704
93508
|
}
|
@@ -92842,7 +93646,7 @@ function createTypeChecker(host) {
|
|
92842
93646
|
}
|
92843
93647
|
}
|
92844
93648
|
function checkGrammarForInvalidDynamicName(node, message) {
|
92845
|
-
if (isNonBindableDynamicName(node)) {
|
93649
|
+
if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : node.expression)) {
|
92846
93650
|
return grammarErrorOnNode(node, message);
|
92847
93651
|
}
|
92848
93652
|
}
|
@@ -93301,17 +94105,17 @@ function createTypeChecker(host) {
|
|
93301
94105
|
return grammarErrorOnNode(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
93302
94106
|
}
|
93303
94107
|
if (moduleKind === 5 /* ES2015 */) {
|
93304
|
-
return grammarErrorOnNode(node, Diagnostics.
|
94108
|
+
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_or_nodenext);
|
93305
94109
|
}
|
93306
94110
|
if (node.typeArguments) {
|
93307
94111
|
return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
93308
94112
|
}
|
93309
94113
|
const nodeArguments = node.arguments;
|
93310
|
-
if (
|
94114
|
+
if (!(100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
93311
94115
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
93312
94116
|
if (nodeArguments.length > 1) {
|
93313
94117
|
const importAttributesArgument = nodeArguments[1];
|
93314
|
-
return grammarErrorOnNode(importAttributesArgument, Diagnostics.
|
94118
|
+
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_nodenext_or_preserve);
|
93315
94119
|
}
|
93316
94120
|
}
|
93317
94121
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
@@ -97828,7 +98632,7 @@ function transformTypeScript(context) {
|
|
97828
98632
|
return updated;
|
97829
98633
|
}
|
97830
98634
|
function visitParenthesizedExpression(node) {
|
97831
|
-
const innerExpression = skipOuterExpressions(node.expression, ~(
|
98635
|
+
const innerExpression = skipOuterExpressions(node.expression, ~(38 /* Assertions */ | 16 /* ExpressionsWithTypeArguments */));
|
97832
98636
|
if (isAssertionExpression(innerExpression) || isSatisfiesExpression(innerExpression)) {
|
97833
98637
|
const expression = visitNode(node.expression, visitor, isExpression);
|
97834
98638
|
Debug.assert(expression);
|
@@ -116987,11 +117791,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
116987
117791
|
if (isSetAccessor(node.parent)) {
|
116988
117792
|
return createAccessorTypeError(node.parent);
|
116989
117793
|
}
|
116990
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
116991
|
-
node,
|
116992
|
-
/*enclosingDeclaration*/
|
116993
|
-
void 0
|
116994
|
-
);
|
117794
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node, node.parent);
|
116995
117795
|
if (!addUndefined && node.initializer) {
|
116996
117796
|
return createExpressionError(node.initializer);
|
116997
117797
|
}
|
@@ -118675,6 +119475,7 @@ function getModuleTransformer(moduleKind) {
|
|
118675
119475
|
case 6 /* ES2020 */:
|
118676
119476
|
case 5 /* ES2015 */:
|
118677
119477
|
case 100 /* Node16 */:
|
119478
|
+
case 101 /* Node18 */:
|
118678
119479
|
case 199 /* NodeNext */:
|
118679
119480
|
case 1 /* CommonJS */:
|
118680
119481
|
return transformImpliedNodeFormatDependentModule;
|
@@ -125234,45 +126035,6 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
|
|
125234
126035
|
}
|
125235
126036
|
return resolutions;
|
125236
126037
|
}
|
125237
|
-
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
125238
|
-
return forEachProjectReference(
|
125239
|
-
/*projectReferences*/
|
125240
|
-
void 0,
|
125241
|
-
resolvedProjectReferences,
|
125242
|
-
(resolvedRef, parent2) => resolvedRef && cb(resolvedRef, parent2)
|
125243
|
-
);
|
125244
|
-
}
|
125245
|
-
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
125246
|
-
let seenResolvedRefs;
|
125247
|
-
return worker(
|
125248
|
-
projectReferences,
|
125249
|
-
resolvedProjectReferences,
|
125250
|
-
/*parent*/
|
125251
|
-
void 0
|
125252
|
-
);
|
125253
|
-
function worker(projectReferences2, resolvedProjectReferences2, parent2) {
|
125254
|
-
if (cbRef) {
|
125255
|
-
const result = cbRef(projectReferences2, parent2);
|
125256
|
-
if (result) return result;
|
125257
|
-
}
|
125258
|
-
let skipChildren;
|
125259
|
-
return forEach(
|
125260
|
-
resolvedProjectReferences2,
|
125261
|
-
(resolvedRef, index) => {
|
125262
|
-
if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
|
125263
|
-
(skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
|
125264
|
-
return void 0;
|
125265
|
-
}
|
125266
|
-
const result = cbResolvedRef(resolvedRef, parent2, index);
|
125267
|
-
if (result || !resolvedRef) return result;
|
125268
|
-
(seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
|
125269
|
-
}
|
125270
|
-
) || forEach(
|
125271
|
-
resolvedProjectReferences2,
|
125272
|
-
(resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
|
125273
|
-
);
|
125274
|
-
}
|
125275
|
-
}
|
125276
126038
|
var inferredTypesContainingFile = "__inferred type names__.ts";
|
125277
126039
|
function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
|
125278
126040
|
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
@@ -125288,13 +126050,6 @@ function getLibraryNameFromLibFileName(libFileName) {
|
|
125288
126050
|
}
|
125289
126051
|
return "@typescript/lib-" + path;
|
125290
126052
|
}
|
125291
|
-
function getLibNameFromLibReference(libReference) {
|
125292
|
-
return toFileNameLowerCase(libReference.fileName);
|
125293
|
-
}
|
125294
|
-
function getLibFileNameFromLibReference(libReference) {
|
125295
|
-
const libName = getLibNameFromLibReference(libReference);
|
125296
|
-
return libMap.get(libName);
|
125297
|
-
}
|
125298
126053
|
function isReferencedFile(reason) {
|
125299
126054
|
switch (reason == null ? void 0 : reason.kind) {
|
125300
126055
|
case 3 /* Import */:
|
@@ -125512,11 +126267,13 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
|
|
125512
126267
|
typeScriptVersion: typeScriptVersion3
|
125513
126268
|
};
|
125514
126269
|
}
|
125515
|
-
function createProgram(
|
126270
|
+
function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
125516
126271
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
125517
|
-
|
125518
|
-
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } =
|
125519
|
-
let { oldProgram } =
|
126272
|
+
let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
|
126273
|
+
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3, host: createProgramOptionsHost } = _createProgramOptions;
|
126274
|
+
let { oldProgram } = _createProgramOptions;
|
126275
|
+
_createProgramOptions = void 0;
|
126276
|
+
_rootNamesOrOptions = void 0;
|
125520
126277
|
for (const option of commandLineOptionOfCustomType) {
|
125521
126278
|
if (hasProperty(options, option.name)) {
|
125522
126279
|
if (typeof options[option.name] === "string") {
|
@@ -125529,16 +126286,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
125529
126286
|
let processingOtherFiles;
|
125530
126287
|
let files;
|
125531
126288
|
let symlinks;
|
125532
|
-
let commonSourceDirectory;
|
125533
126289
|
let typeChecker;
|
125534
126290
|
let classifiableNames;
|
125535
|
-
let fileReasons = createMultiMap();
|
125536
126291
|
let filesWithReferencesProcessed;
|
125537
|
-
let fileReasonsToChain;
|
125538
|
-
let reasonToRelatedInfo;
|
125539
126292
|
let cachedBindAndCheckDiagnosticsForFile;
|
125540
126293
|
let cachedDeclarationDiagnosticsForFile;
|
125541
|
-
|
126294
|
+
const programDiagnostics = createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax);
|
125542
126295
|
let automaticTypeDirectiveNames;
|
125543
126296
|
let automaticTypeDirectiveResolutions;
|
125544
126297
|
let resolvedLibReferences;
|
@@ -125560,13 +126313,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
125560
126313
|
true
|
125561
126314
|
);
|
125562
126315
|
mark("beforeProgram");
|
125563
|
-
const host =
|
126316
|
+
const host = createProgramOptionsHost || createCompilerHost(options);
|
125564
126317
|
const configParsingHost = parseConfigHostFromCompilerHostLike(host);
|
125565
126318
|
let skipDefaultLib = options.noLib;
|
125566
126319
|
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
|
125567
126320
|
const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
|
125568
|
-
|
125569
|
-
let lazyProgramDiagnosticExplainingFile = [];
|
126321
|
+
let skipVerifyCompilerOptions = false;
|
125570
126322
|
const currentDirectory = host.getCurrentDirectory();
|
125571
126323
|
const supportedExtensions = getSupportedExtensions(options);
|
125572
126324
|
const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
@@ -125844,7 +126596,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
125844
126596
|
getTypeCount: () => getTypeChecker().getTypeCount(),
|
125845
126597
|
getInstantiationCount: () => getTypeChecker().getInstantiationCount(),
|
125846
126598
|
getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
|
125847
|
-
getFileProcessingDiagnostics: () =>
|
126599
|
+
getFileProcessingDiagnostics: () => programDiagnostics.getFileProcessingDiagnostics(),
|
125848
126600
|
getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
|
125849
126601
|
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
125850
126602
|
isSourceFileFromExternalLibrary,
|
@@ -125860,6 +126612,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
125860
126612
|
resolvedModules,
|
125861
126613
|
resolvedTypeReferenceDirectiveNames,
|
125862
126614
|
resolvedLibReferences,
|
126615
|
+
getProgramDiagnosticsContainer: () => programDiagnostics,
|
125863
126616
|
getResolvedModule,
|
125864
126617
|
getResolvedModuleFromModuleSpecifier,
|
125865
126618
|
getResolvedTypeReferenceDirective,
|
@@ -125892,70 +126645,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
125892
126645
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
125893
126646
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
125894
126647
|
getCanonicalFileName,
|
125895
|
-
getFileIncludeReasons: () =>
|
126648
|
+
getFileIncludeReasons: () => programDiagnostics.getFileReasons(),
|
125896
126649
|
structureIsReused,
|
125897
126650
|
writeFile: writeFile2,
|
125898
126651
|
getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
|
125899
126652
|
};
|
125900
126653
|
onProgramCreateComplete();
|
125901
|
-
|
126654
|
+
if (!skipVerifyCompilerOptions) {
|
126655
|
+
verifyCompilerOptions();
|
126656
|
+
}
|
125902
126657
|
mark("afterProgram");
|
125903
126658
|
measure("Program", "beforeProgram", "afterProgram");
|
125904
126659
|
(_p = tracing) == null ? void 0 : _p.pop();
|
125905
126660
|
return program;
|
125906
|
-
function updateAndGetProgramDiagnostics() {
|
125907
|
-
if (lazyProgramDiagnosticExplainingFile) {
|
125908
|
-
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
125909
|
-
switch (diagnostic.kind) {
|
125910
|
-
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
125911
|
-
return programDiagnostics.add(
|
125912
|
-
createDiagnosticExplainingFile(
|
125913
|
-
diagnostic.file && getSourceFileByPath(diagnostic.file),
|
125914
|
-
diagnostic.fileProcessingReason,
|
125915
|
-
diagnostic.diagnostic,
|
125916
|
-
diagnostic.args || emptyArray
|
125917
|
-
)
|
125918
|
-
);
|
125919
|
-
case 0 /* FilePreprocessingLibReferenceDiagnostic */:
|
125920
|
-
return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
|
125921
|
-
case 2 /* ResolutionDiagnostics */:
|
125922
|
-
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
125923
|
-
default:
|
125924
|
-
Debug.assertNever(diagnostic);
|
125925
|
-
}
|
125926
|
-
});
|
125927
|
-
lazyProgramDiagnosticExplainingFile.forEach(
|
125928
|
-
({ file, diagnostic, args }) => programDiagnostics.add(
|
125929
|
-
createDiagnosticExplainingFile(
|
125930
|
-
file,
|
125931
|
-
/*fileProcessingReason*/
|
125932
|
-
void 0,
|
125933
|
-
diagnostic,
|
125934
|
-
args
|
125935
|
-
)
|
125936
|
-
)
|
125937
|
-
);
|
125938
|
-
lazyProgramDiagnosticExplainingFile = void 0;
|
125939
|
-
fileReasonsToChain = void 0;
|
125940
|
-
reasonToRelatedInfo = void 0;
|
125941
|
-
}
|
125942
|
-
return programDiagnostics;
|
125943
|
-
}
|
125944
|
-
function filePreprocessingLibreferenceDiagnostic({ reason }) {
|
125945
|
-
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
125946
|
-
const libReference = file.libReferenceDirectives[reason.index];
|
125947
|
-
const libName = getLibNameFromLibReference(libReference);
|
125948
|
-
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
125949
|
-
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
125950
|
-
return createFileDiagnostic(
|
125951
|
-
file,
|
125952
|
-
Debug.checkDefined(pos),
|
125953
|
-
Debug.checkDefined(end) - pos,
|
125954
|
-
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
125955
|
-
libName,
|
125956
|
-
suggestion
|
125957
|
-
);
|
125958
|
-
}
|
125959
126661
|
function getResolvedModule(file, moduleName, mode) {
|
125960
126662
|
var _a2;
|
125961
126663
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
@@ -126004,7 +126706,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126004
126706
|
function addResolutionDiagnostics(resolution) {
|
126005
126707
|
var _a2;
|
126006
126708
|
if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length)) return;
|
126007
|
-
|
126709
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
126008
126710
|
kind: 2 /* ResolutionDiagnostics */,
|
126009
126711
|
diagnostics: resolution.resolutionDiagnostics
|
126010
126712
|
});
|
@@ -126098,16 +126800,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126098
126800
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
126099
126801
|
}
|
126100
126802
|
function getCommonSourceDirectory2() {
|
126101
|
-
|
126102
|
-
|
126103
|
-
commonSourceDirectory
|
126104
|
-
options,
|
126105
|
-
() => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
|
126106
|
-
currentDirectory,
|
126107
|
-
getCanonicalFileName,
|
126108
|
-
(commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
|
126109
|
-
);
|
126803
|
+
let commonSourceDirectory = programDiagnostics.getCommonSourceDirectory();
|
126804
|
+
if (commonSourceDirectory !== void 0) {
|
126805
|
+
return commonSourceDirectory;
|
126110
126806
|
}
|
126807
|
+
const emittedFiles = filter(files, (file) => sourceFileMayBeEmitted(file, program));
|
126808
|
+
commonSourceDirectory = getCommonSourceDirectory(
|
126809
|
+
options,
|
126810
|
+
() => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
|
126811
|
+
currentDirectory,
|
126812
|
+
getCanonicalFileName,
|
126813
|
+
(commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
|
126814
|
+
);
|
126815
|
+
programDiagnostics.setCommonSourceDirectory(commonSourceDirectory);
|
126111
126816
|
return commonSourceDirectory;
|
126112
126817
|
}
|
126113
126818
|
function getClassifiableNames() {
|
@@ -126418,9 +127123,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126418
127123
|
}
|
126419
127124
|
filesByName.set(path, filesByName.get(oldFile.path));
|
126420
127125
|
});
|
127126
|
+
const isConfigIdentical = oldOptions.configFile && oldOptions.configFile === options.configFile || !oldOptions.configFile && !options.configFile && !optionsHaveChanges(oldOptions, options, optionDeclarations);
|
127127
|
+
programDiagnostics.reuseStateFromOldProgram(oldProgram.getProgramDiagnosticsContainer(), isConfigIdentical);
|
127128
|
+
skipVerifyCompilerOptions = isConfigIdentical;
|
126421
127129
|
files = newSourceFiles;
|
126422
|
-
fileReasons = oldProgram.getFileIncludeReasons();
|
126423
|
-
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
126424
127130
|
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
126425
127131
|
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
126426
127132
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
@@ -126636,7 +127342,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126636
127342
|
if (skipTypeChecking(sourceFile, options, program)) {
|
126637
127343
|
return emptyArray;
|
126638
127344
|
}
|
126639
|
-
const programDiagnosticsInFile =
|
127345
|
+
const programDiagnosticsInFile = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(sourceFile.fileName);
|
126640
127346
|
if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
126641
127347
|
return programDiagnosticsInFile;
|
126642
127348
|
}
|
@@ -126994,15 +127700,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126994
127700
|
}
|
126995
127701
|
function getOptionsDiagnostics() {
|
126996
127702
|
return sortAndDeduplicateDiagnostics(concatenate(
|
126997
|
-
|
127703
|
+
programDiagnostics.getCombinedDiagnostics(program).getGlobalDiagnostics(),
|
126998
127704
|
getOptionsDiagnosticsOfConfigFile()
|
126999
127705
|
));
|
127000
127706
|
}
|
127001
127707
|
function getOptionsDiagnosticsOfConfigFile() {
|
127002
127708
|
if (!options.configFile) return emptyArray;
|
127003
|
-
let diagnostics =
|
127709
|
+
let diagnostics = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(options.configFile.fileName);
|
127004
127710
|
forEachResolvedProjectReference2((resolvedRef) => {
|
127005
|
-
diagnostics = concatenate(diagnostics,
|
127711
|
+
diagnostics = concatenate(diagnostics, programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(resolvedRef.sourceFile.fileName));
|
127006
127712
|
});
|
127007
127713
|
return diagnostics;
|
127008
127714
|
}
|
@@ -127209,7 +127915,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127209
127915
|
);
|
127210
127916
|
}
|
127211
127917
|
function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) {
|
127212
|
-
const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(
|
127918
|
+
const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(programDiagnostics.getFileReasons().get(existingFile.path), isReferencedFile);
|
127213
127919
|
if (hasExistingReasonToReportErrorOn) {
|
127214
127920
|
addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]);
|
127215
127921
|
} else {
|
@@ -127396,7 +128102,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127396
128102
|
}
|
127397
128103
|
function addFileIncludeReason(file, reason, checkExisting) {
|
127398
128104
|
if (file && (!checkExisting || !isReferencedFile(reason) || !(filesWithReferencesProcessed == null ? void 0 : filesWithReferencesProcessed.has(reason.file)))) {
|
127399
|
-
|
128105
|
+
programDiagnostics.getFileReasons().add(file.path, reason);
|
127400
128106
|
return true;
|
127401
128107
|
}
|
127402
128108
|
return false;
|
@@ -127548,6 +128254,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127548
128254
|
var _a2, _b2, _c2, _d2, _e2;
|
127549
128255
|
const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
|
127550
128256
|
if (existing) return existing;
|
128257
|
+
if (options.libReplacement === false) {
|
128258
|
+
const result2 = {
|
128259
|
+
resolution: {
|
128260
|
+
resolvedModule: void 0
|
128261
|
+
},
|
128262
|
+
actual: combinePaths(defaultLibraryPath, libFileName)
|
128263
|
+
};
|
128264
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result2);
|
128265
|
+
return result2;
|
128266
|
+
}
|
127551
128267
|
if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
127552
128268
|
const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
|
127553
128269
|
if (oldResolution) {
|
@@ -127595,7 +128311,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127595
128311
|
{ kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
127596
128312
|
);
|
127597
128313
|
} else {
|
127598
|
-
|
128314
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
127599
128315
|
kind: 0 /* FilePreprocessingLibReferenceDiagnostic */,
|
127600
128316
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
127601
128317
|
});
|
@@ -127658,10 +128374,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127658
128374
|
if (!sourceFile.isDeclarationFile) {
|
127659
128375
|
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
127660
128376
|
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
127661
|
-
|
128377
|
+
programDiagnostics.addLazyConfigDiagnostic(
|
127662
128378
|
sourceFile,
|
127663
128379
|
Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
|
127664
|
-
|
128380
|
+
sourceFile.fileName,
|
128381
|
+
rootDirectory
|
127665
128382
|
);
|
127666
128383
|
allFilesBelongToPath = false;
|
127667
128384
|
}
|
@@ -127776,7 +128493,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127776
128493
|
}
|
127777
128494
|
const outputFile = options.outFile;
|
127778
128495
|
if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) {
|
127779
|
-
programDiagnostics.
|
128496
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
|
127780
128497
|
}
|
127781
128498
|
verifyDeprecatedCompilerOptions();
|
127782
128499
|
verifyProjectReferences();
|
@@ -127784,10 +128501,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127784
128501
|
const rootPaths = new Set(rootNames.map(toPath3));
|
127785
128502
|
for (const file of files) {
|
127786
128503
|
if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
|
127787
|
-
|
128504
|
+
programDiagnostics.addLazyConfigDiagnostic(
|
127788
128505
|
file,
|
127789
128506
|
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
|
127790
|
-
|
128507
|
+
file.fileName,
|
128508
|
+
options.configFilePath || ""
|
127791
128509
|
);
|
127792
128510
|
}
|
127793
128511
|
}
|
@@ -127878,14 +128596,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127878
128596
|
}
|
127879
128597
|
} else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === 0 /* None */) {
|
127880
128598
|
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
|
127881
|
-
programDiagnostics.
|
128599
|
+
programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
|
127882
128600
|
}
|
127883
128601
|
if (outputFile && !options.emitDeclarationOnly) {
|
127884
128602
|
if (options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) {
|
127885
128603
|
createDiagnosticForOptionName(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, "outFile", "module");
|
127886
128604
|
} else if (options.module === void 0 && firstNonAmbientExternalModuleSourceFile) {
|
127887
128605
|
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
|
127888
|
-
programDiagnostics.
|
128606
|
+
programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, "outFile"));
|
127889
128607
|
}
|
127890
128608
|
}
|
127891
128609
|
if (getResolveJsonModule(options)) {
|
@@ -127974,7 +128692,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127974
128692
|
}
|
127975
128693
|
if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
127976
128694
|
const moduleKindName = ModuleKind[moduleKind];
|
127977
|
-
|
128695
|
+
const moduleResolutionName = ModuleResolutionKind[moduleKindName] ? moduleKindName : "Node16";
|
128696
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1, moduleResolutionName, moduleKindName);
|
127978
128697
|
} else if (ModuleResolutionKind[moduleResolution] && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) && !(100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */)) {
|
127979
128698
|
const moduleResolutionName = ModuleResolutionKind[moduleResolution];
|
127980
128699
|
createOptionValueDiagnostic("module", Diagnostics.Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1, moduleResolutionName, moduleResolutionName);
|
@@ -128136,90 +128855,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128136
128855
|
}
|
128137
128856
|
});
|
128138
128857
|
}
|
128139
|
-
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
128140
|
-
let seenReasons;
|
128141
|
-
const reasons = file && fileReasons.get(file.path);
|
128142
|
-
let fileIncludeReasons;
|
128143
|
-
let relatedInfo;
|
128144
|
-
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
128145
|
-
let fileIncludeReasonDetails;
|
128146
|
-
let redirectInfo;
|
128147
|
-
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
128148
|
-
let chain;
|
128149
|
-
if (cachedChain) {
|
128150
|
-
if (cachedChain.fileIncludeReasonDetails) {
|
128151
|
-
seenReasons = new Set(reasons);
|
128152
|
-
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
128153
|
-
} else {
|
128154
|
-
reasons == null ? void 0 : reasons.forEach(processReason);
|
128155
|
-
}
|
128156
|
-
redirectInfo = cachedChain.redirectInfo;
|
128157
|
-
} else {
|
128158
|
-
reasons == null ? void 0 : reasons.forEach(processReason);
|
128159
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
128160
|
-
}
|
128161
|
-
if (fileProcessingReason) processReason(fileProcessingReason);
|
128162
|
-
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
128163
|
-
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
|
128164
|
-
if (seenReasons && cachedChain) {
|
128165
|
-
if (cachedChain.details && !processedExtraReason) {
|
128166
|
-
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
|
128167
|
-
} else if (cachedChain.fileIncludeReasonDetails) {
|
128168
|
-
if (!processedExtraReason) {
|
128169
|
-
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
128170
|
-
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
128171
|
-
} else {
|
128172
|
-
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
128173
|
-
}
|
128174
|
-
} else {
|
128175
|
-
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
128176
|
-
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
128177
|
-
} else {
|
128178
|
-
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
128179
|
-
}
|
128180
|
-
}
|
128181
|
-
}
|
128182
|
-
}
|
128183
|
-
if (!chain) {
|
128184
|
-
if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
128185
|
-
chain = chainDiagnosticMessages(
|
128186
|
-
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
128187
|
-
diagnostic,
|
128188
|
-
...args || emptyArray
|
128189
|
-
);
|
128190
|
-
}
|
128191
|
-
if (file) {
|
128192
|
-
if (cachedChain) {
|
128193
|
-
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
128194
|
-
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
128195
|
-
}
|
128196
|
-
} else {
|
128197
|
-
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
128198
|
-
}
|
128199
|
-
if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
|
128200
|
-
}
|
128201
|
-
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
128202
|
-
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
128203
|
-
function processReason(reason) {
|
128204
|
-
if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
|
128205
|
-
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
128206
|
-
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
128207
|
-
populateRelatedInfo(reason);
|
128208
|
-
}
|
128209
|
-
function populateRelatedInfo(reason) {
|
128210
|
-
if (!locationReason && isReferencedFile(reason)) {
|
128211
|
-
locationReason = reason;
|
128212
|
-
} else if (locationReason !== reason) {
|
128213
|
-
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
|
128214
|
-
}
|
128215
|
-
}
|
128216
|
-
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
128217
|
-
var _a2;
|
128218
|
-
return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
|
128219
|
-
}
|
128220
|
-
}
|
128221
128858
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
128222
|
-
|
128859
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
128223
128860
|
kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
|
128224
128861
|
file: file && file.path,
|
128225
128862
|
fileProcessingReason,
|
@@ -128227,99 +128864,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128227
128864
|
args
|
128228
128865
|
});
|
128229
128866
|
}
|
128230
|
-
function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
|
128231
|
-
lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
|
128232
|
-
}
|
128233
|
-
function getFileIncludeReasonToRelatedInformation(reason) {
|
128234
|
-
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
128235
|
-
if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
|
128236
|
-
return relatedInfo || void 0;
|
128237
|
-
}
|
128238
|
-
function fileIncludeReasonToRelatedInformation(reason) {
|
128239
|
-
if (isReferencedFile(reason)) {
|
128240
|
-
const referenceLocation = getReferencedFileLocation(program, reason);
|
128241
|
-
let message2;
|
128242
|
-
switch (reason.kind) {
|
128243
|
-
case 3 /* Import */:
|
128244
|
-
message2 = Diagnostics.File_is_included_via_import_here;
|
128245
|
-
break;
|
128246
|
-
case 4 /* ReferenceFile */:
|
128247
|
-
message2 = Diagnostics.File_is_included_via_reference_here;
|
128248
|
-
break;
|
128249
|
-
case 5 /* TypeReferenceDirective */:
|
128250
|
-
message2 = Diagnostics.File_is_included_via_type_library_reference_here;
|
128251
|
-
break;
|
128252
|
-
case 7 /* LibReferenceDirective */:
|
128253
|
-
message2 = Diagnostics.File_is_included_via_library_reference_here;
|
128254
|
-
break;
|
128255
|
-
default:
|
128256
|
-
Debug.assertNever(reason);
|
128257
|
-
}
|
128258
|
-
return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
|
128259
|
-
referenceLocation.file,
|
128260
|
-
referenceLocation.pos,
|
128261
|
-
referenceLocation.end - referenceLocation.pos,
|
128262
|
-
message2
|
128263
|
-
) : void 0;
|
128264
|
-
}
|
128265
|
-
if (!options.configFile) return void 0;
|
128266
|
-
let configFileNode;
|
128267
|
-
let message;
|
128268
|
-
switch (reason.kind) {
|
128269
|
-
case 0 /* RootFile */:
|
128270
|
-
if (!options.configFile.configFileSpecs) return void 0;
|
128271
|
-
const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
|
128272
|
-
const matchedByFiles = getMatchedFileSpec(program, fileName);
|
128273
|
-
if (matchedByFiles) {
|
128274
|
-
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
|
128275
|
-
message = Diagnostics.File_is_matched_by_files_list_specified_here;
|
128276
|
-
break;
|
128277
|
-
}
|
128278
|
-
const matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
128279
|
-
if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
|
128280
|
-
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
128281
|
-
message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
128282
|
-
break;
|
128283
|
-
case 1 /* SourceFromProjectReference */:
|
128284
|
-
case 2 /* OutputFromProjectReference */:
|
128285
|
-
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
128286
|
-
const referenceInfo = forEachProjectReference(
|
128287
|
-
projectReferences,
|
128288
|
-
resolvedProjectReferences,
|
128289
|
-
(resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
|
128290
|
-
);
|
128291
|
-
if (!referenceInfo) return void 0;
|
128292
|
-
const { sourceFile, index } = referenceInfo;
|
128293
|
-
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
128294
|
-
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
128295
|
-
sourceFile,
|
128296
|
-
referencesSyntax.elements[index],
|
128297
|
-
reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
|
128298
|
-
) : void 0;
|
128299
|
-
case 8 /* AutomaticTypeDirectiveFile */:
|
128300
|
-
if (!options.types) return void 0;
|
128301
|
-
configFileNode = getOptionsSyntaxByArrayElementValue("types", reason.typeReference);
|
128302
|
-
message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
|
128303
|
-
break;
|
128304
|
-
case 6 /* LibFile */:
|
128305
|
-
if (reason.index !== void 0) {
|
128306
|
-
configFileNode = getOptionsSyntaxByArrayElementValue("lib", options.lib[reason.index]);
|
128307
|
-
message = Diagnostics.File_is_library_specified_here;
|
128308
|
-
break;
|
128309
|
-
}
|
128310
|
-
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
128311
|
-
configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0;
|
128312
|
-
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
128313
|
-
break;
|
128314
|
-
default:
|
128315
|
-
Debug.assertNever(reason);
|
128316
|
-
}
|
128317
|
-
return configFileNode && createDiagnosticForNodeInSourceFile(
|
128318
|
-
options.configFile,
|
128319
|
-
configFileNode,
|
128320
|
-
message
|
128321
|
-
);
|
128322
|
-
}
|
128323
128867
|
function verifyProjectReferences() {
|
128324
128868
|
const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : void 0;
|
128325
128869
|
forEachProjectReference(
|
@@ -128355,7 +128899,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128355
128899
|
forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
|
128356
128900
|
const initializer = keyProps.initializer;
|
128357
128901
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
128358
|
-
programDiagnostics.
|
128902
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
128359
128903
|
needCompilerDiagnostic = false;
|
128360
128904
|
}
|
128361
128905
|
});
|
@@ -128384,18 +128928,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128384
128928
|
createCompilerOptionsDiagnostic(message, ...args);
|
128385
128929
|
}
|
128386
128930
|
}
|
128387
|
-
function forEachOptionsSyntaxByName(name, callback) {
|
128388
|
-
return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
|
128389
|
-
}
|
128390
128931
|
function forEachOptionPathsSyntax(callback) {
|
128391
|
-
return forEachOptionsSyntaxByName("paths", callback);
|
128392
|
-
}
|
128393
|
-
function getOptionsSyntaxByValue(name, value) {
|
128394
|
-
return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
128395
|
-
}
|
128396
|
-
function getOptionsSyntaxByArrayElementValue(name, value) {
|
128397
|
-
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
128398
|
-
return compilerOptionsObjectLiteralSyntax && getPropertyArrayElementValue(compilerOptionsObjectLiteralSyntax, name, value);
|
128932
|
+
return forEachOptionsSyntaxByName(getCompilerOptionsObjectLiteralSyntax(), "paths", callback);
|
128399
128933
|
}
|
128400
128934
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
128401
128935
|
createDiagnosticForOption(
|
@@ -128423,9 +128957,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128423
128957
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
128424
128958
|
const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
128425
128959
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
128426
|
-
programDiagnostics.
|
128960
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
128427
128961
|
} else {
|
128428
|
-
programDiagnostics.
|
128962
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
|
128429
128963
|
}
|
128430
128964
|
}
|
128431
128965
|
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
@@ -128439,14 +128973,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128439
128973
|
const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
|
128440
128974
|
if (compilerOptionsProperty) {
|
128441
128975
|
if ("messageText" in message) {
|
128442
|
-
programDiagnostics.
|
128976
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
|
128443
128977
|
} else {
|
128444
|
-
programDiagnostics.
|
128978
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
|
128445
128979
|
}
|
128446
128980
|
} else if ("messageText" in message) {
|
128447
|
-
programDiagnostics.
|
128981
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnosticFromMessageChain(message));
|
128448
128982
|
} else {
|
128449
|
-
programDiagnostics.
|
128983
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
|
128450
128984
|
}
|
128451
128985
|
}
|
128452
128986
|
function getCompilerOptionsObjectLiteralSyntax() {
|
@@ -128470,9 +129004,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128470
129004
|
let needsCompilerDiagnostic = false;
|
128471
129005
|
forEachPropertyAssignment(objectLiteral, key1, (prop) => {
|
128472
129006
|
if ("messageText" in message) {
|
128473
|
-
programDiagnostics.
|
129007
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
128474
129008
|
} else {
|
128475
|
-
programDiagnostics.
|
129009
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
128476
129010
|
}
|
128477
129011
|
needsCompilerDiagnostic = true;
|
128478
129012
|
}, key2);
|
@@ -128480,7 +129014,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128480
129014
|
}
|
128481
129015
|
function blockEmittingOfFile(emitFileName, diag2) {
|
128482
129016
|
hasEmitBlockingDiagnostics.set(toPath3(emitFileName), true);
|
128483
|
-
programDiagnostics.
|
129017
|
+
programDiagnostics.addConfigDiagnostic(diag2);
|
128484
129018
|
}
|
128485
129019
|
function isEmittedFile(file) {
|
128486
129020
|
if (options.noEmit) {
|
@@ -128803,6 +129337,293 @@ function getModuleNameStringLiteralAt({ imports, moduleAugmentations }, index) {
|
|
128803
129337
|
Debug.fail("should never ask for module name at index higher than possible module name");
|
128804
129338
|
}
|
128805
129339
|
|
129340
|
+
// src/compiler/programDiagnostics.ts
|
129341
|
+
function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax) {
|
129342
|
+
let computedDiagnostics;
|
129343
|
+
let fileReasons = createMultiMap();
|
129344
|
+
let fileProcessingDiagnostics;
|
129345
|
+
let commonSourceDirectory;
|
129346
|
+
let configDiagnostics;
|
129347
|
+
let lazyConfigDiagnostics;
|
129348
|
+
let fileReasonsToChain;
|
129349
|
+
let reasonToRelatedInfo;
|
129350
|
+
return {
|
129351
|
+
addConfigDiagnostic(diag2) {
|
129352
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
129353
|
+
(configDiagnostics ?? (configDiagnostics = createDiagnosticCollection())).add(diag2);
|
129354
|
+
},
|
129355
|
+
addLazyConfigDiagnostic(file, message, ...args) {
|
129356
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
129357
|
+
(lazyConfigDiagnostics ?? (lazyConfigDiagnostics = [])).push({ file, diagnostic: message, args });
|
129358
|
+
},
|
129359
|
+
addFileProcessingDiagnostic(diag2) {
|
129360
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
129361
|
+
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push(diag2);
|
129362
|
+
},
|
129363
|
+
setCommonSourceDirectory(directory) {
|
129364
|
+
commonSourceDirectory = directory;
|
129365
|
+
},
|
129366
|
+
reuseStateFromOldProgram(oldProgramDiagnostics, isConfigIdentical) {
|
129367
|
+
fileReasons = oldProgramDiagnostics.getFileReasons();
|
129368
|
+
fileProcessingDiagnostics = oldProgramDiagnostics.getFileProcessingDiagnostics();
|
129369
|
+
if (isConfigIdentical) {
|
129370
|
+
commonSourceDirectory = oldProgramDiagnostics.getCommonSourceDirectory();
|
129371
|
+
configDiagnostics = oldProgramDiagnostics.getConfigDiagnostics();
|
129372
|
+
lazyConfigDiagnostics = oldProgramDiagnostics.getLazyConfigDiagnostics();
|
129373
|
+
}
|
129374
|
+
},
|
129375
|
+
getFileProcessingDiagnostics() {
|
129376
|
+
return fileProcessingDiagnostics;
|
129377
|
+
},
|
129378
|
+
getFileReasons() {
|
129379
|
+
return fileReasons;
|
129380
|
+
},
|
129381
|
+
getCommonSourceDirectory() {
|
129382
|
+
return commonSourceDirectory;
|
129383
|
+
},
|
129384
|
+
getConfigDiagnostics() {
|
129385
|
+
return configDiagnostics;
|
129386
|
+
},
|
129387
|
+
getLazyConfigDiagnostics() {
|
129388
|
+
return lazyConfigDiagnostics;
|
129389
|
+
},
|
129390
|
+
getCombinedDiagnostics(program) {
|
129391
|
+
if (computedDiagnostics) {
|
129392
|
+
return computedDiagnostics;
|
129393
|
+
}
|
129394
|
+
computedDiagnostics = createDiagnosticCollection();
|
129395
|
+
configDiagnostics == null ? void 0 : configDiagnostics.getDiagnostics().forEach((d) => computedDiagnostics.add(d));
|
129396
|
+
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
129397
|
+
switch (diagnostic.kind) {
|
129398
|
+
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
129399
|
+
return computedDiagnostics.add(
|
129400
|
+
createDiagnosticExplainingFile(
|
129401
|
+
program,
|
129402
|
+
diagnostic.file && program.getSourceFileByPath(diagnostic.file),
|
129403
|
+
diagnostic.fileProcessingReason,
|
129404
|
+
diagnostic.diagnostic,
|
129405
|
+
diagnostic.args || emptyArray
|
129406
|
+
)
|
129407
|
+
);
|
129408
|
+
case 0 /* FilePreprocessingLibReferenceDiagnostic */:
|
129409
|
+
return computedDiagnostics.add(filePreprocessingLibreferenceDiagnostic(program, diagnostic));
|
129410
|
+
case 2 /* ResolutionDiagnostics */:
|
129411
|
+
return diagnostic.diagnostics.forEach((d) => computedDiagnostics.add(d));
|
129412
|
+
default:
|
129413
|
+
Debug.assertNever(diagnostic);
|
129414
|
+
}
|
129415
|
+
});
|
129416
|
+
lazyConfigDiagnostics == null ? void 0 : lazyConfigDiagnostics.forEach(
|
129417
|
+
({ file, diagnostic, args }) => computedDiagnostics.add(
|
129418
|
+
createDiagnosticExplainingFile(
|
129419
|
+
program,
|
129420
|
+
file,
|
129421
|
+
/*fileProcessingReason*/
|
129422
|
+
void 0,
|
129423
|
+
diagnostic,
|
129424
|
+
args
|
129425
|
+
)
|
129426
|
+
)
|
129427
|
+
);
|
129428
|
+
fileReasonsToChain = void 0;
|
129429
|
+
reasonToRelatedInfo = void 0;
|
129430
|
+
return computedDiagnostics;
|
129431
|
+
}
|
129432
|
+
};
|
129433
|
+
function filePreprocessingLibreferenceDiagnostic(program, { reason }) {
|
129434
|
+
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
129435
|
+
const libReference = file.libReferenceDirectives[reason.index];
|
129436
|
+
const libName = getLibNameFromLibReference(libReference);
|
129437
|
+
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
129438
|
+
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
129439
|
+
return createFileDiagnostic(
|
129440
|
+
file,
|
129441
|
+
Debug.checkDefined(pos),
|
129442
|
+
Debug.checkDefined(end) - pos,
|
129443
|
+
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
129444
|
+
libName,
|
129445
|
+
suggestion
|
129446
|
+
);
|
129447
|
+
}
|
129448
|
+
function createDiagnosticExplainingFile(program, file, fileProcessingReason, diagnostic, args) {
|
129449
|
+
let seenReasons;
|
129450
|
+
let fileIncludeReasons;
|
129451
|
+
let relatedInfo;
|
129452
|
+
let fileIncludeReasonDetails;
|
129453
|
+
let redirectInfo;
|
129454
|
+
let chain;
|
129455
|
+
const reasons = file && fileReasons.get(file.path);
|
129456
|
+
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
129457
|
+
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
129458
|
+
if (cachedChain) {
|
129459
|
+
if (cachedChain.fileIncludeReasonDetails) {
|
129460
|
+
seenReasons = new Set(reasons);
|
129461
|
+
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
129462
|
+
} else {
|
129463
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
129464
|
+
}
|
129465
|
+
redirectInfo = cachedChain.redirectInfo;
|
129466
|
+
} else {
|
129467
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
129468
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file));
|
129469
|
+
}
|
129470
|
+
if (fileProcessingReason) processReason(fileProcessingReason);
|
129471
|
+
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
129472
|
+
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
|
129473
|
+
if (seenReasons && cachedChain) {
|
129474
|
+
if (cachedChain.details && !processedExtraReason) {
|
129475
|
+
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args ?? emptyArray);
|
129476
|
+
} else if (cachedChain.fileIncludeReasonDetails) {
|
129477
|
+
if (!processedExtraReason) {
|
129478
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
129479
|
+
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
129480
|
+
} else {
|
129481
|
+
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
129482
|
+
}
|
129483
|
+
} else {
|
129484
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
129485
|
+
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
129486
|
+
} else {
|
129487
|
+
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
129488
|
+
}
|
129489
|
+
}
|
129490
|
+
}
|
129491
|
+
}
|
129492
|
+
if (!chain) {
|
129493
|
+
if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
129494
|
+
chain = chainDiagnosticMessages(
|
129495
|
+
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
129496
|
+
diagnostic,
|
129497
|
+
...args || emptyArray
|
129498
|
+
);
|
129499
|
+
}
|
129500
|
+
if (file) {
|
129501
|
+
if (cachedChain) {
|
129502
|
+
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
129503
|
+
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
129504
|
+
}
|
129505
|
+
} else {
|
129506
|
+
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
129507
|
+
}
|
129508
|
+
if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
|
129509
|
+
}
|
129510
|
+
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
129511
|
+
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
129512
|
+
function processReason(reason) {
|
129513
|
+
if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
|
129514
|
+
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
129515
|
+
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
129516
|
+
populateRelatedInfo(reason);
|
129517
|
+
}
|
129518
|
+
function populateRelatedInfo(reason) {
|
129519
|
+
if (!locationReason && isReferencedFile(reason)) {
|
129520
|
+
locationReason = reason;
|
129521
|
+
} else if (locationReason !== reason) {
|
129522
|
+
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(program, reason));
|
129523
|
+
}
|
129524
|
+
}
|
129525
|
+
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
129526
|
+
var _a;
|
129527
|
+
return ((_a = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a.length) !== (reasons == null ? void 0 : reasons.length);
|
129528
|
+
}
|
129529
|
+
}
|
129530
|
+
function getFileIncludeReasonToRelatedInformation(program, reason) {
|
129531
|
+
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
129532
|
+
if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(program, reason) ?? false);
|
129533
|
+
return relatedInfo || void 0;
|
129534
|
+
}
|
129535
|
+
function fileIncludeReasonToRelatedInformation(program, reason) {
|
129536
|
+
if (isReferencedFile(reason)) {
|
129537
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
129538
|
+
let message2;
|
129539
|
+
switch (reason.kind) {
|
129540
|
+
case 3 /* Import */:
|
129541
|
+
message2 = Diagnostics.File_is_included_via_import_here;
|
129542
|
+
break;
|
129543
|
+
case 4 /* ReferenceFile */:
|
129544
|
+
message2 = Diagnostics.File_is_included_via_reference_here;
|
129545
|
+
break;
|
129546
|
+
case 5 /* TypeReferenceDirective */:
|
129547
|
+
message2 = Diagnostics.File_is_included_via_type_library_reference_here;
|
129548
|
+
break;
|
129549
|
+
case 7 /* LibReferenceDirective */:
|
129550
|
+
message2 = Diagnostics.File_is_included_via_library_reference_here;
|
129551
|
+
break;
|
129552
|
+
default:
|
129553
|
+
Debug.assertNever(reason);
|
129554
|
+
}
|
129555
|
+
return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
|
129556
|
+
referenceLocation.file,
|
129557
|
+
referenceLocation.pos,
|
129558
|
+
referenceLocation.end - referenceLocation.pos,
|
129559
|
+
message2
|
129560
|
+
) : void 0;
|
129561
|
+
}
|
129562
|
+
const currentDirectory = program.getCurrentDirectory();
|
129563
|
+
const rootNames = program.getRootFileNames();
|
129564
|
+
const options = program.getCompilerOptions();
|
129565
|
+
if (!options.configFile) return void 0;
|
129566
|
+
let configFileNode;
|
129567
|
+
let message;
|
129568
|
+
switch (reason.kind) {
|
129569
|
+
case 0 /* RootFile */:
|
129570
|
+
if (!options.configFile.configFileSpecs) return void 0;
|
129571
|
+
const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
|
129572
|
+
const matchedByFiles = getMatchedFileSpec(program, fileName);
|
129573
|
+
if (matchedByFiles) {
|
129574
|
+
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
|
129575
|
+
message = Diagnostics.File_is_matched_by_files_list_specified_here;
|
129576
|
+
break;
|
129577
|
+
}
|
129578
|
+
const matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
129579
|
+
if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
|
129580
|
+
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
129581
|
+
message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
129582
|
+
break;
|
129583
|
+
case 1 /* SourceFromProjectReference */:
|
129584
|
+
case 2 /* OutputFromProjectReference */:
|
129585
|
+
const resolvedProjectReferences = program.getResolvedProjectReferences();
|
129586
|
+
const projectReferences = program.getProjectReferences();
|
129587
|
+
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
129588
|
+
const referenceInfo = forEachProjectReference(
|
129589
|
+
projectReferences,
|
129590
|
+
resolvedProjectReferences,
|
129591
|
+
(resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
|
129592
|
+
);
|
129593
|
+
if (!referenceInfo) return void 0;
|
129594
|
+
const { sourceFile, index } = referenceInfo;
|
129595
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
129596
|
+
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
129597
|
+
sourceFile,
|
129598
|
+
referencesSyntax.elements[index],
|
129599
|
+
reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
|
129600
|
+
) : void 0;
|
129601
|
+
case 8 /* AutomaticTypeDirectiveFile */:
|
129602
|
+
if (!options.types) return void 0;
|
129603
|
+
configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "types", reason.typeReference);
|
129604
|
+
message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
|
129605
|
+
break;
|
129606
|
+
case 6 /* LibFile */:
|
129607
|
+
if (reason.index !== void 0) {
|
129608
|
+
configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "lib", options.lib[reason.index]);
|
129609
|
+
message = Diagnostics.File_is_library_specified_here;
|
129610
|
+
break;
|
129611
|
+
}
|
129612
|
+
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
129613
|
+
configFileNode = target ? getOptionsSyntaxByValue(getCompilerOptionsObjectLiteralSyntax(), "target", target) : void 0;
|
129614
|
+
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
129615
|
+
break;
|
129616
|
+
default:
|
129617
|
+
Debug.assertNever(reason);
|
129618
|
+
}
|
129619
|
+
return configFileNode && createDiagnosticForNodeInSourceFile(
|
129620
|
+
options.configFile,
|
129621
|
+
configFileNode,
|
129622
|
+
message
|
129623
|
+
);
|
129624
|
+
}
|
129625
|
+
}
|
129626
|
+
|
128806
129627
|
// src/compiler/builderState.ts
|
128807
129628
|
function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
|
128808
129629
|
const outputFiles = [];
|
@@ -136663,9 +137484,9 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
136663
137484
|
}
|
136664
137485
|
if (!result && node.kind === 303 /* PropertyAssignment */) {
|
136665
137486
|
const initializer = node.initializer;
|
136666
|
-
const
|
136667
|
-
if (
|
136668
|
-
result = serializeExistingTypeNode(
|
137487
|
+
const assertionNode = isJSDocTypeAssertion(initializer) ? getJSDocTypeAssertionType(initializer) : initializer.kind === 234 /* AsExpression */ || initializer.kind === 216 /* TypeAssertionExpression */ ? initializer.type : void 0;
|
137488
|
+
if (assertionNode && !isConstTypeReference(assertionNode) && resolver.canReuseTypeNodeAnnotation(context, node, assertionNode, symbol)) {
|
137489
|
+
result = serializeExistingTypeNode(assertionNode, context);
|
136669
137490
|
}
|
136670
137491
|
}
|
136671
137492
|
return result ?? inferTypeOfDeclaration(
|
@@ -136958,18 +137779,21 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
136958
137779
|
return failed;
|
136959
137780
|
}
|
136960
137781
|
function typeFromFunctionLikeExpression(fnNode, context) {
|
136961
|
-
const
|
136962
|
-
context.noInferenceFallback = true;
|
136963
|
-
createReturnFromSignature(
|
137782
|
+
const returnType = createReturnFromSignature(
|
136964
137783
|
fnNode,
|
136965
137784
|
/*symbol*/
|
136966
137785
|
void 0,
|
136967
137786
|
context
|
136968
137787
|
);
|
136969
|
-
reuseTypeParameters(fnNode.typeParameters, context);
|
136970
|
-
fnNode.parameters.map((p) => ensureParameter(p, context));
|
136971
|
-
|
136972
|
-
|
137788
|
+
const typeParameters = reuseTypeParameters(fnNode.typeParameters, context);
|
137789
|
+
const parameters = fnNode.parameters.map((p) => ensureParameter(p, context));
|
137790
|
+
return syntacticResult(
|
137791
|
+
factory.createFunctionTypeNode(
|
137792
|
+
typeParameters,
|
137793
|
+
parameters,
|
137794
|
+
returnType
|
137795
|
+
)
|
137796
|
+
);
|
136973
137797
|
}
|
136974
137798
|
function canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext) {
|
136975
137799
|
if (!isConstContext) {
|
@@ -139816,9 +140640,9 @@ function mapToDisplayParts(writeDisplayParts) {
|
|
139816
140640
|
displayPartWriter.clear();
|
139817
140641
|
}
|
139818
140642
|
}
|
139819
|
-
function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None
|
140643
|
+
function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None */, verbosityLevel, out) {
|
139820
140644
|
return mapToDisplayParts((writer) => {
|
139821
|
-
typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer);
|
140645
|
+
typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer, verbosityLevel, out);
|
139822
140646
|
});
|
139823
140647
|
}
|
139824
140648
|
function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags = 0 /* None */) {
|
@@ -140525,7 +141349,7 @@ function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
|
|
140525
141349
|
return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target, forceCapitalize);
|
140526
141350
|
}
|
140527
141351
|
function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
|
140528
|
-
const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index"));
|
141352
|
+
const baseName = getBaseFileName(removeSuffix(removeFileExtension(moduleSpecifier), "/index"));
|
140529
141353
|
let res = "";
|
140530
141354
|
let lastCharWasValid = true;
|
140531
141355
|
const firstCharCode = baseName.charCodeAt(0);
|
@@ -151783,7 +152607,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
151783
152607
|
synchronizeHostData();
|
151784
152608
|
return ts_Completions_exports.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host, preferences);
|
151785
152609
|
}
|
151786
|
-
function getQuickInfoAtPosition(fileName, position) {
|
152610
|
+
function getQuickInfoAtPosition(fileName, position, verbosityLevel) {
|
151787
152611
|
synchronizeHostData();
|
151788
152612
|
const sourceFile = getValidSourceFile(fileName);
|
151789
152613
|
const node = getTouchingPropertyName(sourceFile, position);
|
@@ -151799,19 +152623,41 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
151799
152623
|
kind: "" /* unknown */,
|
151800
152624
|
kindModifiers: "" /* none */,
|
151801
152625
|
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
|
151802
|
-
displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(
|
152626
|
+
displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(
|
152627
|
+
typeChecker2,
|
152628
|
+
type,
|
152629
|
+
getContainerNode(nodeForQuickInfo),
|
152630
|
+
/*flags*/
|
152631
|
+
void 0,
|
152632
|
+
verbosityLevel
|
152633
|
+
)),
|
151803
152634
|
documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : void 0,
|
151804
152635
|
tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : void 0
|
151805
152636
|
};
|
151806
152637
|
}
|
151807
|
-
const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(
|
152638
|
+
const { symbolKind, displayParts, documentation, tags, canIncreaseVerbosityLevel } = typeChecker.runWithCancellationToken(
|
152639
|
+
cancellationToken,
|
152640
|
+
(typeChecker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(
|
152641
|
+
typeChecker2,
|
152642
|
+
symbol,
|
152643
|
+
sourceFile,
|
152644
|
+
getContainerNode(nodeForQuickInfo),
|
152645
|
+
nodeForQuickInfo,
|
152646
|
+
/*semanticMeaning*/
|
152647
|
+
void 0,
|
152648
|
+
/*alias*/
|
152649
|
+
void 0,
|
152650
|
+
verbosityLevel
|
152651
|
+
)
|
152652
|
+
);
|
151808
152653
|
return {
|
151809
152654
|
kind: symbolKind,
|
151810
152655
|
kindModifiers: ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol),
|
151811
152656
|
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
|
151812
152657
|
displayParts,
|
151813
152658
|
documentation,
|
151814
|
-
tags
|
152659
|
+
tags,
|
152660
|
+
canIncreaseVerbosityLevel
|
151815
152661
|
};
|
151816
152662
|
}
|
151817
152663
|
function preparePasteEditsForFile(fileName, copiedTextRange) {
|
@@ -156842,6 +157688,7 @@ var errorCodes19 = [
|
|
156842
157688
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
|
156843
157689
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
|
156844
157690
|
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
|
157691
|
+
Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code,
|
156845
157692
|
Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code
|
156846
157693
|
];
|
156847
157694
|
registerCodeFix({
|
@@ -157945,6 +158792,7 @@ function getUmdImportKind(importingFile, program, forceImportKeyword) {
|
|
157945
158792
|
case 200 /* Preserve */:
|
157946
158793
|
return 2 /* Namespace */;
|
157947
158794
|
case 100 /* Node16 */:
|
158795
|
+
case 101 /* Node18 */:
|
157948
158796
|
case 199 /* NodeNext */:
|
157949
158797
|
return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
|
157950
158798
|
default:
|
@@ -159356,7 +160204,8 @@ var errorCodes28 = [
|
|
159356
160204
|
Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2.code,
|
159357
160205
|
Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more.code,
|
159358
160206
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
|
159359
|
-
Diagnostics.Cannot_find_name_0.code
|
160207
|
+
Diagnostics.Cannot_find_name_0.code,
|
160208
|
+
Diagnostics.Type_0_does_not_satisfy_the_expected_type_1.code
|
159360
160209
|
];
|
159361
160210
|
registerCodeFix({
|
159362
160211
|
errorCodes: errorCodes28,
|
@@ -159393,9 +160242,9 @@ registerCodeFix({
|
|
159393
160242
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
159394
160243
|
eachDiagnostic(context, errorCodes28, (diag2) => {
|
159395
160244
|
const info = getInfo10(diag2.file, diag2.start, diag2.code, checker, context.program);
|
159396
|
-
if (
|
159397
|
-
|
159398
|
-
|
160245
|
+
if (info === void 0) return;
|
160246
|
+
const nodeId = getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier || getNodeId(info.token) : info.token.text);
|
160247
|
+
if (!addToSeen(seen, nodeId)) return;
|
159399
160248
|
if (fixId56 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
159400
160249
|
addFunctionDeclaration(changes, context, info);
|
159401
160250
|
} else if (fixId56 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
@@ -159439,7 +160288,7 @@ registerCodeFix({
|
|
159439
160288
|
}
|
159440
160289
|
});
|
159441
160290
|
function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
159442
|
-
var _a, _b
|
160291
|
+
var _a, _b;
|
159443
160292
|
const token = getTokenAtPosition(sourceFile, tokenPos);
|
159444
160293
|
const parent2 = token.parent;
|
159445
160294
|
if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) {
|
@@ -159461,23 +160310,25 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
|
159461
160310
|
if (!length(properties)) return void 0;
|
159462
160311
|
return { kind: 3 /* ObjectLiteral */, token: param.name, identifier: param.name.text, properties, parentDeclaration: parent2 };
|
159463
160312
|
}
|
159464
|
-
if (token.kind === 19 /* OpenBraceToken */
|
159465
|
-
const
|
159466
|
-
|
159467
|
-
checker.
|
159468
|
-
|
159469
|
-
|
159470
|
-
|
159471
|
-
|
159472
|
-
|
159473
|
-
|
159474
|
-
|
159475
|
-
|
159476
|
-
|
160313
|
+
if (token.kind === 19 /* OpenBraceToken */ || isSatisfiesExpression(parent2) || isReturnStatement(parent2)) {
|
160314
|
+
const expression = (isSatisfiesExpression(parent2) || isReturnStatement(parent2)) && parent2.expression ? parent2.expression : parent2;
|
160315
|
+
if (isObjectLiteralExpression(expression)) {
|
160316
|
+
const targetType = isSatisfiesExpression(parent2) ? checker.getTypeFromTypeNode(parent2.type) : checker.getContextualType(expression) || checker.getTypeAtLocation(expression);
|
160317
|
+
const properties = arrayFrom(checker.getUnmatchedProperties(
|
160318
|
+
checker.getTypeAtLocation(parent2),
|
160319
|
+
targetType.getNonNullableType(),
|
160320
|
+
/*requireOptionalProperties*/
|
160321
|
+
false,
|
160322
|
+
/*matchDiscriminantProperties*/
|
160323
|
+
false
|
160324
|
+
));
|
160325
|
+
if (!length(properties)) return void 0;
|
160326
|
+
return { kind: 3 /* ObjectLiteral */, token: parent2, identifier: void 0, properties, parentDeclaration: expression, indentation: isReturnStatement(expression.parent) || isYieldExpression(expression.parent) ? 0 : void 0 };
|
160327
|
+
}
|
159477
160328
|
}
|
159478
160329
|
if (!isMemberName(token)) return void 0;
|
159479
160330
|
if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
|
159480
|
-
const targetType = (
|
160331
|
+
const targetType = (_a = checker.getContextualType(token) || checker.getTypeAtLocation(token)) == null ? void 0 : _a.getNonNullableType();
|
159481
160332
|
const properties = arrayFrom(checker.getUnmatchedProperties(
|
159482
160333
|
checker.getTypeAtLocation(parent2.initializer),
|
159483
160334
|
targetType,
|
@@ -159496,7 +160347,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
|
|
159496
160347
|
return { kind: 4 /* JsxAttributes */, token, attributes, parentDeclaration: token.parent };
|
159497
160348
|
}
|
159498
160349
|
if (isIdentifier(token)) {
|
159499
|
-
const type = (
|
160350
|
+
const type = (_b = checker.getContextualType(token)) == null ? void 0 : _b.getNonNullableType();
|
159500
160351
|
if (type && getObjectFlags(type) & 16 /* Anonymous */) {
|
159501
160352
|
const signature = firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
159502
160353
|
if (signature === void 0) return void 0;
|
@@ -160499,9 +161350,9 @@ function getSuggestion(messageText) {
|
|
160499
161350
|
// src/services/codefixes/fixModuleAndTargetOptions.ts
|
160500
161351
|
registerCodeFix({
|
160501
161352
|
errorCodes: [
|
160502
|
-
Diagnostics.
|
160503
|
-
Diagnostics.
|
160504
|
-
Diagnostics.
|
161353
|
+
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code,
|
161354
|
+
Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code,
|
161355
|
+
Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code
|
160505
161356
|
],
|
160506
161357
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
160507
161358
|
const compilerOptions = context.program.getCompilerOptions();
|
@@ -160970,6 +161821,8 @@ registerCodeFix({
|
|
160970
161821
|
break;
|
160971
161822
|
} else if (canDeleteEntireVariableStatement(sourceFile, token)) {
|
160972
161823
|
deleteEntireVariableStatement(changes, sourceFile, token.parent);
|
161824
|
+
} else if (isIdentifier(token) && isFunctionDeclaration(token.parent)) {
|
161825
|
+
deleteFunctionLikeDeclaration(changes, sourceFile, token.parent);
|
160973
161826
|
} else {
|
160974
161827
|
tryDeleteDeclaration(
|
160975
161828
|
sourceFile,
|
@@ -163937,12 +164790,10 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
|
|
163937
164790
|
return typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget);
|
163938
164791
|
}
|
163939
164792
|
function typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget) {
|
163940
|
-
|
163941
|
-
|
163942
|
-
|
163943
|
-
|
163944
|
-
typeNode = importableReference.typeNode;
|
163945
|
-
}
|
164793
|
+
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
|
164794
|
+
if (importableReference) {
|
164795
|
+
importSymbols(importAdder, importableReference.symbols);
|
164796
|
+
typeNode = importableReference.typeNode;
|
163946
164797
|
}
|
163947
164798
|
return getSynthesizedDeepClone(typeNode);
|
163948
164799
|
}
|
@@ -172461,7 +173312,7 @@ var Core;
|
|
172461
173312
|
} else {
|
172462
173313
|
addIfImplementation(body);
|
172463
173314
|
}
|
172464
|
-
} else if (isAssertionExpression(typeHavingNode)) {
|
173315
|
+
} else if (isAssertionExpression(typeHavingNode) || isSatisfiesExpression(typeHavingNode)) {
|
172465
173316
|
addIfImplementation(typeHavingNode.expression);
|
172466
173317
|
}
|
172467
173318
|
}
|
@@ -172900,7 +173751,10 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
172900
173751
|
const { parent: parent2 } = node;
|
172901
173752
|
const typeChecker = program.getTypeChecker();
|
172902
173753
|
if (node.kind === 164 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) {
|
172903
|
-
|
173754
|
+
const def = getDefinitionFromOverriddenMember(typeChecker, node);
|
173755
|
+
if (def !== void 0 || node.kind !== 164 /* OverrideKeyword */) {
|
173756
|
+
return def || emptyArray;
|
173757
|
+
}
|
172904
173758
|
}
|
172905
173759
|
if (isJumpStatementTarget(node)) {
|
172906
173760
|
const label = getTargetLabel(node.parent, node.text);
|
@@ -172914,9 +173768,6 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
172914
173768
|
)] : void 0;
|
172915
173769
|
}
|
172916
173770
|
switch (node.kind) {
|
172917
|
-
case 107 /* ReturnKeyword */:
|
172918
|
-
const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
|
172919
|
-
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
172920
173771
|
case 90 /* DefaultKeyword */:
|
172921
173772
|
if (!isDefaultClause(node.parent)) {
|
172922
173773
|
break;
|
@@ -172929,15 +173780,14 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
172929
173780
|
}
|
172930
173781
|
break;
|
172931
173782
|
}
|
172932
|
-
|
172933
|
-
|
172934
|
-
|
172935
|
-
|
172936
|
-
|
172937
|
-
|
172938
|
-
|
172939
|
-
|
172940
|
-
return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
173783
|
+
let findFunctionDecl;
|
173784
|
+
switch (node.kind) {
|
173785
|
+
case 107 /* ReturnKeyword */:
|
173786
|
+
case 135 /* AwaitKeyword */:
|
173787
|
+
case 127 /* YieldKeyword */:
|
173788
|
+
findFunctionDecl = isFunctionLikeDeclaration;
|
173789
|
+
const functionDeclaration = findAncestor(node, findFunctionDecl);
|
173790
|
+
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
172941
173791
|
}
|
172942
173792
|
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
|
172943
173793
|
const classDecl = node.parent.parent;
|
@@ -172987,6 +173837,9 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
172987
173837
|
}];
|
172988
173838
|
}
|
172989
173839
|
}
|
173840
|
+
if (isModifier(node) && (isClassElement(parent2) || isNamedDeclaration(parent2))) {
|
173841
|
+
symbol = parent2.symbol;
|
173842
|
+
}
|
172990
173843
|
if (!symbol) {
|
172991
173844
|
return concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
|
172992
173845
|
}
|
@@ -173183,12 +174036,16 @@ function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
|
173183
174036
|
false
|
173184
174037
|
);
|
173185
174038
|
}
|
173186
|
-
|
174039
|
+
let { symbol, failedAliasResolution } = getSymbol(
|
173187
174040
|
node,
|
173188
174041
|
typeChecker,
|
173189
174042
|
/*stopAtAlias*/
|
173190
174043
|
false
|
173191
174044
|
);
|
174045
|
+
if (isModifier(node) && (isClassElement(node.parent) || isNamedDeclaration(node.parent))) {
|
174046
|
+
symbol = node.parent.symbol;
|
174047
|
+
failedAliasResolution = false;
|
174048
|
+
}
|
173192
174049
|
if (!symbol) return void 0;
|
173193
174050
|
const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
173194
174051
|
const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
@@ -173693,22 +174550,24 @@ function provideInlayHints(context) {
|
|
173693
174550
|
if (!signature) {
|
173694
174551
|
return;
|
173695
174552
|
}
|
173696
|
-
|
173697
|
-
|
173698
|
-
if (
|
173699
|
-
|
173700
|
-
}
|
173701
|
-
const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(param);
|
173702
|
-
if (effectiveTypeAnnotation) {
|
173703
|
-
continue;
|
174553
|
+
let pos = 0;
|
174554
|
+
for (const param of node.parameters) {
|
174555
|
+
if (isHintableDeclaration(param)) {
|
174556
|
+
addParameterTypeHint(param, parameterIsThisKeyword(param) ? signature.thisParameter : signature.parameters[pos]);
|
173704
174557
|
}
|
173705
|
-
|
173706
|
-
if (!typeHints) {
|
174558
|
+
if (parameterIsThisKeyword(param)) {
|
173707
174559
|
continue;
|
173708
174560
|
}
|
173709
|
-
|
174561
|
+
pos++;
|
173710
174562
|
}
|
173711
174563
|
}
|
174564
|
+
function addParameterTypeHint(node, symbol) {
|
174565
|
+
const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(node);
|
174566
|
+
if (effectiveTypeAnnotation || symbol === void 0) return;
|
174567
|
+
const typeHints = getParameterDeclarationTypeHints(symbol);
|
174568
|
+
if (typeHints === void 0) return;
|
174569
|
+
addTypeHints(typeHints, node.questionToken ? node.questionToken.end : node.name.end);
|
174570
|
+
}
|
173712
174571
|
function getParameterDeclarationTypeHints(symbol) {
|
173713
174572
|
const valueDeclaration = symbol.valueDeclaration;
|
173714
174573
|
if (!valueDeclaration || !isParameter(valueDeclaration)) {
|
@@ -176874,7 +177733,7 @@ function getSymbolModifiers(typeChecker, symbol) {
|
|
176874
177733
|
}
|
176875
177734
|
return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
|
176876
177735
|
}
|
176877
|
-
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
|
177736
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias, verbosityLevel) {
|
176878
177737
|
var _a;
|
176879
177738
|
const displayParts = [];
|
176880
177739
|
let documentation = [];
|
@@ -176886,6 +177745,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
176886
177745
|
let documentationFromAlias;
|
176887
177746
|
let tagsFromAlias;
|
176888
177747
|
let hasMultipleSignatures = false;
|
177748
|
+
const typeWriterOut = verbosityLevel !== void 0 ? { couldUnfoldMore: false } : void 0;
|
176889
177749
|
if (location.kind === 110 /* ThisKeyword */ && !isThisExpression) {
|
176890
177750
|
return { displayParts: [keywordPart(110 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: void 0 };
|
176891
177751
|
}
|
@@ -177045,7 +177905,17 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177045
177905
|
displayParts.push(spacePart());
|
177046
177906
|
displayParts.push(operatorPart(64 /* EqualsToken */));
|
177047
177907
|
displayParts.push(spacePart());
|
177048
|
-
addRange(
|
177908
|
+
addRange(
|
177909
|
+
displayParts,
|
177910
|
+
typeToDisplayParts(
|
177911
|
+
typeChecker,
|
177912
|
+
location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol),
|
177913
|
+
enclosingDeclaration,
|
177914
|
+
8388608 /* InTypeAlias */,
|
177915
|
+
verbosityLevel,
|
177916
|
+
typeWriterOut
|
177917
|
+
)
|
177918
|
+
);
|
177049
177919
|
}
|
177050
177920
|
if (symbolFlags & 384 /* Enum */) {
|
177051
177921
|
prefixNextMeaning();
|
@@ -177204,12 +178074,32 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177204
178074
|
displayParts.push(spacePart());
|
177205
178075
|
if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */ && symbolKind !== "index" /* indexSignatureElement */) {
|
177206
178076
|
const typeParameterParts = mapToDisplayParts((writer) => {
|
177207
|
-
const param = typeChecker.typeParameterToDeclaration(
|
178077
|
+
const param = typeChecker.typeParameterToDeclaration(
|
178078
|
+
type,
|
178079
|
+
enclosingDeclaration,
|
178080
|
+
symbolDisplayNodeBuilderFlags,
|
178081
|
+
/*internalFlags*/
|
178082
|
+
void 0,
|
178083
|
+
/*tracker*/
|
178084
|
+
void 0,
|
178085
|
+
verbosityLevel
|
178086
|
+
);
|
177208
178087
|
getPrinter().writeNode(4 /* Unspecified */, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
|
177209
178088
|
});
|
177210
178089
|
addRange(displayParts, typeParameterParts);
|
177211
178090
|
} else {
|
177212
|
-
addRange(
|
178091
|
+
addRange(
|
178092
|
+
displayParts,
|
178093
|
+
typeToDisplayParts(
|
178094
|
+
typeChecker,
|
178095
|
+
type,
|
178096
|
+
enclosingDeclaration,
|
178097
|
+
/*flags*/
|
178098
|
+
void 0,
|
178099
|
+
verbosityLevel,
|
178100
|
+
typeWriterOut
|
178101
|
+
)
|
178102
|
+
);
|
177213
178103
|
}
|
177214
178104
|
if (isTransientSymbol(symbol) && symbol.links.target && isTransientSymbol(symbol.links.target) && symbol.links.target.links.tupleLabelDeclaration) {
|
177215
178105
|
const labelDecl = symbol.links.target.links.tupleLabelDeclaration;
|
@@ -177274,7 +178164,13 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177274
178164
|
if (tags.length === 0 && tagsFromAlias) {
|
177275
178165
|
tags = tagsFromAlias;
|
177276
178166
|
}
|
177277
|
-
return {
|
178167
|
+
return {
|
178168
|
+
displayParts,
|
178169
|
+
documentation,
|
178170
|
+
symbolKind,
|
178171
|
+
tags: tags.length === 0 ? void 0 : tags,
|
178172
|
+
canIncreaseVerbosityLevel: typeWriterOut == null ? void 0 : typeWriterOut.couldUnfoldMore
|
178173
|
+
};
|
177278
178174
|
function getPrinter() {
|
177279
178175
|
return createPrinterWithRemoveComments();
|
177280
178176
|
}
|
@@ -177387,7 +178283,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177387
178283
|
addRange(displayParts, typeParameterParts);
|
177388
178284
|
}
|
177389
178285
|
}
|
177390
|
-
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
|
178286
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias, verbosityLevel) {
|
177391
178287
|
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
177392
178288
|
typeChecker,
|
177393
178289
|
symbol,
|
@@ -177397,7 +178293,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
177397
178293
|
/*type*/
|
177398
178294
|
void 0,
|
177399
178295
|
semanticMeaning,
|
177400
|
-
alias
|
178296
|
+
alias,
|
178297
|
+
verbosityLevel
|
177401
178298
|
);
|
177402
178299
|
}
|
177403
178300
|
function isLocalVariableOrFunction(symbol) {
|
@@ -182067,6 +182964,7 @@ __export(ts_exports2, {
|
|
182067
182964
|
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
|
182068
182965
|
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
182069
182966
|
createProgram: () => createProgram,
|
182967
|
+
createProgramDiagnostics: () => createProgramDiagnostics,
|
182070
182968
|
createProgramHost: () => createProgramHost,
|
182071
182969
|
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
|
182072
182970
|
createQueue: () => createQueue,
|
@@ -182236,6 +183134,8 @@ __export(ts_exports2, {
|
|
182236
183134
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
182237
183135
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
182238
183136
|
forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
|
183137
|
+
forEachOptionsSyntaxByName: () => forEachOptionsSyntaxByName,
|
183138
|
+
forEachProjectReference: () => forEachProjectReference,
|
182239
183139
|
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
182240
183140
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
182241
183141
|
forEachReturnStatement: () => forEachReturnStatement,
|
@@ -182475,6 +183375,8 @@ __export(ts_exports2, {
|
|
182475
183375
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
182476
183376
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
182477
183377
|
getLeftmostExpression: () => getLeftmostExpression,
|
183378
|
+
getLibFileNameFromLibReference: () => getLibFileNameFromLibReference,
|
183379
|
+
getLibNameFromLibReference: () => getLibNameFromLibReference,
|
182478
183380
|
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
182479
183381
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
182480
183382
|
getLineInfo: () => getLineInfo,
|
@@ -182547,6 +183449,8 @@ __export(ts_exports2, {
|
|
182547
183449
|
getOptionFromName: () => getOptionFromName,
|
182548
183450
|
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
182549
183451
|
getOptionsNameMap: () => getOptionsNameMap,
|
183452
|
+
getOptionsSyntaxByArrayElementValue: () => getOptionsSyntaxByArrayElementValue,
|
183453
|
+
getOptionsSyntaxByValue: () => getOptionsSyntaxByValue,
|
182550
183454
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
182551
183455
|
getOrUpdate: () => getOrUpdate,
|
182552
183456
|
getOriginalNode: () => getOriginalNode,
|
@@ -182583,7 +183487,6 @@ __export(ts_exports2, {
|
|
182583
183487
|
getPrivateIdentifier: () => getPrivateIdentifier,
|
182584
183488
|
getProperties: () => getProperties,
|
182585
183489
|
getProperty: () => getProperty,
|
182586
|
-
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
|
182587
183490
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
182588
183491
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
182589
183492
|
getPropertyNameFromType: () => getPropertyNameFromType,
|
@@ -183494,6 +184397,7 @@ __export(ts_exports2, {
|
|
183494
184397
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
183495
184398
|
moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
|
183496
184399
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
184400
|
+
moduleSupportsImportAttributes: () => moduleSupportsImportAttributes,
|
183497
184401
|
moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
|
183498
184402
|
moveEmitHelpers: () => moveEmitHelpers,
|
183499
184403
|
moveRangeEnd: () => moveRangeEnd,
|
@@ -184868,6 +185772,7 @@ var ModuleKind2 = /* @__PURE__ */ ((ModuleKind3) => {
|
|
184868
185772
|
ModuleKind3["ES2022"] = "es2022";
|
184869
185773
|
ModuleKind3["ESNext"] = "esnext";
|
184870
185774
|
ModuleKind3["Node16"] = "node16";
|
185775
|
+
ModuleKind3["Node18"] = "node18";
|
184871
185776
|
ModuleKind3["NodeNext"] = "nodenext";
|
184872
185777
|
ModuleKind3["Preserve"] = "preserve";
|
184873
185778
|
return ModuleKind3;
|
@@ -194339,7 +195244,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
194339
195244
|
getQuickInfoWorker(args, simplifiedResult) {
|
194340
195245
|
const { file, project } = this.getFileAndProject(args);
|
194341
195246
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
194342
|
-
const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo));
|
195247
|
+
const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo), args.verbosityLevel);
|
194343
195248
|
if (!quickInfo) {
|
194344
195249
|
return void 0;
|
194345
195250
|
}
|
@@ -194353,7 +195258,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
194353
195258
|
end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)),
|
194354
195259
|
displayString,
|
194355
195260
|
documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation),
|
194356
|
-
tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts)
|
195261
|
+
tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts),
|
195262
|
+
canIncreaseVerbosityLevel: quickInfo.canIncreaseVerbosityLevel
|
194357
195263
|
};
|
194358
195264
|
} else {
|
194359
195265
|
return useDisplayParts ? quickInfo : {
|
@@ -194897,20 +195803,19 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
194897
195803
|
try {
|
194898
195804
|
codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getPreferences(file));
|
194899
195805
|
} catch (e) {
|
195806
|
+
const error2 = e instanceof Error ? e : new Error(e);
|
194900
195807
|
const ls = project.getLanguageService();
|
194901
195808
|
const existingDiagCodes = [
|
194902
195809
|
...ls.getSyntacticDiagnostics(file),
|
194903
195810
|
...ls.getSemanticDiagnostics(file),
|
194904
195811
|
...ls.getSuggestionDiagnostics(file)
|
194905
|
-
].map(
|
194906
|
-
(d) => decodedTextSpanIntersectsWith(startPosition, endPosition - startPosition, d.start, d.length) && d.code
|
194907
|
-
);
|
195812
|
+
].filter((d) => decodedTextSpanIntersectsWith(startPosition, endPosition - startPosition, d.start, d.length)).map((d) => d.code);
|
194908
195813
|
const badCode = args.errorCodes.find((c) => !existingDiagCodes.includes(c));
|
194909
195814
|
if (badCode !== void 0) {
|
194910
|
-
|
194911
|
-
${
|
195815
|
+
error2.message += `
|
195816
|
+
Additional information: BADCLIENT: Bad error code, ${badCode} not found in range ${startPosition}..${endPosition} (found: ${existingDiagCodes.join(", ")})`;
|
194912
195817
|
}
|
194913
|
-
throw
|
195818
|
+
throw error2;
|
194914
195819
|
}
|
194915
195820
|
return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
|
194916
195821
|
}
|
@@ -196813,6 +197718,7 @@ if (typeof console !== "undefined") {
|
|
196813
197718
|
createPrinterWithRemoveCommentsNeverAsciiEscape,
|
196814
197719
|
createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
196815
197720
|
createProgram,
|
197721
|
+
createProgramDiagnostics,
|
196816
197722
|
createProgramHost,
|
196817
197723
|
createPropertyNameNodeForIdentifierOrLiteral,
|
196818
197724
|
createQueue,
|
@@ -196982,6 +197888,8 @@ if (typeof console !== "undefined") {
|
|
196982
197888
|
forEachLeadingCommentRange,
|
196983
197889
|
forEachNameInAccessChainWalkingLeft,
|
196984
197890
|
forEachNameOfDefaultExport,
|
197891
|
+
forEachOptionsSyntaxByName,
|
197892
|
+
forEachProjectReference,
|
196985
197893
|
forEachPropertyAssignment,
|
196986
197894
|
forEachResolvedProjectReference,
|
196987
197895
|
forEachReturnStatement,
|
@@ -197221,6 +198129,8 @@ if (typeof console !== "undefined") {
|
|
197221
198129
|
getLeadingCommentRangesOfNode,
|
197222
198130
|
getLeftmostAccessExpression,
|
197223
198131
|
getLeftmostExpression,
|
198132
|
+
getLibFileNameFromLibReference,
|
198133
|
+
getLibNameFromLibReference,
|
197224
198134
|
getLibraryNameFromLibFileName,
|
197225
198135
|
getLineAndCharacterOfPosition,
|
197226
198136
|
getLineInfo,
|
@@ -197293,6 +198203,8 @@ if (typeof console !== "undefined") {
|
|
197293
198203
|
getOptionFromName,
|
197294
198204
|
getOptionsForLibraryResolution,
|
197295
198205
|
getOptionsNameMap,
|
198206
|
+
getOptionsSyntaxByArrayElementValue,
|
198207
|
+
getOptionsSyntaxByValue,
|
197296
198208
|
getOrCreateEmitNode,
|
197297
198209
|
getOrUpdate,
|
197298
198210
|
getOriginalNode,
|
@@ -197329,7 +198241,6 @@ if (typeof console !== "undefined") {
|
|
197329
198241
|
getPrivateIdentifier,
|
197330
198242
|
getProperties,
|
197331
198243
|
getProperty,
|
197332
|
-
getPropertyArrayElementValue,
|
197333
198244
|
getPropertyAssignmentAliasLikeExpression,
|
197334
198245
|
getPropertyNameForPropertyNameNode,
|
197335
198246
|
getPropertyNameFromType,
|
@@ -198240,6 +199151,7 @@ if (typeof console !== "undefined") {
|
|
198240
199151
|
moduleResolutionUsesNodeModules,
|
198241
199152
|
moduleSpecifierToValidIdentifier,
|
198242
199153
|
moduleSpecifiers,
|
199154
|
+
moduleSupportsImportAttributes,
|
198243
199155
|
moduleSymbolToValidIdentifier,
|
198244
199156
|
moveEmitHelpers,
|
198245
199157
|
moveRangeEnd,
|