typescript 5.7.3 → 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 +1336 -532
- 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 +1515 -616
- 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/_tsc.js
CHANGED
@@ -17,8 +17,8 @@ and limitations under the License.
|
|
17
17
|
"use strict";
|
18
18
|
|
19
19
|
// src/compiler/corePublic.ts
|
20
|
-
var versionMajorMinor = "5.
|
21
|
-
var version = "5.
|
20
|
+
var versionMajorMinor = "5.8";
|
21
|
+
var version = "5.8.0-beta";
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -3680,6 +3680,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
3680
3680
|
ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
|
3681
3681
|
ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
|
3682
3682
|
ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType";
|
3683
|
+
ObjectFlags3[ObjectFlags3["IsNarrowingType"] = 16777216] = "IsNarrowingType";
|
3683
3684
|
ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections";
|
3684
3685
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
|
3685
3686
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
@@ -3733,6 +3734,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
|
|
3733
3734
|
ModuleKind2[ModuleKind2["ES2022"] = 7] = "ES2022";
|
3734
3735
|
ModuleKind2[ModuleKind2["ESNext"] = 99] = "ESNext";
|
3735
3736
|
ModuleKind2[ModuleKind2["Node16"] = 100] = "Node16";
|
3737
|
+
ModuleKind2[ModuleKind2["Node18"] = 101] = "Node18";
|
3736
3738
|
ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
|
3737
3739
|
ModuleKind2[ModuleKind2["Preserve"] = 200] = "Preserve";
|
3738
3740
|
return ModuleKind2;
|
@@ -5499,23 +5501,105 @@ function resolvePath(path, ...paths) {
|
|
5499
5501
|
function getNormalizedPathComponents(path, currentDirectory) {
|
5500
5502
|
return reducePathComponents(getPathComponents(path, currentDirectory));
|
5501
5503
|
}
|
5502
|
-
function getNormalizedAbsolutePath(
|
5503
|
-
|
5504
|
+
function getNormalizedAbsolutePath(path, currentDirectory) {
|
5505
|
+
let rootLength = getRootLength(path);
|
5506
|
+
if (rootLength === 0 && currentDirectory) {
|
5507
|
+
path = combinePaths(currentDirectory, path);
|
5508
|
+
rootLength = getRootLength(path);
|
5509
|
+
} else {
|
5510
|
+
path = normalizeSlashes(path);
|
5511
|
+
}
|
5512
|
+
const simpleNormalized = simpleNormalizePath(path);
|
5513
|
+
if (simpleNormalized !== void 0) {
|
5514
|
+
return simpleNormalized.length > rootLength ? removeTrailingDirectorySeparator(simpleNormalized) : simpleNormalized;
|
5515
|
+
}
|
5516
|
+
const length2 = path.length;
|
5517
|
+
const root = path.substring(0, rootLength);
|
5518
|
+
let normalized;
|
5519
|
+
let index = rootLength;
|
5520
|
+
let segmentStart = index;
|
5521
|
+
let normalizedUpTo = index;
|
5522
|
+
let seenNonDotDotSegment = rootLength !== 0;
|
5523
|
+
while (index < length2) {
|
5524
|
+
segmentStart = index;
|
5525
|
+
let ch = path.charCodeAt(index);
|
5526
|
+
while (ch === 47 /* slash */ && index + 1 < length2) {
|
5527
|
+
index++;
|
5528
|
+
ch = path.charCodeAt(index);
|
5529
|
+
}
|
5530
|
+
if (index > segmentStart) {
|
5531
|
+
normalized ?? (normalized = path.substring(0, segmentStart - 1));
|
5532
|
+
segmentStart = index;
|
5533
|
+
}
|
5534
|
+
let segmentEnd = path.indexOf(directorySeparator, index + 1);
|
5535
|
+
if (segmentEnd === -1) {
|
5536
|
+
segmentEnd = length2;
|
5537
|
+
}
|
5538
|
+
const segmentLength = segmentEnd - segmentStart;
|
5539
|
+
if (segmentLength === 1 && path.charCodeAt(index) === 46 /* dot */) {
|
5540
|
+
normalized ?? (normalized = path.substring(0, normalizedUpTo));
|
5541
|
+
} else if (segmentLength === 2 && path.charCodeAt(index) === 46 /* dot */ && path.charCodeAt(index + 1) === 46 /* dot */) {
|
5542
|
+
if (!seenNonDotDotSegment) {
|
5543
|
+
if (normalized !== void 0) {
|
5544
|
+
normalized += normalized.length === rootLength ? ".." : "/..";
|
5545
|
+
} else {
|
5546
|
+
normalizedUpTo = index + 2;
|
5547
|
+
}
|
5548
|
+
} else if (normalized === void 0) {
|
5549
|
+
if (normalizedUpTo - 2 >= 0) {
|
5550
|
+
normalized = path.substring(0, Math.max(rootLength, path.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
|
5551
|
+
} else {
|
5552
|
+
normalized = path.substring(0, normalizedUpTo);
|
5553
|
+
}
|
5554
|
+
} else {
|
5555
|
+
const lastSlash = normalized.lastIndexOf(directorySeparator);
|
5556
|
+
if (lastSlash !== -1) {
|
5557
|
+
normalized = normalized.substring(0, Math.max(rootLength, lastSlash));
|
5558
|
+
} else {
|
5559
|
+
normalized = root;
|
5560
|
+
}
|
5561
|
+
if (normalized.length === rootLength) {
|
5562
|
+
seenNonDotDotSegment = rootLength !== 0;
|
5563
|
+
}
|
5564
|
+
}
|
5565
|
+
} else if (normalized !== void 0) {
|
5566
|
+
if (normalized.length !== rootLength) {
|
5567
|
+
normalized += directorySeparator;
|
5568
|
+
}
|
5569
|
+
seenNonDotDotSegment = true;
|
5570
|
+
normalized += path.substring(segmentStart, segmentEnd);
|
5571
|
+
} else {
|
5572
|
+
seenNonDotDotSegment = true;
|
5573
|
+
normalizedUpTo = segmentEnd;
|
5574
|
+
}
|
5575
|
+
index = segmentEnd + 1;
|
5576
|
+
}
|
5577
|
+
return normalized ?? (length2 > rootLength ? removeTrailingDirectorySeparator(path) : path);
|
5504
5578
|
}
|
5505
5579
|
function normalizePath(path) {
|
5506
5580
|
path = normalizeSlashes(path);
|
5581
|
+
let normalized = simpleNormalizePath(path);
|
5582
|
+
if (normalized !== void 0) {
|
5583
|
+
return normalized;
|
5584
|
+
}
|
5585
|
+
normalized = getNormalizedAbsolutePath(path, "");
|
5586
|
+
return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
5587
|
+
}
|
5588
|
+
function simpleNormalizePath(path) {
|
5507
5589
|
if (!relativePathSegmentRegExp.test(path)) {
|
5508
5590
|
return path;
|
5509
5591
|
}
|
5510
|
-
|
5592
|
+
let simplified = path.replace(/\/\.\//g, "/");
|
5593
|
+
if (simplified.startsWith("./")) {
|
5594
|
+
simplified = simplified.slice(2);
|
5595
|
+
}
|
5511
5596
|
if (simplified !== path) {
|
5512
5597
|
path = simplified;
|
5513
5598
|
if (!relativePathSegmentRegExp.test(path)) {
|
5514
5599
|
return path;
|
5515
5600
|
}
|
5516
5601
|
}
|
5517
|
-
|
5518
|
-
return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
5602
|
+
return void 0;
|
5519
5603
|
}
|
5520
5604
|
function getPathWithoutRoot(pathComponents2) {
|
5521
5605
|
if (pathComponents2.length === 0) return "";
|
@@ -5937,6 +6021,7 @@ var Diagnostics = {
|
|
5937
6021
|
_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."),
|
5938
6022
|
_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 }'."),
|
5939
6023
|
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'."),
|
6024
|
+
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."),
|
5940
6025
|
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."),
|
5941
6026
|
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."),
|
5942
6027
|
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."),
|
@@ -5951,8 +6036,8 @@ var Diagnostics = {
|
|
5951
6036
|
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."),
|
5952
6037
|
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."),
|
5953
6038
|
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."),
|
5954
|
-
|
5955
|
-
|
6039
|
+
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'."),
|
6040
|
+
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'."),
|
5956
6041
|
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."),
|
5957
6042
|
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."),
|
5958
6043
|
String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
@@ -5969,7 +6054,7 @@ var Diagnostics = {
|
|
5969
6054
|
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."),
|
5970
6055
|
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}')'?"),
|
5971
6056
|
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."),
|
5972
|
-
|
6057
|
+
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'."),
|
5973
6058
|
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
5974
6059
|
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."),
|
5975
6060
|
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."),
|
@@ -5999,7 +6084,7 @@ var Diagnostics = {
|
|
5999
6084
|
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."),
|
6000
6085
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
6001
6086
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
6002
|
-
|
6087
|
+
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."),
|
6003
6088
|
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'."),
|
6004
6089
|
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'."),
|
6005
6090
|
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 `}`?"),
|
@@ -6050,7 +6135,7 @@ var Diagnostics = {
|
|
6050
6135
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
6051
6136
|
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:"),
|
6052
6137
|
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."),
|
6053
|
-
|
6138
|
+
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."),
|
6054
6139
|
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."),
|
6055
6140
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
6056
6141
|
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}'?"),
|
@@ -6692,9 +6777,9 @@ var Diagnostics = {
|
|
6692
6777
|
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."),
|
6693
6778
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
6694
6779
|
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}'?"),
|
6695
|
-
|
6780
|
+
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'."),
|
6696
6781
|
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."),
|
6697
|
-
|
6782
|
+
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'."),
|
6698
6783
|
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}'?"),
|
6699
6784
|
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."),
|
6700
6785
|
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}'?"),
|
@@ -6714,7 +6799,7 @@ var Diagnostics = {
|
|
6714
6799
|
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'."),
|
6715
6800
|
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."),
|
6716
6801
|
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."),
|
6717
|
-
|
6802
|
+
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."),
|
6718
6803
|
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."),
|
6719
6804
|
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."),
|
6720
6805
|
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."),
|
@@ -6740,6 +6825,7 @@ var Diagnostics = {
|
|
6740
6825
|
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."),
|
6741
6826
|
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."),
|
6742
6827
|
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."),
|
6828
|
+
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'."),
|
6743
6829
|
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}'."),
|
6744
6830
|
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}'."),
|
6745
6831
|
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}'."),
|
@@ -6849,6 +6935,8 @@ var Diagnostics = {
|
|
6849
6935
|
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'."),
|
6850
6936
|
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."),
|
6851
6937
|
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."),
|
6938
|
+
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."),
|
6939
|
+
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."),
|
6852
6940
|
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."),
|
6853
6941
|
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."),
|
6854
6942
|
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}'."),
|
@@ -7421,11 +7509,13 @@ var Diagnostics = {
|
|
7421
7509
|
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."),
|
7422
7510
|
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."),
|
7423
7511
|
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'."),
|
7512
|
+
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."),
|
7424
7513
|
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'."),
|
7425
7514
|
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."),
|
7426
7515
|
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)."),
|
7427
7516
|
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
7428
7517
|
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}`."),
|
7518
|
+
Enable_lib_replacement: diag(6808, 3 /* Message */, "Enable_lib_replacement_6808", "Enable lib replacement."),
|
7429
7519
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
7430
7520
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
7431
7521
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
@@ -13150,6 +13240,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
13150
13240
|
"trunc",
|
13151
13241
|
"fround",
|
13152
13242
|
"cbrt"
|
13243
|
+
],
|
13244
|
+
esnext: [
|
13245
|
+
"f16round"
|
13153
13246
|
]
|
13154
13247
|
})),
|
13155
13248
|
Map: new Map(Object.entries({
|
@@ -13319,6 +13412,10 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
13319
13412
|
"setBigUint64",
|
13320
13413
|
"getBigInt64",
|
13321
13414
|
"getBigUint64"
|
13415
|
+
],
|
13416
|
+
esnext: [
|
13417
|
+
"setFloat16",
|
13418
|
+
"getFloat16"
|
13322
13419
|
]
|
13323
13420
|
})),
|
13324
13421
|
BigInt: new Map(Object.entries({
|
@@ -13422,6 +13519,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
13422
13519
|
"with"
|
13423
13520
|
]
|
13424
13521
|
})),
|
13522
|
+
Float16Array: new Map(Object.entries({
|
13523
|
+
esnext: emptyArray
|
13524
|
+
})),
|
13425
13525
|
Float32Array: new Map(Object.entries({
|
13426
13526
|
es2022: [
|
13427
13527
|
"at"
|
@@ -13590,7 +13690,7 @@ function getNonAugmentationDeclaration(symbol) {
|
|
13590
13690
|
return (_a = symbol.declarations) == null ? void 0 : _a.find((d) => !isExternalModuleAugmentation(d) && !(isModuleDeclaration(d) && isGlobalScopeAugmentation(d)));
|
13591
13691
|
}
|
13592
13692
|
function isCommonJSContainingModuleKind(kind) {
|
13593
|
-
return kind === 1 /* CommonJS */ ||
|
13693
|
+
return kind === 1 /* CommonJS */ || 100 /* Node16 */ <= kind && kind <= 199 /* NodeNext */;
|
13594
13694
|
}
|
13595
13695
|
function isEffectiveExternalModule(node, compilerOptions) {
|
13596
13696
|
return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
@@ -14258,9 +14358,6 @@ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
14258
14358
|
return key === propName || key2 && key2 === propName ? callback(property) : void 0;
|
14259
14359
|
});
|
14260
14360
|
}
|
14261
|
-
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
14262
|
-
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
14263
|
-
}
|
14264
14361
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
14265
14362
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
14266
14363
|
const expression = tsConfigSourceFile.statements[0].expression;
|
@@ -17818,7 +17915,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
17818
17915
|
dependencies: ["module"],
|
17819
17916
|
computeValue: (compilerOptions) => {
|
17820
17917
|
const target = compilerOptions.target === 0 /* ES3 */ ? void 0 : compilerOptions.target;
|
17821
|
-
return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
17918
|
+
return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 101 /* Node18 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
17822
17919
|
}
|
17823
17920
|
},
|
17824
17921
|
module: {
|
@@ -17837,6 +17934,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
17837
17934
|
moduleResolution = 2 /* Node10 */;
|
17838
17935
|
break;
|
17839
17936
|
case 100 /* Node16 */:
|
17937
|
+
case 101 /* Node18 */:
|
17840
17938
|
moduleResolution = 3 /* Node16 */;
|
17841
17939
|
break;
|
17842
17940
|
case 199 /* NodeNext */:
|
@@ -17856,7 +17954,11 @@ var _computedOptions = createComputedCompilerOptions({
|
|
17856
17954
|
moduleDetection: {
|
17857
17955
|
dependencies: ["module", "target"],
|
17858
17956
|
computeValue: (compilerOptions) => {
|
17859
|
-
|
17957
|
+
if (compilerOptions.moduleDetection !== void 0) {
|
17958
|
+
return compilerOptions.moduleDetection;
|
17959
|
+
}
|
17960
|
+
const moduleKind = _computedOptions.module.computeValue(compilerOptions);
|
17961
|
+
return 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */;
|
17860
17962
|
}
|
17861
17963
|
},
|
17862
17964
|
isolatedModules: {
|
@@ -17873,6 +17975,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
17873
17975
|
}
|
17874
17976
|
switch (_computedOptions.module.computeValue(compilerOptions)) {
|
17875
17977
|
case 100 /* Node16 */:
|
17978
|
+
case 101 /* Node18 */:
|
17876
17979
|
case 199 /* NodeNext */:
|
17877
17980
|
case 200 /* Preserve */:
|
17878
17981
|
return true;
|
@@ -18066,6 +18169,9 @@ function unusedLabelIsError(options) {
|
|
18066
18169
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
18067
18170
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
18068
18171
|
}
|
18172
|
+
function moduleSupportsImportAttributes(moduleKind) {
|
18173
|
+
return 101 /* Node18 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */ || moduleKind === 99 /* ESNext */;
|
18174
|
+
}
|
18069
18175
|
function getStrictOptionValue(compilerOptions, flag) {
|
18070
18176
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
18071
18177
|
}
|
@@ -18783,7 +18889,7 @@ function isValidBigIntString(s, roundTripOnly) {
|
|
18783
18889
|
return success && result === 10 /* BigIntLiteral */ && scanner.getTokenEnd() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner.getTokenValue()) }));
|
18784
18890
|
}
|
18785
18891
|
function isValidTypeOnlyAliasUseSite(useSite) {
|
18786
|
-
return !!(useSite.flags & 33554432 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
18892
|
+
return !!(useSite.flags & 33554432 /* Ambient */) || isInJSDoc(useSite) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
18787
18893
|
}
|
18788
18894
|
function isShorthandPropertyNameUseSite(useSite) {
|
18789
18895
|
return isIdentifier(useSite) && isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite;
|
@@ -19849,6 +19955,64 @@ function getNodeAtPosition(sourceFile, position, includeJSDoc) {
|
|
19849
19955
|
function isNewScopeNode(node) {
|
19850
19956
|
return isFunctionLike(node) || isJSDocSignature(node) || isMappedTypeNode(node);
|
19851
19957
|
}
|
19958
|
+
function getLibNameFromLibReference(libReference) {
|
19959
|
+
return toFileNameLowerCase(libReference.fileName);
|
19960
|
+
}
|
19961
|
+
function getLibFileNameFromLibReference(libReference) {
|
19962
|
+
const libName = getLibNameFromLibReference(libReference);
|
19963
|
+
return libMap.get(libName);
|
19964
|
+
}
|
19965
|
+
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
19966
|
+
return forEachProjectReference(
|
19967
|
+
/*projectReferences*/
|
19968
|
+
void 0,
|
19969
|
+
resolvedProjectReferences,
|
19970
|
+
(resolvedRef, parent) => resolvedRef && cb(resolvedRef, parent)
|
19971
|
+
);
|
19972
|
+
}
|
19973
|
+
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
19974
|
+
let seenResolvedRefs;
|
19975
|
+
return worker(
|
19976
|
+
projectReferences,
|
19977
|
+
resolvedProjectReferences,
|
19978
|
+
/*parent*/
|
19979
|
+
void 0
|
19980
|
+
);
|
19981
|
+
function worker(projectReferences2, resolvedProjectReferences2, parent) {
|
19982
|
+
if (cbRef) {
|
19983
|
+
const result = cbRef(projectReferences2, parent);
|
19984
|
+
if (result) return result;
|
19985
|
+
}
|
19986
|
+
let skipChildren;
|
19987
|
+
return forEach(
|
19988
|
+
resolvedProjectReferences2,
|
19989
|
+
(resolvedRef, index) => {
|
19990
|
+
if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
|
19991
|
+
(skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
|
19992
|
+
return void 0;
|
19993
|
+
}
|
19994
|
+
const result = cbResolvedRef(resolvedRef, parent, index);
|
19995
|
+
if (result || !resolvedRef) return result;
|
19996
|
+
(seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
|
19997
|
+
}
|
19998
|
+
) || forEach(
|
19999
|
+
resolvedProjectReferences2,
|
20000
|
+
(resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
|
20001
|
+
);
|
20002
|
+
}
|
20003
|
+
}
|
20004
|
+
function getOptionsSyntaxByArrayElementValue(optionsObject, name, value) {
|
20005
|
+
return optionsObject && getPropertyArrayElementValue(optionsObject, name, value);
|
20006
|
+
}
|
20007
|
+
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
20008
|
+
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
20009
|
+
}
|
20010
|
+
function getOptionsSyntaxByValue(optionsObject, name, value) {
|
20011
|
+
return forEachOptionsSyntaxByName(optionsObject, name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
20012
|
+
}
|
20013
|
+
function forEachOptionsSyntaxByName(optionsObject, name, callback) {
|
20014
|
+
return forEachPropertyAssignment(optionsObject, name, callback);
|
20015
|
+
}
|
19852
20016
|
|
19853
20017
|
// src/compiler/factory/baseNodeFactory.ts
|
19854
20018
|
function createBaseNodeFactory() {
|
@@ -22455,6 +22619,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
22455
22619
|
node.colonToken = colonToken ?? createToken(59 /* ColonToken */);
|
22456
22620
|
node.whenFalse = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenFalse);
|
22457
22621
|
node.transformFlags |= propagateChildFlags(node.condition) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.whenTrue) | propagateChildFlags(node.colonToken) | propagateChildFlags(node.whenFalse);
|
22622
|
+
node.flowNodeWhenFalse = void 0;
|
22623
|
+
node.flowNodeWhenTrue = void 0;
|
22458
22624
|
return node;
|
22459
22625
|
}
|
22460
22626
|
function updateConditionalExpression(node, condition, questionToken, whenTrue, colonToken, whenFalse) {
|
@@ -24258,7 +24424,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
24258
24424
|
function isIgnorableParen(node) {
|
24259
24425
|
return isParenthesizedExpression(node) && nodeIsSynthesized(node) && nodeIsSynthesized(getSourceMapRange(node)) && nodeIsSynthesized(getCommentRange(node)) && !some(getSyntheticLeadingComments(node)) && !some(getSyntheticTrailingComments(node));
|
24260
24426
|
}
|
24261
|
-
function restoreOuterExpressions(outerExpression, innerExpression, kinds =
|
24427
|
+
function restoreOuterExpressions(outerExpression, innerExpression, kinds = 63 /* All */) {
|
24262
24428
|
if (outerExpression && isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) {
|
24263
24429
|
return updateOuterExpression(
|
24264
24430
|
outerExpression,
|
@@ -24304,7 +24470,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
24304
24470
|
}
|
24305
24471
|
}
|
24306
24472
|
function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers = false) {
|
24307
|
-
const callee = skipOuterExpressions(expression,
|
24473
|
+
const callee = skipOuterExpressions(expression, 63 /* All */);
|
24308
24474
|
let thisArg;
|
24309
24475
|
let target;
|
24310
24476
|
if (isSuperProperty(callee)) {
|
@@ -27173,7 +27339,7 @@ function getJSDocTypeAssertionType(node) {
|
|
27173
27339
|
Debug.assertIsDefined(type);
|
27174
27340
|
return type;
|
27175
27341
|
}
|
27176
|
-
function isOuterExpression(node, kinds =
|
27342
|
+
function isOuterExpression(node, kinds = 63 /* All */) {
|
27177
27343
|
switch (node.kind) {
|
27178
27344
|
case 217 /* ParenthesizedExpression */:
|
27179
27345
|
if (kinds & -2147483648 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) {
|
@@ -27182,8 +27348,9 @@ function isOuterExpression(node, kinds = 31 /* All */) {
|
|
27182
27348
|
return (kinds & 1 /* Parentheses */) !== 0;
|
27183
27349
|
case 216 /* TypeAssertionExpression */:
|
27184
27350
|
case 234 /* AsExpression */:
|
27185
|
-
case 238 /* SatisfiesExpression */:
|
27186
27351
|
return (kinds & 2 /* TypeAssertions */) !== 0;
|
27352
|
+
case 238 /* SatisfiesExpression */:
|
27353
|
+
return (kinds & (2 /* TypeAssertions */ | 32 /* Satisfies */)) !== 0;
|
27187
27354
|
case 233 /* ExpressionWithTypeArguments */:
|
27188
27355
|
return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
|
27189
27356
|
case 235 /* NonNullExpression */:
|
@@ -27193,13 +27360,13 @@ function isOuterExpression(node, kinds = 31 /* All */) {
|
|
27193
27360
|
}
|
27194
27361
|
return false;
|
27195
27362
|
}
|
27196
|
-
function skipOuterExpressions(node, kinds =
|
27363
|
+
function skipOuterExpressions(node, kinds = 63 /* All */) {
|
27197
27364
|
while (isOuterExpression(node, kinds)) {
|
27198
27365
|
node = node.expression;
|
27199
27366
|
}
|
27200
27367
|
return node;
|
27201
27368
|
}
|
27202
|
-
function walkUpOuterExpressions(node, kinds =
|
27369
|
+
function walkUpOuterExpressions(node, kinds = 63 /* All */) {
|
27203
27370
|
let parent = node.parent;
|
27204
27371
|
while (isOuterExpression(parent, kinds)) {
|
27205
27372
|
parent = parent.parent;
|
@@ -35056,6 +35223,7 @@ var Parser;
|
|
35056
35223
|
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
|
35057
35224
|
const res = finishNode(node, pos);
|
35058
35225
|
if (usedBrace) {
|
35226
|
+
skipWhitespace();
|
35059
35227
|
parseExpected(20 /* CloseBraceToken */);
|
35060
35228
|
}
|
35061
35229
|
return res;
|
@@ -36101,6 +36269,8 @@ var libEntries = [
|
|
36101
36269
|
["esnext.regexp", "lib.es2024.regexp.d.ts"],
|
36102
36270
|
["esnext.string", "lib.es2024.string.d.ts"],
|
36103
36271
|
["esnext.iterator", "lib.esnext.iterator.d.ts"],
|
36272
|
+
["esnext.promise", "lib.esnext.promise.d.ts"],
|
36273
|
+
["esnext.float16", "lib.esnext.float16.d.ts"],
|
36104
36274
|
["decorators", "lib.decorators.d.ts"],
|
36105
36275
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
36106
36276
|
];
|
@@ -36427,6 +36597,7 @@ var moduleOptionDeclaration = {
|
|
36427
36597
|
es2022: 7 /* ES2022 */,
|
36428
36598
|
esnext: 99 /* ESNext */,
|
36429
36599
|
node16: 100 /* Node16 */,
|
36600
|
+
node18: 101 /* Node18 */,
|
36430
36601
|
nodenext: 199 /* NodeNext */,
|
36431
36602
|
preserve: 200 /* Preserve */
|
36432
36603
|
})),
|
@@ -36679,6 +36850,23 @@ var commandOptionsWithoutBuild = [
|
|
36679
36850
|
affectsBuildInfo: true,
|
36680
36851
|
affectsSemanticDiagnostics: true
|
36681
36852
|
},
|
36853
|
+
{
|
36854
|
+
name: "erasableSyntaxOnly",
|
36855
|
+
type: "boolean",
|
36856
|
+
category: Diagnostics.Interop_Constraints,
|
36857
|
+
description: Diagnostics.Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript,
|
36858
|
+
defaultValueDescription: false,
|
36859
|
+
affectsBuildInfo: true,
|
36860
|
+
affectsSemanticDiagnostics: true
|
36861
|
+
},
|
36862
|
+
{
|
36863
|
+
name: "libReplacement",
|
36864
|
+
type: "boolean",
|
36865
|
+
affectsProgramStructure: true,
|
36866
|
+
category: Diagnostics.Language_and_Environment,
|
36867
|
+
description: Diagnostics.Enable_lib_replacement,
|
36868
|
+
defaultValueDescription: true
|
36869
|
+
},
|
36682
36870
|
// Strict Type Checks
|
36683
36871
|
{
|
36684
36872
|
name: "strict",
|
@@ -40731,9 +40919,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
40731
40919
|
}
|
40732
40920
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
40733
40921
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
40734
|
-
|
40735
|
-
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
40736
|
-
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths), state);
|
40922
|
+
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo), state);
|
40737
40923
|
}
|
40738
40924
|
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
40739
40925
|
return {
|
@@ -40840,13 +41026,14 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
40840
41026
|
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
40841
41027
|
}
|
40842
41028
|
}
|
40843
|
-
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state,
|
41029
|
+
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJson) {
|
41030
|
+
const versionPaths = packageJson && getVersionPathsOfPackageJsonInfo(packageJson, state);
|
40844
41031
|
let packageFile;
|
40845
|
-
if (
|
41032
|
+
if (packageJson && arePathsEqual(packageJson == null ? void 0 : packageJson.packageDirectory, candidate, state.host)) {
|
40846
41033
|
if (state.isConfigLookup) {
|
40847
|
-
packageFile = readPackageJsonTSConfigField(
|
41034
|
+
packageFile = readPackageJsonTSConfigField(packageJson.contents.packageJsonContent, packageJson.packageDirectory, state);
|
40848
41035
|
} else {
|
40849
|
-
packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(
|
41036
|
+
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;
|
40850
41037
|
}
|
40851
41038
|
}
|
40852
41039
|
const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
|
@@ -40865,7 +41052,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
40865
41052
|
const features = state2.features;
|
40866
41053
|
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
40867
41054
|
state2.candidateIsFromPackageJsonField = true;
|
40868
|
-
if ((
|
41055
|
+
if ((packageJson == null ? void 0 : packageJson.contents.packageJsonContent.type) !== "module") {
|
40869
41056
|
state2.features &= ~32 /* EsmMode */;
|
40870
41057
|
}
|
40871
41058
|
const result = nodeLoadModuleByRelativeName(
|
@@ -41136,6 +41323,7 @@ function hasOneAsterisk(patternKey) {
|
|
41136
41323
|
function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
41137
41324
|
return loadModuleFromTargetExportOrImport;
|
41138
41325
|
function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
|
41326
|
+
var _a, _b;
|
41139
41327
|
if (typeof target === "string") {
|
41140
41328
|
if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
|
41141
41329
|
if (state.traceEnabled) {
|
@@ -41164,6 +41352,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
41164
41352
|
redirectedReference,
|
41165
41353
|
state.conditions
|
41166
41354
|
);
|
41355
|
+
(_a = state.failedLookupLocations) == null ? void 0 : _a.push(...result.failedLookupLocations ?? emptyArray);
|
41356
|
+
(_b = state.affectingLocations) == null ? void 0 : _b.push(...result.affectingLocations ?? emptyArray);
|
41167
41357
|
return toSearchResult(
|
41168
41358
|
result.resolvedModule ? {
|
41169
41359
|
path: result.resolvedModule.resolvedFileName,
|
@@ -41273,20 +41463,20 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
41273
41463
|
void 0
|
41274
41464
|
);
|
41275
41465
|
function toAbsolutePath(path) {
|
41276
|
-
var
|
41466
|
+
var _a2, _b2;
|
41277
41467
|
if (path === void 0) return path;
|
41278
|
-
return getNormalizedAbsolutePath(path, (
|
41468
|
+
return getNormalizedAbsolutePath(path, (_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2));
|
41279
41469
|
}
|
41280
41470
|
function combineDirectoryPath(root, dir) {
|
41281
41471
|
return ensureTrailingDirectorySeparator(combinePaths(root, dir));
|
41282
41472
|
}
|
41283
41473
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
41284
|
-
var
|
41474
|
+
var _a2, _b2, _c, _d;
|
41285
41475
|
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)) {
|
41286
41476
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
|
41287
41477
|
const commonSourceDirGuesses = [];
|
41288
41478
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
41289
|
-
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((
|
41479
|
+
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName));
|
41290
41480
|
commonSourceDirGuesses.push(commonDir);
|
41291
41481
|
} else if (state.requestContainingDirectory) {
|
41292
41482
|
const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts"));
|
@@ -41342,8 +41532,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
41342
41532
|
}
|
41343
41533
|
return void 0;
|
41344
41534
|
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
41345
|
-
var
|
41346
|
-
const currentDir = state.compilerOptions.configFile ? ((
|
41535
|
+
var _a3, _b3;
|
41536
|
+
const currentDir = state.compilerOptions.configFile ? ((_b3 = (_a3 = state.host).getCurrentDirectory) == null ? void 0 : _b3.call(_a3)) || "" : commonSourceDirGuess;
|
41347
41537
|
const candidateDirectories = [];
|
41348
41538
|
if (state.compilerOptions.declarationDir) {
|
41349
41539
|
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
@@ -41390,7 +41580,7 @@ function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directo
|
|
41390
41580
|
);
|
41391
41581
|
}
|
41392
41582
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
41393
|
-
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */;
|
41583
|
+
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ || state.conditions.includes("import") ? 99 /* ESNext */ : 1 /* CommonJS */;
|
41394
41584
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
41395
41585
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
41396
41586
|
if (priorityExtensions) {
|
@@ -41468,8 +41658,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
41468
41658
|
candidate,
|
41469
41659
|
!nodeModulesDirectoryExists,
|
41470
41660
|
state,
|
41471
|
-
packageInfo
|
41472
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
41661
|
+
packageInfo
|
41473
41662
|
);
|
41474
41663
|
return withPackageId(packageInfo, fromDirectory, state);
|
41475
41664
|
}
|
@@ -41479,8 +41668,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
41479
41668
|
candidate2,
|
41480
41669
|
onlyRecordFailures,
|
41481
41670
|
state2,
|
41482
|
-
packageInfo
|
41483
|
-
packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
|
41671
|
+
packageInfo
|
41484
41672
|
);
|
41485
41673
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
41486
41674
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
@@ -41910,6 +42098,7 @@ function createBinder() {
|
|
41910
42098
|
var preSwitchCaseFlow;
|
41911
42099
|
var activeLabelList;
|
41912
42100
|
var hasExplicitReturn;
|
42101
|
+
var inReturnPosition;
|
41913
42102
|
var hasFlowEffects;
|
41914
42103
|
var emitFlags;
|
41915
42104
|
var inStrictMode;
|
@@ -41982,6 +42171,7 @@ function createBinder() {
|
|
41982
42171
|
currentExceptionTarget = void 0;
|
41983
42172
|
activeLabelList = void 0;
|
41984
42173
|
hasExplicitReturn = false;
|
42174
|
+
inReturnPosition = false;
|
41985
42175
|
hasFlowEffects = false;
|
41986
42176
|
inAssignmentPattern = false;
|
41987
42177
|
emitFlags = 0 /* None */;
|
@@ -42218,6 +42408,8 @@ function createBinder() {
|
|
42218
42408
|
const saveContainer = container;
|
42219
42409
|
const saveThisParentContainer = thisParentContainer;
|
42220
42410
|
const savedBlockScopeContainer = blockScopeContainer;
|
42411
|
+
const savedInReturnPosition = inReturnPosition;
|
42412
|
+
if (node.kind === 219 /* ArrowFunction */ && node.body.kind !== 241 /* Block */) inReturnPosition = true;
|
42221
42413
|
if (containerFlags & 1 /* IsContainer */) {
|
42222
42414
|
if (node.kind !== 219 /* ArrowFunction */) {
|
42223
42415
|
thisParentContainer = container;
|
@@ -42295,6 +42487,7 @@ function createBinder() {
|
|
42295
42487
|
} else {
|
42296
42488
|
bindChildren(node);
|
42297
42489
|
}
|
42490
|
+
inReturnPosition = savedInReturnPosition;
|
42298
42491
|
container = saveContainer;
|
42299
42492
|
thisParentContainer = saveThisParentContainer;
|
42300
42493
|
blockScopeContainer = savedBlockScopeContainer;
|
@@ -42316,6 +42509,9 @@ function createBinder() {
|
|
42316
42509
|
const saveInAssignmentPattern = inAssignmentPattern;
|
42317
42510
|
inAssignmentPattern = false;
|
42318
42511
|
if (checkUnreachable(node)) {
|
42512
|
+
if (canHaveFlowNode(node) && node.flowNode) {
|
42513
|
+
node.flowNode = void 0;
|
42514
|
+
}
|
42319
42515
|
bindEachChild(node);
|
42320
42516
|
bindJSDoc(node);
|
42321
42517
|
inAssignmentPattern = saveInAssignmentPattern;
|
@@ -42511,7 +42707,9 @@ function createBinder() {
|
|
42511
42707
|
case 36 /* ExclamationEqualsToken */:
|
42512
42708
|
case 37 /* EqualsEqualsEqualsToken */:
|
42513
42709
|
case 38 /* ExclamationEqualsEqualsToken */:
|
42514
|
-
|
42710
|
+
const left = skipParentheses(expr.left);
|
42711
|
+
const right = skipParentheses(expr.right);
|
42712
|
+
return isNarrowableOperand(left) || isNarrowableOperand(right) || isNarrowingTypeofOperands(right, left) || isNarrowingTypeofOperands(left, right) || (isBooleanLiteral(right) && isNarrowingExpression(left) || isBooleanLiteral(left) && isNarrowingExpression(right));
|
42515
42713
|
case 104 /* InstanceOfKeyword */:
|
42516
42714
|
return isNarrowableOperand(expr.left);
|
42517
42715
|
case 103 /* InKeyword */:
|
@@ -42703,13 +42901,16 @@ function createBinder() {
|
|
42703
42901
|
function bindForStatement(node) {
|
42704
42902
|
const preLoopLabel = setContinueTarget(node, createLoopLabel());
|
42705
42903
|
const preBodyLabel = createBranchLabel();
|
42904
|
+
const preIncrementorLabel = createBranchLabel();
|
42706
42905
|
const postLoopLabel = createBranchLabel();
|
42707
42906
|
bind(node.initializer);
|
42708
42907
|
addAntecedent(preLoopLabel, currentFlow);
|
42709
42908
|
currentFlow = preLoopLabel;
|
42710
42909
|
bindCondition(node.condition, preBodyLabel, postLoopLabel);
|
42711
42910
|
currentFlow = finishFlowLabel(preBodyLabel);
|
42712
|
-
bindIterativeStatement(node.statement, postLoopLabel,
|
42911
|
+
bindIterativeStatement(node.statement, postLoopLabel, preIncrementorLabel);
|
42912
|
+
addAntecedent(preIncrementorLabel, currentFlow);
|
42913
|
+
currentFlow = finishFlowLabel(preIncrementorLabel);
|
42713
42914
|
bind(node.incrementor);
|
42714
42915
|
addAntecedent(preLoopLabel, currentFlow);
|
42715
42916
|
currentFlow = finishFlowLabel(postLoopLabel);
|
@@ -42746,7 +42947,10 @@ function createBinder() {
|
|
42746
42947
|
currentFlow = finishFlowLabel(postIfLabel);
|
42747
42948
|
}
|
42748
42949
|
function bindReturnOrThrow(node) {
|
42950
|
+
const savedInReturnPosition = inReturnPosition;
|
42951
|
+
inReturnPosition = true;
|
42749
42952
|
bind(node.expression);
|
42953
|
+
inReturnPosition = savedInReturnPosition;
|
42750
42954
|
if (node.kind === 253 /* ReturnStatement */) {
|
42751
42955
|
hasExplicitReturn = true;
|
42752
42956
|
if (currentReturnTarget) {
|
@@ -43107,10 +43311,16 @@ function createBinder() {
|
|
43107
43311
|
hasFlowEffects = false;
|
43108
43312
|
bindCondition(node.condition, trueLabel, falseLabel);
|
43109
43313
|
currentFlow = finishFlowLabel(trueLabel);
|
43314
|
+
if (inReturnPosition) {
|
43315
|
+
node.flowNodeWhenTrue = currentFlow;
|
43316
|
+
}
|
43110
43317
|
bind(node.questionToken);
|
43111
43318
|
bind(node.whenTrue);
|
43112
43319
|
addAntecedent(postExpressionLabel, currentFlow);
|
43113
43320
|
currentFlow = finishFlowLabel(falseLabel);
|
43321
|
+
if (inReturnPosition) {
|
43322
|
+
node.flowNodeWhenFalse = currentFlow;
|
43323
|
+
}
|
43114
43324
|
bind(node.colonToken);
|
43115
43325
|
bind(node.whenFalse);
|
43116
43326
|
addAntecedent(postExpressionLabel, currentFlow);
|
@@ -46167,8 +46377,8 @@ function createTypeChecker(host) {
|
|
46167
46377
|
writeSignature: (signature, enclosingDeclaration, flags, kind, writer) => {
|
46168
46378
|
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer);
|
46169
46379
|
},
|
46170
|
-
writeType: (type, enclosingDeclaration, flags, writer) => {
|
46171
|
-
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer);
|
46380
|
+
writeType: (type, enclosingDeclaration, flags, writer, verbosityLevel, out) => {
|
46381
|
+
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, verbosityLevel, out);
|
46172
46382
|
},
|
46173
46383
|
writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => {
|
46174
46384
|
return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
|
@@ -46284,6 +46494,7 @@ function createTypeChecker(host) {
|
|
46284
46494
|
getNumberLiteralType,
|
46285
46495
|
getBigIntType: () => bigintType,
|
46286
46496
|
getBigIntLiteralType,
|
46497
|
+
getUnknownType: () => unknownType,
|
46287
46498
|
createPromiseType,
|
46288
46499
|
createArrayType,
|
46289
46500
|
getElementTypeOfArrayType,
|
@@ -46400,8 +46611,13 @@ function createTypeChecker(host) {
|
|
46400
46611
|
getMemberOverrideModifierStatus,
|
46401
46612
|
isTypeParameterPossiblyReferenced,
|
46402
46613
|
typeHasCallOrConstructSignatures,
|
46403
|
-
getSymbolFlags
|
46614
|
+
getSymbolFlags,
|
46615
|
+
getTypeArgumentsForResolvedSignature
|
46404
46616
|
};
|
46617
|
+
function getTypeArgumentsForResolvedSignature(signature) {
|
46618
|
+
if (signature.mapper === void 0) return void 0;
|
46619
|
+
return instantiateTypes((signature.target || signature).typeParameters, signature.mapper);
|
46620
|
+
}
|
46405
46621
|
function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
|
46406
46622
|
const candidatesSet = /* @__PURE__ */ new Set();
|
46407
46623
|
const candidates = [];
|
@@ -46960,6 +47176,7 @@ function createTypeChecker(host) {
|
|
46960
47176
|
[".jsx", ".jsx"],
|
46961
47177
|
[".json", ".json"]
|
46962
47178
|
];
|
47179
|
+
var narrowableReturnTypeCache = /* @__PURE__ */ new Map();
|
46963
47180
|
initializeTypeChecker();
|
46964
47181
|
return checker;
|
46965
47182
|
function isDefinitelyReferenceToGlobalSymbolObject(node) {
|
@@ -47823,9 +48040,9 @@ function createTypeChecker(host) {
|
|
47823
48040
|
const containerKind = grandparent.parent.kind;
|
47824
48041
|
if (containerKind === 264 /* InterfaceDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
|
47825
48042
|
error(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_It_can_only_extend_other_named_object_types, unescapeLeadingUnderscores(name));
|
47826
|
-
} else if (
|
48043
|
+
} else if (isClassLike(grandparent.parent) && heritageKind === 96 /* ExtendsKeyword */) {
|
47827
48044
|
error(errorLocation, Diagnostics.A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values, unescapeLeadingUnderscores(name));
|
47828
|
-
} else if (
|
48045
|
+
} else if (isClassLike(grandparent.parent) && heritageKind === 119 /* ImplementsKeyword */) {
|
47829
48046
|
error(errorLocation, Diagnostics.A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types, unescapeLeadingUnderscores(name));
|
47830
48047
|
}
|
47831
48048
|
} else {
|
@@ -49001,7 +49218,7 @@ function createTypeChecker(host) {
|
|
49001
49218
|
moduleReference
|
49002
49219
|
);
|
49003
49220
|
}
|
49004
|
-
if (errorNode && (
|
49221
|
+
if (errorNode && (moduleKind === 100 /* Node16 */ || moduleKind === 101 /* Node18 */)) {
|
49005
49222
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
49006
49223
|
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
|
49007
49224
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
@@ -50095,14 +50312,18 @@ function createTypeChecker(host) {
|
|
50095
50312
|
return writer2;
|
50096
50313
|
}
|
50097
50314
|
}
|
50098
|
-
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
50099
|
-
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation
|
50315
|
+
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter(""), verbosityLevel, out) {
|
50316
|
+
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */ || verbosityLevel !== void 0;
|
50100
50317
|
const typeNode = nodeBuilder.typeToTypeNode(
|
50101
50318
|
type,
|
50102
50319
|
enclosingDeclaration,
|
50103
|
-
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0
|
50320
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0),
|
50104
50321
|
/*internalFlags*/
|
50105
|
-
void 0
|
50322
|
+
void 0,
|
50323
|
+
/*tracker*/
|
50324
|
+
void 0,
|
50325
|
+
verbosityLevel,
|
50326
|
+
out
|
50106
50327
|
);
|
50107
50328
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
50108
50329
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
@@ -50242,12 +50463,7 @@ function createTypeChecker(host) {
|
|
50242
50463
|
enterNewScope(context, node) {
|
50243
50464
|
if (isFunctionLike(node) || isJSDocSignature(node)) {
|
50244
50465
|
const signature = getSignatureFromDeclaration(node);
|
50245
|
-
|
50246
|
-
signature,
|
50247
|
-
/*skipUnionExpanding*/
|
50248
|
-
true
|
50249
|
-
)[0];
|
50250
|
-
return enterNewScope(context, node, expandedParams, signature.typeParameters);
|
50466
|
+
return enterNewScope(context, node, signature.parameters, signature.typeParameters);
|
50251
50467
|
} else {
|
50252
50468
|
const typeParameters = isConditionalTypeNode(node) ? getInferTypeParameters(node) : [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))];
|
50253
50469
|
return enterNewScope(
|
@@ -50334,31 +50550,127 @@ function createTypeChecker(host) {
|
|
50334
50550
|
};
|
50335
50551
|
return {
|
50336
50552
|
syntacticBuilderResolver,
|
50337
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
50338
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50339
|
-
|
50340
|
-
|
50341
|
-
|
50342
|
-
|
50343
|
-
|
50344
|
-
|
50345
|
-
|
50346
|
-
|
50347
|
-
)
|
50348
|
-
|
50349
|
-
|
50350
|
-
|
50351
|
-
|
50352
|
-
|
50353
|
-
|
50354
|
-
|
50355
|
-
)
|
50356
|
-
|
50357
|
-
|
50358
|
-
|
50359
|
-
|
50360
|
-
|
50361
|
-
|
50553
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeToTypeNodeHelper(type, context), out),
|
50554
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50555
|
+
enclosingDeclaration,
|
50556
|
+
flags,
|
50557
|
+
internalFlags,
|
50558
|
+
tracker,
|
50559
|
+
/*verbosityLevel*/
|
50560
|
+
void 0,
|
50561
|
+
(context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)
|
50562
|
+
),
|
50563
|
+
serializeTypeForDeclaration: (declaration, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50564
|
+
enclosingDeclaration,
|
50565
|
+
flags,
|
50566
|
+
internalFlags,
|
50567
|
+
tracker,
|
50568
|
+
/*verbosityLevel*/
|
50569
|
+
void 0,
|
50570
|
+
(context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)
|
50571
|
+
),
|
50572
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50573
|
+
enclosingDeclaration,
|
50574
|
+
flags,
|
50575
|
+
internalFlags,
|
50576
|
+
tracker,
|
50577
|
+
/*verbosityLevel*/
|
50578
|
+
void 0,
|
50579
|
+
(context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)
|
50580
|
+
),
|
50581
|
+
serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50582
|
+
enclosingDeclaration,
|
50583
|
+
flags,
|
50584
|
+
internalFlags,
|
50585
|
+
tracker,
|
50586
|
+
/*verbosityLevel*/
|
50587
|
+
void 0,
|
50588
|
+
(context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)
|
50589
|
+
),
|
50590
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50591
|
+
enclosingDeclaration,
|
50592
|
+
flags,
|
50593
|
+
internalFlags,
|
50594
|
+
tracker,
|
50595
|
+
/*verbosityLevel*/
|
50596
|
+
void 0,
|
50597
|
+
(context) => indexInfoToIndexSignatureDeclarationHelper(
|
50598
|
+
indexInfo,
|
50599
|
+
context,
|
50600
|
+
/*typeNode*/
|
50601
|
+
void 0
|
50602
|
+
)
|
50603
|
+
),
|
50604
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50605
|
+
enclosingDeclaration,
|
50606
|
+
flags,
|
50607
|
+
internalFlags,
|
50608
|
+
tracker,
|
50609
|
+
/*verbosityLevel*/
|
50610
|
+
void 0,
|
50611
|
+
(context) => signatureToSignatureDeclarationHelper(signature, kind, context)
|
50612
|
+
),
|
50613
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50614
|
+
enclosingDeclaration,
|
50615
|
+
flags,
|
50616
|
+
internalFlags,
|
50617
|
+
tracker,
|
50618
|
+
/*verbosityLevel*/
|
50619
|
+
void 0,
|
50620
|
+
(context) => symbolToName(
|
50621
|
+
symbol,
|
50622
|
+
context,
|
50623
|
+
meaning,
|
50624
|
+
/*expectsIdentifier*/
|
50625
|
+
false
|
50626
|
+
)
|
50627
|
+
),
|
50628
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50629
|
+
enclosingDeclaration,
|
50630
|
+
flags,
|
50631
|
+
internalFlags,
|
50632
|
+
tracker,
|
50633
|
+
/*verbosityLevel*/
|
50634
|
+
void 0,
|
50635
|
+
(context) => symbolToExpression(symbol, context, meaning)
|
50636
|
+
),
|
50637
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50638
|
+
enclosingDeclaration,
|
50639
|
+
flags,
|
50640
|
+
internalFlags,
|
50641
|
+
tracker,
|
50642
|
+
/*verbosityLevel*/
|
50643
|
+
void 0,
|
50644
|
+
(context) => typeParametersToTypeParameterDeclarations(symbol, context)
|
50645
|
+
),
|
50646
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50647
|
+
enclosingDeclaration,
|
50648
|
+
flags,
|
50649
|
+
internalFlags,
|
50650
|
+
tracker,
|
50651
|
+
/*verbosityLevel*/
|
50652
|
+
void 0,
|
50653
|
+
(context) => symbolToParameterDeclaration(symbol, context)
|
50654
|
+
),
|
50655
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeParameterToDeclaration(parameter, context)),
|
50656
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50657
|
+
enclosingDeclaration,
|
50658
|
+
flags,
|
50659
|
+
internalFlags,
|
50660
|
+
tracker,
|
50661
|
+
/*verbosityLevel*/
|
50662
|
+
void 0,
|
50663
|
+
(context) => symbolTableToDeclarationStatements(symbolTable, context)
|
50664
|
+
),
|
50665
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50666
|
+
enclosingDeclaration,
|
50667
|
+
flags,
|
50668
|
+
internalFlags,
|
50669
|
+
tracker,
|
50670
|
+
/*verbosityLevel*/
|
50671
|
+
void 0,
|
50672
|
+
(context) => symbolToNode(symbol, context, meaning)
|
50673
|
+
)
|
50362
50674
|
};
|
50363
50675
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
50364
50676
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
@@ -50400,7 +50712,7 @@ function createTypeChecker(host) {
|
|
50400
50712
|
}
|
50401
50713
|
return symbolToExpression(symbol, context, meaning);
|
50402
50714
|
}
|
50403
|
-
function withContext(enclosingDeclaration, flags, internalFlags, tracker, cb) {
|
50715
|
+
function withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, cb, out) {
|
50404
50716
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
50405
50717
|
const context = {
|
50406
50718
|
enclosingDeclaration,
|
@@ -50408,6 +50720,7 @@ function createTypeChecker(host) {
|
|
50408
50720
|
flags: flags || 0 /* None */,
|
50409
50721
|
internalFlags: internalFlags || 0 /* None */,
|
50410
50722
|
tracker: void 0,
|
50723
|
+
unfoldDepth: verbosityLevel ?? -1,
|
50411
50724
|
encounteredError: false,
|
50412
50725
|
suppressReportInferenceFallback: false,
|
50413
50726
|
reportedDiagnostic: false,
|
@@ -50429,13 +50742,18 @@ function createTypeChecker(host) {
|
|
50429
50742
|
typeParameterNamesByText: void 0,
|
50430
50743
|
typeParameterNamesByTextNextNameCount: void 0,
|
50431
50744
|
enclosingSymbolTypes: /* @__PURE__ */ new Map(),
|
50432
|
-
mapper: void 0
|
50745
|
+
mapper: void 0,
|
50746
|
+
depth: 0,
|
50747
|
+
couldUnfoldMore: false
|
50433
50748
|
};
|
50434
50749
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
50435
50750
|
const resultingNode = cb(context);
|
50436
50751
|
if (context.truncating && context.flags & 1 /* NoTruncation */) {
|
50437
50752
|
context.tracker.reportTruncationError();
|
50438
50753
|
}
|
50754
|
+
if (out) {
|
50755
|
+
out.couldUnfoldMore = context.couldUnfoldMore;
|
50756
|
+
}
|
50439
50757
|
return context.encounteredError ? void 0 : resultingNode;
|
50440
50758
|
}
|
50441
50759
|
function addSymbolTypeToContext(context, symbol, type) {
|
@@ -50454,16 +50772,36 @@ function createTypeChecker(host) {
|
|
50454
50772
|
function saveRestoreFlags(context) {
|
50455
50773
|
const flags = context.flags;
|
50456
50774
|
const internalFlags = context.internalFlags;
|
50775
|
+
const depth = context.depth;
|
50457
50776
|
return restore;
|
50458
50777
|
function restore() {
|
50459
50778
|
context.flags = flags;
|
50460
50779
|
context.internalFlags = internalFlags;
|
50780
|
+
context.depth = depth;
|
50461
50781
|
}
|
50462
50782
|
}
|
50463
50783
|
function checkTruncationLength(context) {
|
50464
50784
|
if (context.truncating) return context.truncating;
|
50465
50785
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
50466
50786
|
}
|
50787
|
+
function couldUnfoldType(type, context) {
|
50788
|
+
var _a;
|
50789
|
+
if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
|
50790
|
+
return false;
|
50791
|
+
}
|
50792
|
+
return context.depth < context.unfoldDepth || context.depth === context.unfoldDepth && !context.couldUnfoldMore;
|
50793
|
+
}
|
50794
|
+
function canUnfoldType(type, context) {
|
50795
|
+
var _a;
|
50796
|
+
if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
|
50797
|
+
return false;
|
50798
|
+
}
|
50799
|
+
const result = context.depth < context.unfoldDepth;
|
50800
|
+
if (!result) {
|
50801
|
+
context.couldUnfoldMore = true;
|
50802
|
+
}
|
50803
|
+
return result;
|
50804
|
+
}
|
50467
50805
|
function typeToTypeNodeHelper(type, context) {
|
50468
50806
|
const restoreFlags = saveRestoreFlags(context);
|
50469
50807
|
const typeNode = typeToTypeNodeWorker(type, context);
|
@@ -50611,16 +50949,27 @@ function createTypeChecker(host) {
|
|
50611
50949
|
return factory.createThisTypeNode();
|
50612
50950
|
}
|
50613
50951
|
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
|
50614
|
-
|
50615
|
-
|
50616
|
-
|
50617
|
-
|
50952
|
+
if (!canUnfoldType(type, context)) {
|
50953
|
+
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
50954
|
+
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
|
50955
|
+
if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
|
50956
|
+
return factory.createArrayTypeNode(typeArgumentNodes[0]);
|
50957
|
+
}
|
50958
|
+
return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
|
50618
50959
|
}
|
50619
|
-
|
50960
|
+
context.depth += 1;
|
50620
50961
|
}
|
50621
50962
|
const objectFlags = getObjectFlags(type);
|
50622
50963
|
if (objectFlags & 4 /* Reference */) {
|
50623
50964
|
Debug.assert(!!(type.flags & 524288 /* Object */));
|
50965
|
+
if (canUnfoldType(type, context)) {
|
50966
|
+
context.depth += 1;
|
50967
|
+
return createAnonymousTypeNode(
|
50968
|
+
type,
|
50969
|
+
/*forceClassExpansion*/
|
50970
|
+
true
|
50971
|
+
);
|
50972
|
+
}
|
50624
50973
|
return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
|
50625
50974
|
}
|
50626
50975
|
if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
|
@@ -50650,6 +50999,14 @@ function createTypeChecker(host) {
|
|
50650
50999
|
void 0
|
50651
51000
|
);
|
50652
51001
|
}
|
51002
|
+
if (objectFlags & 3 /* ClassOrInterface */ && canUnfoldType(type, context)) {
|
51003
|
+
context.depth += 1;
|
51004
|
+
return createAnonymousTypeNode(
|
51005
|
+
type,
|
51006
|
+
/*forceClassExpansion*/
|
51007
|
+
true
|
51008
|
+
);
|
51009
|
+
}
|
50653
51010
|
if (type.symbol) {
|
50654
51011
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
50655
51012
|
}
|
@@ -50853,7 +51210,7 @@ function createTypeChecker(host) {
|
|
50853
51210
|
}
|
50854
51211
|
return result;
|
50855
51212
|
}
|
50856
|
-
function createAnonymousTypeNode(type2) {
|
51213
|
+
function createAnonymousTypeNode(type2, forceClassExpansion = false) {
|
50857
51214
|
var _a2, _b2;
|
50858
51215
|
const typeId = type2.id;
|
50859
51216
|
const symbol = type2.symbol;
|
@@ -50876,7 +51233,7 @@ function createTypeChecker(host) {
|
|
50876
51233
|
const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
|
50877
51234
|
if (isJSConstructor(symbol.valueDeclaration)) {
|
50878
51235
|
return symbolToTypeNode(symbol, context, isInstanceType);
|
50879
|
-
} else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
51236
|
+
} else if (symbol.flags & 32 /* Class */ && !forceClassExpansion && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
50880
51237
|
symbol,
|
50881
51238
|
context.enclosingDeclaration,
|
50882
51239
|
isInstanceType,
|
@@ -50900,7 +51257,7 @@ function createTypeChecker(host) {
|
|
50900
51257
|
function shouldWriteTypeOfFunctionSymbol() {
|
50901
51258
|
var _a3;
|
50902
51259
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
50903
|
-
some(symbol.declarations, (declaration) => isStatic(declaration));
|
51260
|
+
some(symbol.declarations, (declaration) => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)));
|
50904
51261
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
50905
51262
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
50906
51263
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
@@ -50920,7 +51277,7 @@ function createTypeChecker(host) {
|
|
50920
51277
|
if (id && !context.symbolDepth) {
|
50921
51278
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
50922
51279
|
}
|
50923
|
-
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
51280
|
+
const links = context.unfoldDepth >= 0 ? void 0 : context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
50924
51281
|
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
50925
51282
|
if (links) {
|
50926
51283
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
@@ -51203,6 +51560,38 @@ function createTypeChecker(host) {
|
|
51203
51560
|
ids.unshift(state);
|
51204
51561
|
return ids;
|
51205
51562
|
}
|
51563
|
+
function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo, context2, typeNode) {
|
51564
|
+
if (indexInfo.components) {
|
51565
|
+
const allComponentComputedNamesSerializable = every(indexInfo.components, (e) => {
|
51566
|
+
var _a2;
|
51567
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context2.enclosingDeclaration && ((_a2 = isEntityNameVisible(
|
51568
|
+
e.name.expression,
|
51569
|
+
context2.enclosingDeclaration,
|
51570
|
+
/*shouldComputeAliasToMakeVisible*/
|
51571
|
+
false
|
51572
|
+
)) == null ? void 0 : _a2.accessibility) === 0 /* Accessible */);
|
51573
|
+
});
|
51574
|
+
if (allComponentComputedNamesSerializable) {
|
51575
|
+
const newComponents = filter(indexInfo.components, (e) => {
|
51576
|
+
return !hasLateBindableName(e);
|
51577
|
+
});
|
51578
|
+
return map(newComponents, (e) => {
|
51579
|
+
trackComputedName(e.name.expression, context2.enclosingDeclaration, context2);
|
51580
|
+
return setTextRange2(
|
51581
|
+
context2,
|
51582
|
+
factory.createPropertySignature(
|
51583
|
+
indexInfo.isReadonly ? [factory.createModifier(148 /* ReadonlyKeyword */)] : void 0,
|
51584
|
+
e.name,
|
51585
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
51586
|
+
typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context2)
|
51587
|
+
),
|
51588
|
+
e
|
51589
|
+
);
|
51590
|
+
});
|
51591
|
+
}
|
51592
|
+
}
|
51593
|
+
return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context2, typeNode)];
|
51594
|
+
}
|
51206
51595
|
function createTypeNodesFromResolvedType(resolvedType) {
|
51207
51596
|
if (checkTruncationLength(context)) {
|
51208
51597
|
if (context.flags & 1 /* NoTruncation */) {
|
@@ -51227,7 +51616,7 @@ function createTypeChecker(host) {
|
|
51227
51616
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context));
|
51228
51617
|
}
|
51229
51618
|
for (const info of resolvedType.indexInfos) {
|
51230
|
-
typeElements.push(
|
51619
|
+
typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
|
51231
51620
|
}
|
51232
51621
|
const properties = resolvedType.properties;
|
51233
51622
|
if (!properties) {
|
@@ -51835,7 +52224,7 @@ function createTypeChecker(host) {
|
|
51835
52224
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
51836
52225
|
}
|
51837
52226
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
51838
|
-
return typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
52227
|
+
return !couldUnfoldType(type, context) && typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
51839
52228
|
}
|
51840
52229
|
function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
|
51841
52230
|
const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
|
@@ -51916,7 +52305,7 @@ function createTypeChecker(host) {
|
|
51916
52305
|
if (!context.tracker.canTrackSymbol) return;
|
51917
52306
|
const firstIdentifier = getFirstIdentifier(accessExpression);
|
51918
52307
|
const name = resolveName(
|
51919
|
-
|
52308
|
+
enclosingDeclaration,
|
51920
52309
|
firstIdentifier.escapedText,
|
51921
52310
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
51922
52311
|
/*nameNotFoundMessage*/
|
@@ -51926,6 +52315,19 @@ function createTypeChecker(host) {
|
|
51926
52315
|
);
|
51927
52316
|
if (name) {
|
51928
52317
|
context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
|
52318
|
+
} else {
|
52319
|
+
const fallback = resolveName(
|
52320
|
+
firstIdentifier,
|
52321
|
+
firstIdentifier.escapedText,
|
52322
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
52323
|
+
/*nameNotFoundMessage*/
|
52324
|
+
void 0,
|
52325
|
+
/*isUse*/
|
52326
|
+
true
|
52327
|
+
);
|
52328
|
+
if (fallback) {
|
52329
|
+
context.tracker.trackSymbol(fallback, enclosingDeclaration, 111551 /* Value */);
|
52330
|
+
}
|
51929
52331
|
}
|
51930
52332
|
}
|
51931
52333
|
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
|
@@ -52469,7 +52871,7 @@ function createTypeChecker(host) {
|
|
52469
52871
|
let result;
|
52470
52872
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
52471
52873
|
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
52472
|
-
if (decl) {
|
52874
|
+
if (!couldUnfoldType(type, context) && decl) {
|
52473
52875
|
if (isAccessor(decl)) {
|
52474
52876
|
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
|
52475
52877
|
} else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
|
@@ -58740,8 +59142,8 @@ function createTypeChecker(host) {
|
|
58740
59142
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
58741
59143
|
return symbolTable.get("__index" /* Index */);
|
58742
59144
|
}
|
58743
|
-
function createIndexInfo(keyType, type, isReadonly, declaration) {
|
58744
|
-
return { keyType, type, isReadonly, declaration };
|
59145
|
+
function createIndexInfo(keyType, type, isReadonly, declaration, components) {
|
59146
|
+
return { keyType, type, isReadonly, declaration, components };
|
58745
59147
|
}
|
58746
59148
|
function getIndexInfosOfSymbol(symbol) {
|
58747
59149
|
const indexSymbol = getIndexSymbol(symbol);
|
@@ -59181,11 +59583,14 @@ function createTypeChecker(host) {
|
|
59181
59583
|
function isNoInferType(type) {
|
59182
59584
|
return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
|
59183
59585
|
}
|
59184
|
-
function
|
59185
|
-
return
|
59586
|
+
function isNarrowingSubstitutionType(type) {
|
59587
|
+
return !!(type.flags & 33554432 /* Substitution */ && type.objectFlags & 16777216 /* IsNarrowingType */);
|
59186
59588
|
}
|
59187
|
-
function
|
59188
|
-
|
59589
|
+
function getSubstitutionType(baseType, constraint, isNarrowed) {
|
59590
|
+
return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint, isNarrowed);
|
59591
|
+
}
|
59592
|
+
function getOrCreateSubstitutionType(baseType, constraint, isNarrowed) {
|
59593
|
+
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}${isNarrowed ? ">N" : ""}`;
|
59189
59594
|
const cached = substitutionTypes.get(id);
|
59190
59595
|
if (cached) {
|
59191
59596
|
return cached;
|
@@ -59193,6 +59598,9 @@ function createTypeChecker(host) {
|
|
59193
59598
|
const result = createType(33554432 /* Substitution */);
|
59194
59599
|
result.baseType = baseType;
|
59195
59600
|
result.constraint = constraint;
|
59601
|
+
if (isNarrowed) {
|
59602
|
+
result.objectFlags |= 16777216 /* IsNarrowingType */;
|
59603
|
+
}
|
59196
59604
|
substitutionTypes.set(id, result);
|
59197
59605
|
return result;
|
59198
59606
|
}
|
@@ -59254,6 +59662,9 @@ function createTypeChecker(host) {
|
|
59254
59662
|
case "Number":
|
59255
59663
|
checkNoTypeArguments(node);
|
59256
59664
|
return numberType;
|
59665
|
+
case "BigInt":
|
59666
|
+
checkNoTypeArguments(node);
|
59667
|
+
return bigintType;
|
59257
59668
|
case "Boolean":
|
59258
59669
|
checkNoTypeArguments(node);
|
59259
59670
|
return booleanType;
|
@@ -61395,7 +61806,7 @@ function createTypeChecker(host) {
|
|
61395
61806
|
function isDeferredType(type, checkTuples) {
|
61396
61807
|
return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
|
61397
61808
|
}
|
61398
|
-
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
|
61809
|
+
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing) {
|
61399
61810
|
let result;
|
61400
61811
|
let extraTypes;
|
61401
61812
|
let tailCount = 0;
|
@@ -61412,10 +61823,11 @@ function createTypeChecker(host) {
|
|
61412
61823
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
61413
61824
|
return wildcardType;
|
61414
61825
|
}
|
61826
|
+
const effectiveCheckType = forNarrowing && isNarrowingSubstitutionType(checkType) ? checkType.constraint : checkType;
|
61415
61827
|
const checkTypeNode = skipTypeParentheses(root.node.checkType);
|
61416
61828
|
const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
|
61417
61829
|
const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
|
61418
|
-
const checkTypeDeferred = isDeferredType(
|
61830
|
+
const checkTypeDeferred = isDeferredType(effectiveCheckType, checkTuples);
|
61419
61831
|
let combinedMapper;
|
61420
61832
|
if (root.inferTypeParameters) {
|
61421
61833
|
const context = createInferenceContext(
|
@@ -61434,8 +61846,8 @@ function createTypeChecker(host) {
|
|
61434
61846
|
}
|
61435
61847
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
61436
61848
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
61437
|
-
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (
|
61438
|
-
if (
|
61849
|
+
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (effectiveCheckType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(effectiveCheckType), getPermissiveInstantiation(inferredExtendsType)))) {
|
61850
|
+
if (effectiveCheckType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(effectiveCheckType)))) {
|
61439
61851
|
(extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
|
61440
61852
|
}
|
61441
61853
|
const falseType2 = getTypeFromTypeNode(root.node.falseType);
|
@@ -61452,7 +61864,7 @@ function createTypeChecker(host) {
|
|
61452
61864
|
result = instantiateType(falseType2, mapper);
|
61453
61865
|
break;
|
61454
61866
|
}
|
61455
|
-
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(
|
61867
|
+
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(effectiveCheckType), getRestrictiveInstantiation(inferredExtendsType))) {
|
61456
61868
|
const trueType2 = getTypeFromTypeNode(root.node.trueType);
|
61457
61869
|
const trueMapper = combinedMapper || mapper;
|
61458
61870
|
if (canTailRecurse(trueType2, trueMapper)) {
|
@@ -61807,7 +62219,7 @@ function createTypeChecker(host) {
|
|
61807
62219
|
return result;
|
61808
62220
|
}
|
61809
62221
|
function getIndexInfoWithReadonly(info, readonly) {
|
61810
|
-
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
|
62222
|
+
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration, info.components) : info;
|
61811
62223
|
}
|
61812
62224
|
function createLiteralType(flags, value, symbol, regularType) {
|
61813
62225
|
const type = createTypeWithSymbol(flags, symbol);
|
@@ -62418,8 +62830,39 @@ function createTypeChecker(host) {
|
|
62418
62830
|
if (!result) {
|
62419
62831
|
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
|
62420
62832
|
const checkType = root.checkType;
|
62421
|
-
|
62422
|
-
|
62833
|
+
let distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
|
62834
|
+
let narrowingBaseType;
|
62835
|
+
const forNarrowing = distributionType && isNarrowingSubstitutionType(distributionType) && isNarrowableConditionalType(type, mapper);
|
62836
|
+
if (forNarrowing) {
|
62837
|
+
narrowingBaseType = distributionType.baseType;
|
62838
|
+
distributionType = getReducedType(distributionType.constraint);
|
62839
|
+
}
|
62840
|
+
if (distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */)) {
|
62841
|
+
if (narrowingBaseType) {
|
62842
|
+
result = mapTypeToIntersection(
|
62843
|
+
distributionType,
|
62844
|
+
(t) => getConditionalType(
|
62845
|
+
root,
|
62846
|
+
prependTypeMapping(checkType, getSubstitutionType(
|
62847
|
+
narrowingBaseType,
|
62848
|
+
t,
|
62849
|
+
/*isNarrowed*/
|
62850
|
+
true
|
62851
|
+
), newMapper),
|
62852
|
+
forConstraint,
|
62853
|
+
/*aliasSymbol*/
|
62854
|
+
void 0,
|
62855
|
+
/*aliasTypeArguments*/
|
62856
|
+
void 0,
|
62857
|
+
forNarrowing
|
62858
|
+
)
|
62859
|
+
);
|
62860
|
+
} else {
|
62861
|
+
result = mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments);
|
62862
|
+
}
|
62863
|
+
} else {
|
62864
|
+
result = getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing);
|
62865
|
+
}
|
62423
62866
|
root.instantiations.set(id, result);
|
62424
62867
|
}
|
62425
62868
|
return result;
|
@@ -62566,7 +63009,7 @@ function createTypeChecker(host) {
|
|
62566
63009
|
return type.restrictiveInstantiation;
|
62567
63010
|
}
|
62568
63011
|
function instantiateIndexInfo(info, mapper) {
|
62569
|
-
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
|
63012
|
+
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration, info.components);
|
62570
63013
|
}
|
62571
63014
|
function isContextSensitive(node) {
|
62572
63015
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
@@ -63562,10 +64005,12 @@ function createTypeChecker(host) {
|
|
63562
64005
|
function shouldNormalizeIntersection(type) {
|
63563
64006
|
let hasInstantiable = false;
|
63564
64007
|
let hasNullableOrEmpty = false;
|
64008
|
+
let hasSubstitution = false;
|
63565
64009
|
for (const t of type.types) {
|
63566
64010
|
hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
|
63567
64011
|
hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
|
63568
|
-
|
64012
|
+
hasSubstitution || (hasSubstitution = isNarrowingSubstitutionType(t));
|
64013
|
+
if (hasInstantiable && hasNullableOrEmpty || hasSubstitution) return true;
|
63569
64014
|
}
|
63570
64015
|
return false;
|
63571
64016
|
}
|
@@ -66697,7 +67142,7 @@ function createTypeChecker(host) {
|
|
66697
67142
|
}
|
66698
67143
|
}
|
66699
67144
|
}
|
66700
|
-
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
|
67145
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly, info.declaration, info.components)));
|
66701
67146
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
66702
67147
|
return result;
|
66703
67148
|
}
|
@@ -68139,6 +68584,7 @@ function createTypeChecker(host) {
|
|
68139
68584
|
return target.kind === 108 /* SuperKeyword */;
|
68140
68585
|
case 235 /* NonNullExpression */:
|
68141
68586
|
case 217 /* ParenthesizedExpression */:
|
68587
|
+
case 238 /* SatisfiesExpression */:
|
68142
68588
|
return isMatchingReference(source.expression, target);
|
68143
68589
|
case 211 /* PropertyAccessExpression */:
|
68144
68590
|
case 212 /* ElementAccessExpression */:
|
@@ -68724,6 +69170,18 @@ function createTypeChecker(host) {
|
|
68724
69170
|
}
|
68725
69171
|
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
|
68726
69172
|
}
|
69173
|
+
function mapTypeToIntersection(type, mapper) {
|
69174
|
+
if (type.flags & 131072 /* Never */) {
|
69175
|
+
return type;
|
69176
|
+
}
|
69177
|
+
if (!(type.flags & 1048576 /* Union */)) {
|
69178
|
+
return mapper(type);
|
69179
|
+
}
|
69180
|
+
const origin = type.origin;
|
69181
|
+
const types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
69182
|
+
const mappedTypes = types.map((t) => t.flags & 1048576 /* Union */ ? mapTypeToIntersection(t, mapper) : mapper(t));
|
69183
|
+
return getIntersectionType(mappedTypes);
|
69184
|
+
}
|
68727
69185
|
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
68728
69186
|
return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper);
|
68729
69187
|
}
|
@@ -69989,6 +70447,7 @@ function createTypeChecker(host) {
|
|
69989
70447
|
if (checkDerived) {
|
69990
70448
|
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
69991
70449
|
}
|
70450
|
+
type = type.flags & 2 /* Unknown */ ? unknownUnionType : type;
|
69992
70451
|
const trueType2 = getNarrowedType(
|
69993
70452
|
type,
|
69994
70453
|
candidate,
|
@@ -69997,7 +70456,7 @@ function createTypeChecker(host) {
|
|
69997
70456
|
/*checkDerived*/
|
69998
70457
|
false
|
69999
70458
|
);
|
70000
|
-
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
70459
|
+
return recombineUnknownType(filterType(type, (t) => !isTypeSubsetOf(t, trueType2)));
|
70001
70460
|
}
|
70002
70461
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
70003
70462
|
return candidate;
|
@@ -70095,6 +70554,7 @@ function createTypeChecker(host) {
|
|
70095
70554
|
return narrowTypeByCallExpression(type, expr, assumeTrue);
|
70096
70555
|
case 217 /* ParenthesizedExpression */:
|
70097
70556
|
case 235 /* NonNullExpression */:
|
70557
|
+
case 238 /* SatisfiesExpression */:
|
70098
70558
|
return narrowType(type, expr.expression, assumeTrue);
|
70099
70559
|
case 226 /* BinaryExpression */:
|
70100
70560
|
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
|
@@ -70306,11 +70766,11 @@ function createTypeChecker(host) {
|
|
70306
70766
|
));
|
70307
70767
|
return contextualType && !isGenericType(contextualType);
|
70308
70768
|
}
|
70309
|
-
function getNarrowableTypeForReference(type, reference, checkMode) {
|
70769
|
+
function getNarrowableTypeForReference(type, reference, checkMode, forReturnTypeNarrowing) {
|
70310
70770
|
if (isNoInferType(type)) {
|
70311
70771
|
type = type.baseType;
|
70312
70772
|
}
|
70313
|
-
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
70773
|
+
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (forReturnTypeNarrowing || isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
70314
70774
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
70315
70775
|
}
|
70316
70776
|
function isExportOrExportExpression(location) {
|
@@ -70478,8 +70938,9 @@ function createTypeChecker(host) {
|
|
70478
70938
|
}
|
70479
70939
|
if (isJsxOpeningFragment(node)) {
|
70480
70940
|
const file = getSourceFileOfNode(node);
|
70481
|
-
const
|
70482
|
-
if (
|
70941
|
+
const entity = getJsxFactoryEntity(file);
|
70942
|
+
if (entity) {
|
70943
|
+
const localJsxNamespace = getFirstIdentifier(entity).escapedText;
|
70483
70944
|
resolveName(
|
70484
70945
|
jsxFactoryLocation,
|
70485
70946
|
localJsxNamespace,
|
@@ -71436,9 +71897,16 @@ function createTypeChecker(host) {
|
|
71436
71897
|
function getContextualTypeForReturnExpression(node, contextFlags) {
|
71437
71898
|
const func = getContainingFunction(node);
|
71438
71899
|
if (func) {
|
71900
|
+
const functionFlags = getFunctionFlags(func);
|
71901
|
+
const links = getNodeLinks(node);
|
71902
|
+
if (links.contextualReturnType) {
|
71903
|
+
if (functionFlags & 2 /* Async */) {
|
71904
|
+
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
71905
|
+
}
|
71906
|
+
return links.contextualReturnType;
|
71907
|
+
}
|
71439
71908
|
let contextualReturnType = getContextualReturnType(func, contextFlags);
|
71440
71909
|
if (contextualReturnType) {
|
71441
|
-
const functionFlags = getFunctionFlags(func);
|
71442
71910
|
if (functionFlags & 1 /* Generator */) {
|
71443
71911
|
const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0;
|
71444
71912
|
if (contextualReturnType.flags & 1048576 /* Union */) {
|
@@ -72136,6 +72604,13 @@ function createTypeChecker(host) {
|
|
72136
72604
|
if (index >= 0) {
|
72137
72605
|
return contextualTypes[index];
|
72138
72606
|
}
|
72607
|
+
const links = getNodeLinks(node);
|
72608
|
+
if (links.contextualReturnType) {
|
72609
|
+
if (node.flags & 65536 /* AwaitContext */) {
|
72610
|
+
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
72611
|
+
}
|
72612
|
+
return links.contextualReturnType;
|
72613
|
+
}
|
72139
72614
|
const { parent } = node;
|
72140
72615
|
switch (parent.kind) {
|
72141
72616
|
case 260 /* VariableDeclaration */:
|
@@ -72717,16 +73192,33 @@ function createTypeChecker(host) {
|
|
72717
73192
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
72718
73193
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
72719
73194
|
}
|
73195
|
+
function isSymbolWithComputedName(symbol) {
|
73196
|
+
var _a;
|
73197
|
+
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
73198
|
+
return firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name);
|
73199
|
+
}
|
72720
73200
|
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
73201
|
+
var _a;
|
72721
73202
|
const propTypes = [];
|
73203
|
+
let components;
|
72722
73204
|
for (let i = offset; i < properties.length; i++) {
|
72723
73205
|
const prop = properties[i];
|
72724
73206
|
if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
|
72725
73207
|
propTypes.push(getTypeOfSymbol(properties[i]));
|
73208
|
+
if (isSymbolWithComputedName(properties[i])) {
|
73209
|
+
components = append(components, (_a = properties[i].declarations) == null ? void 0 : _a[0]);
|
73210
|
+
}
|
72726
73211
|
}
|
72727
73212
|
}
|
72728
73213
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
72729
|
-
return createIndexInfo(
|
73214
|
+
return createIndexInfo(
|
73215
|
+
keyType,
|
73216
|
+
unionType,
|
73217
|
+
isReadonly,
|
73218
|
+
/*declaration*/
|
73219
|
+
void 0,
|
73220
|
+
components
|
73221
|
+
);
|
72730
73222
|
}
|
72731
73223
|
function getImmediateAliasedSymbol(symbol) {
|
72732
73224
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
@@ -73261,6 +73753,9 @@ function createTypeChecker(host) {
|
|
73261
73753
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
|
73262
73754
|
}
|
73263
73755
|
function getJsxElementChildrenPropertyName(jsxNamespace) {
|
73756
|
+
if (compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
73757
|
+
return "children";
|
73758
|
+
}
|
73264
73759
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
|
73265
73760
|
}
|
73266
73761
|
function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
|
@@ -74819,8 +75314,8 @@ function createTypeChecker(host) {
|
|
74819
75314
|
}
|
74820
75315
|
}
|
74821
75316
|
function getEffectiveCheckNode(argument) {
|
74822
|
-
|
74823
|
-
return
|
75317
|
+
const flags = isInJSFile(argument) ? 1 /* Parentheses */ | 32 /* Satisfies */ | -2147483648 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */ | 32 /* Satisfies */;
|
75318
|
+
return skipOuterExpressions(argument, flags);
|
74824
75319
|
}
|
74825
75320
|
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
|
74826
75321
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
@@ -75245,11 +75740,16 @@ function createTypeChecker(host) {
|
|
75245
75740
|
if (!result) {
|
75246
75741
|
result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
|
75247
75742
|
}
|
75743
|
+
const links = getNodeLinks(node);
|
75744
|
+
if (links.resolvedSignature !== resolvingSignature && !candidatesOutArray) {
|
75745
|
+
Debug.assert(links.resolvedSignature);
|
75746
|
+
return links.resolvedSignature;
|
75747
|
+
}
|
75248
75748
|
if (result) {
|
75249
75749
|
return result;
|
75250
75750
|
}
|
75251
75751
|
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
75252
|
-
|
75752
|
+
links.resolvedSignature = result;
|
75253
75753
|
if (reportErrors2) {
|
75254
75754
|
if (!headMessage && isInstanceof) {
|
75255
75755
|
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;
|
@@ -76135,12 +76635,9 @@ function createTypeChecker(host) {
|
|
76135
76635
|
resolutionStart = resolutionTargets.length;
|
76136
76636
|
}
|
76137
76637
|
links.resolvedSignature = resolvingSignature;
|
76138
|
-
|
76638
|
+
const result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
|
76139
76639
|
resolutionStart = saveResolutionStart;
|
76140
76640
|
if (result !== resolvingSignature) {
|
76141
|
-
if (links.resolvedSignature !== resolvingSignature) {
|
76142
|
-
result = links.resolvedSignature;
|
76143
|
-
}
|
76144
76641
|
links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
|
76145
76642
|
}
|
76146
76643
|
return result;
|
@@ -76719,12 +77216,12 @@ function createTypeChecker(host) {
|
|
76719
77216
|
}
|
76720
77217
|
}
|
76721
77218
|
function checkImportMetaProperty(node) {
|
76722
|
-
if (
|
77219
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
76723
77220
|
if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
|
76724
77221
|
error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
76725
77222
|
}
|
76726
77223
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
76727
|
-
error(node, Diagnostics.
|
77224
|
+
error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_or_nodenext);
|
76728
77225
|
}
|
76729
77226
|
const file = getSourceFileOfNode(node);
|
76730
77227
|
Debug.assert(!!(file.flags & 8388608 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
@@ -77553,7 +78050,7 @@ function createTypeChecker(host) {
|
|
77553
78050
|
}
|
77554
78051
|
return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
77555
78052
|
}
|
77556
|
-
const type = checkExpressionCached(node.expression);
|
78053
|
+
const type = getBaseConstraintOrType(checkExpressionCached(node.expression));
|
77557
78054
|
if (!isLiteralType(type)) {
|
77558
78055
|
return false;
|
77559
78056
|
}
|
@@ -77816,19 +78313,7 @@ function createTypeChecker(host) {
|
|
77816
78313
|
const exprType = checkExpression(node.body);
|
77817
78314
|
const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
|
77818
78315
|
if (returnOrPromisedType) {
|
77819
|
-
|
77820
|
-
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
77821
|
-
const awaitedType = checkAwaitedType(
|
77822
|
-
exprType,
|
77823
|
-
/*withAlias*/
|
77824
|
-
false,
|
77825
|
-
effectiveCheckNode,
|
77826
|
-
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
77827
|
-
);
|
77828
|
-
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
77829
|
-
} else {
|
77830
|
-
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
77831
|
-
}
|
78316
|
+
checkReturnExpression(node, returnOrPromisedType, node.body, node.body, exprType);
|
77832
78317
|
}
|
77833
78318
|
}
|
77834
78319
|
}
|
@@ -77882,7 +78367,7 @@ function createTypeChecker(host) {
|
|
77882
78367
|
}
|
77883
78368
|
if (isReadonlySymbol(symbol)) {
|
77884
78369
|
if (symbol.flags & 4 /* Property */ && isAccessExpression(expr) && expr.expression.kind === 110 /* ThisKeyword */) {
|
77885
|
-
const ctor =
|
78370
|
+
const ctor = getControlFlowContainer(expr);
|
77886
78371
|
if (!(ctor && (ctor.kind === 176 /* Constructor */ || isJSConstructor(ctor)))) {
|
77887
78372
|
return true;
|
77888
78373
|
}
|
@@ -77911,7 +78396,7 @@ function createTypeChecker(host) {
|
|
77911
78396
|
return false;
|
77912
78397
|
}
|
77913
78398
|
function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
|
77914
|
-
const node = skipOuterExpressions(expr,
|
78399
|
+
const node = skipOuterExpressions(expr, 38 /* Assertions */ | 1 /* Parentheses */);
|
77915
78400
|
if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
|
77916
78401
|
error(expr, invalidReferenceMessage);
|
77917
78402
|
return false;
|
@@ -77978,6 +78463,7 @@ function createTypeChecker(host) {
|
|
77978
78463
|
}
|
77979
78464
|
switch (moduleKind) {
|
77980
78465
|
case 100 /* Node16 */:
|
78466
|
+
case 101 /* Node18 */:
|
77981
78467
|
case 199 /* NodeNext */:
|
77982
78468
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
77983
78469
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
@@ -77998,7 +78484,7 @@ function createTypeChecker(host) {
|
|
77998
78484
|
// fallthrough
|
77999
78485
|
default:
|
78000
78486
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
78001
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
78487
|
+
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;
|
78002
78488
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
78003
78489
|
hasError = true;
|
78004
78490
|
break;
|
@@ -78562,7 +79048,7 @@ function createTypeChecker(host) {
|
|
78562
79048
|
if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
|
78563
79049
|
grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
|
78564
79050
|
}
|
78565
|
-
const leftTarget = skipOuterExpressions(left,
|
79051
|
+
const leftTarget = skipOuterExpressions(left, 63 /* All */);
|
78566
79052
|
const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
|
78567
79053
|
if (nullishSemantics !== 3 /* Sometimes */) {
|
78568
79054
|
if (node.parent.kind === 226 /* BinaryExpression */) {
|
@@ -79781,6 +80267,9 @@ function createTypeChecker(host) {
|
|
79781
80267
|
checkVariableLikeDeclaration(node);
|
79782
80268
|
const func = getContainingFunction(node);
|
79783
80269
|
if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
80270
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
80271
|
+
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
80272
|
+
}
|
79784
80273
|
if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
|
79785
80274
|
error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
79786
80275
|
}
|
@@ -83054,7 +83543,6 @@ function createTypeChecker(host) {
|
|
83054
83543
|
}
|
83055
83544
|
const signature = getSignatureFromDeclaration(container);
|
83056
83545
|
const returnType = getReturnTypeOfSignature(signature);
|
83057
|
-
const functionFlags = getFunctionFlags(container);
|
83058
83546
|
if (strictNullChecks || node.expression || returnType.flags & 131072 /* Never */) {
|
83059
83547
|
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
83060
83548
|
if (container.kind === 178 /* SetAccessor */) {
|
@@ -83062,26 +83550,249 @@ function createTypeChecker(host) {
|
|
83062
83550
|
error(node, Diagnostics.Setters_cannot_return_a_value);
|
83063
83551
|
}
|
83064
83552
|
} else if (container.kind === 176 /* Constructor */) {
|
83065
|
-
|
83553
|
+
const exprType2 = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
83554
|
+
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType2, returnType, node, node.expression)) {
|
83066
83555
|
error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
83067
83556
|
}
|
83068
83557
|
} else if (getReturnTypeFromAnnotation(container)) {
|
83069
|
-
const unwrappedReturnType = unwrapReturnType(returnType,
|
83070
|
-
|
83071
|
-
exprType,
|
83072
|
-
/*withAlias*/
|
83073
|
-
false,
|
83074
|
-
node,
|
83075
|
-
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
83076
|
-
) : exprType;
|
83077
|
-
if (unwrappedReturnType) {
|
83078
|
-
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression);
|
83079
|
-
}
|
83558
|
+
const unwrappedReturnType = unwrapReturnType(returnType, getFunctionFlags(container)) ?? returnType;
|
83559
|
+
checkReturnExpression(container, unwrappedReturnType, node, node.expression, exprType);
|
83080
83560
|
}
|
83081
83561
|
} else if (container.kind !== 176 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
83082
83562
|
error(node, Diagnostics.Not_all_code_paths_return_a_value);
|
83083
83563
|
}
|
83084
83564
|
}
|
83565
|
+
function checkReturnExpression(container, unwrappedReturnType, node, expr, exprType, inConditionalExpression = false) {
|
83566
|
+
const excludeJSDocTypeAssertions = isInJSFile(node);
|
83567
|
+
const functionFlags = getFunctionFlags(container);
|
83568
|
+
if (expr) {
|
83569
|
+
const unwrappedExpr = skipParentheses(expr, excludeJSDocTypeAssertions);
|
83570
|
+
if (isConditionalExpression(unwrappedExpr)) {
|
83571
|
+
checkReturnExpression(
|
83572
|
+
container,
|
83573
|
+
unwrappedReturnType,
|
83574
|
+
node,
|
83575
|
+
unwrappedExpr.whenTrue,
|
83576
|
+
checkExpression(unwrappedExpr.whenTrue),
|
83577
|
+
/*inConditionalExpression*/
|
83578
|
+
true
|
83579
|
+
);
|
83580
|
+
checkReturnExpression(
|
83581
|
+
container,
|
83582
|
+
unwrappedReturnType,
|
83583
|
+
node,
|
83584
|
+
unwrappedExpr.whenFalse,
|
83585
|
+
checkExpression(unwrappedExpr.whenFalse),
|
83586
|
+
/*inConditionalExpression*/
|
83587
|
+
true
|
83588
|
+
);
|
83589
|
+
return;
|
83590
|
+
}
|
83591
|
+
}
|
83592
|
+
const inReturnStatement = node.kind === 253 /* ReturnStatement */;
|
83593
|
+
const unwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
83594
|
+
exprType,
|
83595
|
+
/*withAlias*/
|
83596
|
+
false,
|
83597
|
+
node,
|
83598
|
+
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
83599
|
+
) : exprType;
|
83600
|
+
const effectiveExpr = expr && getEffectiveCheckNode(expr);
|
83601
|
+
const errorNode = inReturnStatement && !inConditionalExpression ? node : effectiveExpr;
|
83602
|
+
if (!(unwrappedReturnType.flags & (8388608 /* IndexedAccess */ | 16777216 /* Conditional */)) || !couldContainTypeVariables(unwrappedReturnType)) {
|
83603
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
83604
|
+
return;
|
83605
|
+
}
|
83606
|
+
if (checkTypeAssignableTo(
|
83607
|
+
unwrappedExprType,
|
83608
|
+
unwrappedReturnType,
|
83609
|
+
/*errorNode*/
|
83610
|
+
void 0
|
83611
|
+
)) {
|
83612
|
+
return;
|
83613
|
+
}
|
83614
|
+
let narrowPosition = node;
|
83615
|
+
let narrowFlowNode = inReturnStatement && node.flowNode;
|
83616
|
+
if (expr && isConditionalExpression(expr.parent)) {
|
83617
|
+
narrowFlowNode = expr.parent.whenTrue === expr ? expr.parent.flowNodeWhenTrue : expr.parent.flowNodeWhenFalse;
|
83618
|
+
narrowPosition = expr;
|
83619
|
+
}
|
83620
|
+
if (!narrowFlowNode) {
|
83621
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
83622
|
+
return;
|
83623
|
+
}
|
83624
|
+
const allTypeParameters = appendTypeParameters(getOuterTypeParameters(
|
83625
|
+
container,
|
83626
|
+
/*includeThisTypes*/
|
83627
|
+
false
|
83628
|
+
), getEffectiveTypeParameterDeclarations(container));
|
83629
|
+
const narrowableTypeParameters = allTypeParameters && getNarrowableTypeParameters(allTypeParameters);
|
83630
|
+
if (!narrowableTypeParameters || !narrowableTypeParameters.length || !isNarrowableReturnType(unwrappedReturnType)) {
|
83631
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
|
83632
|
+
return;
|
83633
|
+
}
|
83634
|
+
const narrowedTypeParameters = [];
|
83635
|
+
const narrowedTypes = [];
|
83636
|
+
for (const [typeParam, symbol, reference] of narrowableTypeParameters) {
|
83637
|
+
const narrowReference = factory.cloneNode(reference);
|
83638
|
+
narrowReference.id = void 0;
|
83639
|
+
getNodeLinks(narrowReference).resolvedSymbol = symbol;
|
83640
|
+
setParent(narrowReference, narrowPosition.parent);
|
83641
|
+
narrowReference.flowNode = narrowFlowNode;
|
83642
|
+
const initialType = getNarrowableTypeForReference(
|
83643
|
+
typeParam,
|
83644
|
+
narrowReference,
|
83645
|
+
/*checkMode*/
|
83646
|
+
void 0,
|
83647
|
+
/*forReturnTypeNarrowing*/
|
83648
|
+
true
|
83649
|
+
);
|
83650
|
+
if (initialType === typeParam) {
|
83651
|
+
continue;
|
83652
|
+
}
|
83653
|
+
const flowType = getFlowTypeOfReference(narrowReference, initialType);
|
83654
|
+
const exprType2 = getTypeFromFlowType(flowType);
|
83655
|
+
if (exprType2.flags & 3 /* AnyOrUnknown */ || isErrorType(exprType2) || exprType2 === typeParam || exprType2 === mapType(typeParam, getBaseConstraintOrType)) {
|
83656
|
+
continue;
|
83657
|
+
}
|
83658
|
+
const narrowedType = getSubstitutionType(
|
83659
|
+
typeParam,
|
83660
|
+
exprType2,
|
83661
|
+
/*isNarrowed*/
|
83662
|
+
true
|
83663
|
+
);
|
83664
|
+
narrowedTypeParameters.push(typeParam);
|
83665
|
+
narrowedTypes.push(narrowedType);
|
83666
|
+
}
|
83667
|
+
const narrowMapper = createTypeMapper(narrowedTypeParameters, narrowedTypes);
|
83668
|
+
const narrowedReturnType = instantiateType(
|
83669
|
+
unwrappedReturnType,
|
83670
|
+
narrowMapper
|
83671
|
+
);
|
83672
|
+
if (expr) {
|
83673
|
+
const links = getNodeLinks(expr);
|
83674
|
+
if (!links.contextualReturnType) {
|
83675
|
+
links.contextualReturnType = narrowedReturnType;
|
83676
|
+
}
|
83677
|
+
}
|
83678
|
+
const narrowedExprType = expr ? checkExpression(expr) : undefinedType;
|
83679
|
+
const narrowedUnwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
83680
|
+
narrowedExprType,
|
83681
|
+
/*withAlias*/
|
83682
|
+
false,
|
83683
|
+
node,
|
83684
|
+
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
83685
|
+
) : narrowedExprType;
|
83686
|
+
checkTypeAssignableToAndOptionallyElaborate(narrowedUnwrappedExprType, narrowedReturnType, errorNode, effectiveExpr);
|
83687
|
+
}
|
83688
|
+
function getNarrowableTypeParameters(candidates) {
|
83689
|
+
const narrowableParams = [];
|
83690
|
+
for (const typeParam of candidates) {
|
83691
|
+
const constraint = getConstraintOfTypeParameter(typeParam);
|
83692
|
+
if (!constraint || !(constraint.flags & 1048576 /* Union */)) continue;
|
83693
|
+
if (typeParam.symbol && typeParam.symbol.declarations && typeParam.symbol.declarations.length === 1) {
|
83694
|
+
const declaration = typeParam.symbol.declarations[0];
|
83695
|
+
const container = isJSDocTemplateTag(declaration.parent) ? getJSDocHost(declaration.parent) : declaration.parent;
|
83696
|
+
if (!isFunctionLike(container)) continue;
|
83697
|
+
let reference;
|
83698
|
+
let hasInvalidReference = false;
|
83699
|
+
for (const paramDecl of container.parameters) {
|
83700
|
+
const typeNode = getEffectiveTypeAnnotationNode(paramDecl);
|
83701
|
+
if (!typeNode) continue;
|
83702
|
+
if (isTypeParameterReferenced(typeParam, typeNode)) {
|
83703
|
+
let candidateReference;
|
83704
|
+
if (isTypeReferenceNode(typeNode) && isReferenceToTypeParameter(typeParam, typeNode) && (candidateReference = getValidParameterReference(paramDecl, constraint))) {
|
83705
|
+
if (reference) {
|
83706
|
+
hasInvalidReference = true;
|
83707
|
+
break;
|
83708
|
+
}
|
83709
|
+
reference = candidateReference;
|
83710
|
+
} else {
|
83711
|
+
hasInvalidReference = true;
|
83712
|
+
break;
|
83713
|
+
}
|
83714
|
+
}
|
83715
|
+
}
|
83716
|
+
if (!hasInvalidReference && reference) {
|
83717
|
+
const symbol = getResolvedSymbol(reference);
|
83718
|
+
if (symbol !== unknownSymbol) narrowableParams.push([typeParam, symbol, reference]);
|
83719
|
+
}
|
83720
|
+
}
|
83721
|
+
}
|
83722
|
+
return narrowableParams;
|
83723
|
+
function getValidParameterReference(paramDecl, constraint) {
|
83724
|
+
if (!isIdentifier(paramDecl.name)) return;
|
83725
|
+
const isOptional = !!paramDecl.questionToken || isJSDocOptionalParameter(paramDecl);
|
83726
|
+
if (isOptional && !containsUndefinedType(constraint)) return;
|
83727
|
+
return paramDecl.name;
|
83728
|
+
}
|
83729
|
+
function isReferenceToTypeParameter(typeParam, node) {
|
83730
|
+
return getTypeFromTypeReference(node) === typeParam;
|
83731
|
+
}
|
83732
|
+
function isTypeParameterReferenced(typeParam, node) {
|
83733
|
+
return isReferenced(node);
|
83734
|
+
function isReferenced(node2) {
|
83735
|
+
if (isTypeReferenceNode(node2)) {
|
83736
|
+
return isReferenceToTypeParameter(typeParam, node2);
|
83737
|
+
}
|
83738
|
+
if (isTypeQueryNode(node2)) {
|
83739
|
+
return isTypeParameterPossiblyReferenced(typeParam, node2);
|
83740
|
+
}
|
83741
|
+
return !!forEachChild(node2, isReferenced);
|
83742
|
+
}
|
83743
|
+
}
|
83744
|
+
}
|
83745
|
+
function isNarrowableReturnType(returnType) {
|
83746
|
+
return isConditionalType(returnType) ? isNarrowableConditionalType(returnType) : !!(returnType.indexType.flags & 262144 /* TypeParameter */);
|
83747
|
+
}
|
83748
|
+
function isNarrowableConditionalType(type, mapper) {
|
83749
|
+
const typeArguments = mapper && map(type.root.outerTypeParameters, (t) => {
|
83750
|
+
const mapped = getMappedType(t, mapper);
|
83751
|
+
if (isNarrowingSubstitutionType(mapped)) {
|
83752
|
+
return mapped.baseType;
|
83753
|
+
}
|
83754
|
+
return mapped;
|
83755
|
+
});
|
83756
|
+
const id = `${type.id}:${getTypeListId(typeArguments)}`;
|
83757
|
+
let result = narrowableReturnTypeCache.get(id);
|
83758
|
+
if (result === void 0) {
|
83759
|
+
const nonNarrowingMapper = type.root.outerTypeParameters && typeArguments && createTypeMapper(type.root.outerTypeParameters, typeArguments);
|
83760
|
+
const instantiatedType = instantiateType(type, nonNarrowingMapper);
|
83761
|
+
result = isConditionalType(instantiatedType) && isNarrowableConditionalTypeWorker(instantiatedType);
|
83762
|
+
narrowableReturnTypeCache.set(id, result);
|
83763
|
+
}
|
83764
|
+
return result;
|
83765
|
+
}
|
83766
|
+
function isNarrowableConditionalTypeWorker(type) {
|
83767
|
+
if (!type.root.isDistributive) {
|
83768
|
+
return false;
|
83769
|
+
}
|
83770
|
+
if (type.root.inferTypeParameters) {
|
83771
|
+
return false;
|
83772
|
+
}
|
83773
|
+
if (!(type.checkType.flags & 262144 /* TypeParameter */)) {
|
83774
|
+
return false;
|
83775
|
+
}
|
83776
|
+
const constraintType = getConstraintOfTypeParameter(type.checkType);
|
83777
|
+
if (!constraintType || !(constraintType.flags & 1048576 /* Union */)) {
|
83778
|
+
return false;
|
83779
|
+
}
|
83780
|
+
if (!everyType(type.extendsType, (extendsType) => some(
|
83781
|
+
constraintType.types,
|
83782
|
+
(constraintType2) => isTypeIdenticalTo(constraintType2, extendsType)
|
83783
|
+
))) {
|
83784
|
+
return false;
|
83785
|
+
}
|
83786
|
+
const trueType2 = getTrueTypeFromConditionalType(type);
|
83787
|
+
const isValidTrueType = isConditionalType(trueType2) ? isNarrowableConditionalType(trueType2) : true;
|
83788
|
+
if (!isValidTrueType) return false;
|
83789
|
+
const falseType2 = getFalseTypeFromConditionalType(type);
|
83790
|
+
const isValidFalseType = isConditionalType(falseType2) ? isNarrowableConditionalType(falseType2) : falseType2 === neverType;
|
83791
|
+
return isValidFalseType;
|
83792
|
+
}
|
83793
|
+
function isConditionalType(type) {
|
83794
|
+
return !!(type.flags & 16777216 /* Conditional */);
|
83795
|
+
}
|
83085
83796
|
function checkWithStatement(node) {
|
83086
83797
|
if (!checkGrammarStatementInAmbientContext(node)) {
|
83087
83798
|
if (node.flags & 65536 /* AwaitContext */) {
|
@@ -83213,7 +83924,7 @@ function createTypeChecker(host) {
|
|
83213
83924
|
const typeDeclaration = symbol.valueDeclaration;
|
83214
83925
|
if (typeDeclaration && isClassLike(typeDeclaration)) {
|
83215
83926
|
for (const member of typeDeclaration.members) {
|
83216
|
-
if (!isStatic(member) && !hasBindableName(member)) {
|
83927
|
+
if ((!isStaticIndex && !isStatic(member) || isStaticIndex && isStatic(member)) && !hasBindableName(member)) {
|
83217
83928
|
const symbol2 = getSymbolOfDeclaration(member);
|
83218
83929
|
checkIndexConstraintForProperty(type, symbol2, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol2));
|
83219
83930
|
}
|
@@ -83664,6 +84375,13 @@ function createTypeChecker(host) {
|
|
83664
84375
|
function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, member, errorNode) {
|
83665
84376
|
const isJs = isInJSFile(node);
|
83666
84377
|
const nodeInAmbientContext = !!(node.flags & 33554432 /* Ambient */);
|
84378
|
+
if (memberHasOverrideModifier && (member == null ? void 0 : member.valueDeclaration) && isClassElement(member.valueDeclaration) && member.valueDeclaration.name && isNonBindableDynamicName(member.valueDeclaration.name)) {
|
84379
|
+
error(
|
84380
|
+
errorNode,
|
84381
|
+
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
|
84382
|
+
);
|
84383
|
+
return 2 /* HasInvalidOverride */;
|
84384
|
+
}
|
83667
84385
|
if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
|
83668
84386
|
const thisType = memberIsStatic ? staticType : typeWithThis;
|
83669
84387
|
const baseType = memberIsStatic ? baseStaticType : baseWithThis;
|
@@ -84256,6 +84974,9 @@ function createTypeChecker(host) {
|
|
84256
84974
|
checkCollisionsForDeclarationName(node, node.name);
|
84257
84975
|
checkExportsOnMergedDeclarations(node);
|
84258
84976
|
node.members.forEach(checkEnumMember);
|
84977
|
+
if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
|
84978
|
+
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
84979
|
+
}
|
84259
84980
|
computeEnumMemberValues(node);
|
84260
84981
|
const enumSymbol = getSymbolOfDeclaration(node);
|
84261
84982
|
const firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
|
@@ -84357,6 +85078,9 @@ function createTypeChecker(host) {
|
|
84357
85078
|
checkExportsOnMergedDeclarations(node);
|
84358
85079
|
const symbol = getSymbolOfDeclaration(node);
|
84359
85080
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
85081
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
85082
|
+
error(node.name, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
85083
|
+
}
|
84360
85084
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
84361
85085
|
error(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);
|
84362
85086
|
}
|
@@ -84670,10 +85394,20 @@ function createTypeChecker(host) {
|
|
84670
85394
|
if (validForTypeAttributes && override) {
|
84671
85395
|
return;
|
84672
85396
|
}
|
84673
|
-
|
84674
|
-
|
84675
|
-
|
84676
|
-
|
85397
|
+
if (!moduleSupportsImportAttributes(moduleKind)) {
|
85398
|
+
return grammarErrorOnNode(
|
85399
|
+
node,
|
85400
|
+
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
|
85401
|
+
);
|
85402
|
+
}
|
85403
|
+
if (moduleKind === 199 /* NodeNext */ && !isImportAttributes2) {
|
85404
|
+
return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_asserts);
|
85405
|
+
}
|
85406
|
+
if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === 1 /* CommonJS */) {
|
85407
|
+
return grammarErrorOnNode(
|
85408
|
+
node,
|
85409
|
+
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
|
85410
|
+
);
|
84677
85411
|
}
|
84678
85412
|
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly);
|
84679
85413
|
if (isTypeOnly) {
|
@@ -84714,7 +85448,7 @@ function createTypeChecker(host) {
|
|
84714
85448
|
}
|
84715
85449
|
}
|
84716
85450
|
}
|
84717
|
-
if (!importClause.isTypeOnly && moduleKind
|
85451
|
+
if (!importClause.isTypeOnly && 101 /* Node18 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
84718
85452
|
error(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]);
|
84719
85453
|
}
|
84720
85454
|
} else if (noUncheckedSideEffectImports && !importClause) {
|
@@ -84734,7 +85468,11 @@ function createTypeChecker(host) {
|
|
84734
85468
|
return;
|
84735
85469
|
}
|
84736
85470
|
checkGrammarModifiers(node);
|
84737
|
-
|
85471
|
+
const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
|
85472
|
+
if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
85473
|
+
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
85474
|
+
}
|
85475
|
+
if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
|
84738
85476
|
checkImportBinding(node);
|
84739
85477
|
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
84740
85478
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
@@ -86999,6 +87737,35 @@ function createTypeChecker(host) {
|
|
86999
87737
|
for (const info of infoList) {
|
87000
87738
|
if (info.declaration) continue;
|
87001
87739
|
if (info === anyBaseTypeIndexInfo) continue;
|
87740
|
+
if (info.components) {
|
87741
|
+
const allComponentComputedNamesSerializable = every(info.components, (e) => {
|
87742
|
+
var _a;
|
87743
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && enclosing && ((_a = isEntityNameVisible(
|
87744
|
+
e.name.expression,
|
87745
|
+
enclosing,
|
87746
|
+
/*shouldComputeAliasToMakeVisible*/
|
87747
|
+
false
|
87748
|
+
)) == null ? void 0 : _a.accessibility) === 0 /* Accessible */);
|
87749
|
+
});
|
87750
|
+
if (allComponentComputedNamesSerializable) {
|
87751
|
+
const newComponents = filter(info.components, (e) => {
|
87752
|
+
return !hasLateBindableName(e);
|
87753
|
+
});
|
87754
|
+
result.push(...map(newComponents, (e) => {
|
87755
|
+
trackComputedName(e.name.expression);
|
87756
|
+
const mods = infoList === staticInfos ? [factory.createModifier(126 /* StaticKeyword */)] : void 0;
|
87757
|
+
return factory.createPropertyDeclaration(
|
87758
|
+
append(mods, info.isReadonly ? factory.createModifier(148 /* ReadonlyKeyword */) : void 0),
|
87759
|
+
e.name,
|
87760
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
87761
|
+
nodeBuilder.typeToTypeNode(getTypeOfSymbol(e.symbol), enclosing, flags, internalFlags, tracker),
|
87762
|
+
/*initializer*/
|
87763
|
+
void 0
|
87764
|
+
);
|
87765
|
+
}));
|
87766
|
+
continue;
|
87767
|
+
}
|
87768
|
+
}
|
87002
87769
|
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
87003
87770
|
if (node && infoList === staticInfos) {
|
87004
87771
|
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
@@ -87009,6 +87776,22 @@ function createTypeChecker(host) {
|
|
87009
87776
|
}
|
87010
87777
|
}
|
87011
87778
|
return result;
|
87779
|
+
function trackComputedName(accessExpression) {
|
87780
|
+
if (!tracker.trackSymbol) return;
|
87781
|
+
const firstIdentifier = getFirstIdentifier(accessExpression);
|
87782
|
+
const name = resolveName(
|
87783
|
+
firstIdentifier,
|
87784
|
+
firstIdentifier.escapedText,
|
87785
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
87786
|
+
/*nameNotFoundMessage*/
|
87787
|
+
void 0,
|
87788
|
+
/*isUse*/
|
87789
|
+
true
|
87790
|
+
);
|
87791
|
+
if (name) {
|
87792
|
+
tracker.trackSymbol(name, enclosing, 111551 /* Value */);
|
87793
|
+
}
|
87794
|
+
}
|
87012
87795
|
}
|
87013
87796
|
};
|
87014
87797
|
function isImportRequiredByAugmentation(node) {
|
@@ -88090,6 +88873,7 @@ function createTypeChecker(host) {
|
|
88090
88873
|
}
|
88091
88874
|
switch (moduleKind) {
|
88092
88875
|
case 100 /* Node16 */:
|
88876
|
+
case 101 /* Node18 */:
|
88093
88877
|
case 199 /* NodeNext */:
|
88094
88878
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
88095
88879
|
diagnostics.add(
|
@@ -88108,7 +88892,7 @@ function createTypeChecker(host) {
|
|
88108
88892
|
// fallthrough
|
88109
88893
|
default:
|
88110
88894
|
diagnostics.add(
|
88111
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
88895
|
+
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)
|
88112
88896
|
);
|
88113
88897
|
break;
|
88114
88898
|
}
|
@@ -88252,7 +89036,7 @@ function createTypeChecker(host) {
|
|
88252
89036
|
}
|
88253
89037
|
}
|
88254
89038
|
function checkGrammarForInvalidDynamicName(node, message) {
|
88255
|
-
if (isNonBindableDynamicName(node)) {
|
89039
|
+
if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : node.expression)) {
|
88256
89040
|
return grammarErrorOnNode(node, message);
|
88257
89041
|
}
|
88258
89042
|
}
|
@@ -88711,17 +89495,17 @@ function createTypeChecker(host) {
|
|
88711
89495
|
return grammarErrorOnNode(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
88712
89496
|
}
|
88713
89497
|
if (moduleKind === 5 /* ES2015 */) {
|
88714
|
-
return grammarErrorOnNode(node, Diagnostics.
|
89498
|
+
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);
|
88715
89499
|
}
|
88716
89500
|
if (node.typeArguments) {
|
88717
89501
|
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);
|
88718
89502
|
}
|
88719
89503
|
const nodeArguments = node.arguments;
|
88720
|
-
if (
|
89504
|
+
if (!(100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
88721
89505
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
88722
89506
|
if (nodeArguments.length > 1) {
|
88723
89507
|
const importAttributesArgument = nodeArguments[1];
|
88724
|
-
return grammarErrorOnNode(importAttributesArgument, Diagnostics.
|
89508
|
+
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_nodenext_or_preserve);
|
88725
89509
|
}
|
88726
89510
|
}
|
88727
89511
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
@@ -93056,7 +93840,7 @@ function transformTypeScript(context) {
|
|
93056
93840
|
return updated;
|
93057
93841
|
}
|
93058
93842
|
function visitParenthesizedExpression(node) {
|
93059
|
-
const innerExpression = skipOuterExpressions(node.expression, ~(
|
93843
|
+
const innerExpression = skipOuterExpressions(node.expression, ~(38 /* Assertions */ | 16 /* ExpressionsWithTypeArguments */));
|
93060
93844
|
if (isAssertionExpression(innerExpression) || isSatisfiesExpression(innerExpression)) {
|
93061
93845
|
const expression = visitNode(node.expression, visitor, isExpression);
|
93062
93846
|
Debug.assert(expression);
|
@@ -112215,11 +112999,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
112215
112999
|
if (isSetAccessor(node.parent)) {
|
112216
113000
|
return createAccessorTypeError(node.parent);
|
112217
113001
|
}
|
112218
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
112219
|
-
node,
|
112220
|
-
/*enclosingDeclaration*/
|
112221
|
-
void 0
|
112222
|
-
);
|
113002
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node, node.parent);
|
112223
113003
|
if (!addUndefined && node.initializer) {
|
112224
113004
|
return createExpressionError(node.initializer);
|
112225
113005
|
}
|
@@ -113903,6 +114683,7 @@ function getModuleTransformer(moduleKind) {
|
|
113903
114683
|
case 6 /* ES2020 */:
|
113904
114684
|
case 5 /* ES2015 */:
|
113905
114685
|
case 100 /* Node16 */:
|
114686
|
+
case 101 /* Node18 */:
|
113906
114687
|
case 199 /* NodeNext */:
|
113907
114688
|
case 1 /* CommonJS */:
|
113908
114689
|
return transformImpliedNodeFormatDependentModule;
|
@@ -120409,45 +121190,6 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
|
|
120409
121190
|
}
|
120410
121191
|
return resolutions;
|
120411
121192
|
}
|
120412
|
-
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
120413
|
-
return forEachProjectReference(
|
120414
|
-
/*projectReferences*/
|
120415
|
-
void 0,
|
120416
|
-
resolvedProjectReferences,
|
120417
|
-
(resolvedRef, parent) => resolvedRef && cb(resolvedRef, parent)
|
120418
|
-
);
|
120419
|
-
}
|
120420
|
-
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
120421
|
-
let seenResolvedRefs;
|
120422
|
-
return worker(
|
120423
|
-
projectReferences,
|
120424
|
-
resolvedProjectReferences,
|
120425
|
-
/*parent*/
|
120426
|
-
void 0
|
120427
|
-
);
|
120428
|
-
function worker(projectReferences2, resolvedProjectReferences2, parent) {
|
120429
|
-
if (cbRef) {
|
120430
|
-
const result = cbRef(projectReferences2, parent);
|
120431
|
-
if (result) return result;
|
120432
|
-
}
|
120433
|
-
let skipChildren;
|
120434
|
-
return forEach(
|
120435
|
-
resolvedProjectReferences2,
|
120436
|
-
(resolvedRef, index) => {
|
120437
|
-
if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
|
120438
|
-
(skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
|
120439
|
-
return void 0;
|
120440
|
-
}
|
120441
|
-
const result = cbResolvedRef(resolvedRef, parent, index);
|
120442
|
-
if (result || !resolvedRef) return result;
|
120443
|
-
(seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
|
120444
|
-
}
|
120445
|
-
) || forEach(
|
120446
|
-
resolvedProjectReferences2,
|
120447
|
-
(resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
|
120448
|
-
);
|
120449
|
-
}
|
120450
|
-
}
|
120451
121193
|
var inferredTypesContainingFile = "__inferred type names__.ts";
|
120452
121194
|
function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
|
120453
121195
|
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
@@ -120463,13 +121205,6 @@ function getLibraryNameFromLibFileName(libFileName) {
|
|
120463
121205
|
}
|
120464
121206
|
return "@typescript/lib-" + path;
|
120465
121207
|
}
|
120466
|
-
function getLibNameFromLibReference(libReference) {
|
120467
|
-
return toFileNameLowerCase(libReference.fileName);
|
120468
|
-
}
|
120469
|
-
function getLibFileNameFromLibReference(libReference) {
|
120470
|
-
const libName = getLibNameFromLibReference(libReference);
|
120471
|
-
return libMap.get(libName);
|
120472
|
-
}
|
120473
121208
|
function isReferencedFile(reason) {
|
120474
121209
|
switch (reason == null ? void 0 : reason.kind) {
|
120475
121210
|
case 3 /* Import */:
|
@@ -120683,11 +121418,13 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
|
|
120683
121418
|
typeScriptVersion: typeScriptVersion2
|
120684
121419
|
};
|
120685
121420
|
}
|
120686
|
-
function createProgram(
|
121421
|
+
function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
120687
121422
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
120688
|
-
|
120689
|
-
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } =
|
120690
|
-
let { oldProgram } =
|
121423
|
+
let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
|
121424
|
+
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2, host: createProgramOptionsHost } = _createProgramOptions;
|
121425
|
+
let { oldProgram } = _createProgramOptions;
|
121426
|
+
_createProgramOptions = void 0;
|
121427
|
+
_rootNamesOrOptions = void 0;
|
120691
121428
|
for (const option of commandLineOptionOfCustomType) {
|
120692
121429
|
if (hasProperty(options, option.name)) {
|
120693
121430
|
if (typeof options[option.name] === "string") {
|
@@ -120700,16 +121437,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
120700
121437
|
let processingOtherFiles;
|
120701
121438
|
let files;
|
120702
121439
|
let symlinks;
|
120703
|
-
let commonSourceDirectory;
|
120704
121440
|
let typeChecker;
|
120705
121441
|
let classifiableNames;
|
120706
|
-
let fileReasons = createMultiMap();
|
120707
121442
|
let filesWithReferencesProcessed;
|
120708
|
-
let fileReasonsToChain;
|
120709
|
-
let reasonToRelatedInfo;
|
120710
121443
|
let cachedBindAndCheckDiagnosticsForFile;
|
120711
121444
|
let cachedDeclarationDiagnosticsForFile;
|
120712
|
-
|
121445
|
+
const programDiagnostics = createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax);
|
120713
121446
|
let automaticTypeDirectiveNames;
|
120714
121447
|
let automaticTypeDirectiveResolutions;
|
120715
121448
|
let resolvedLibReferences;
|
@@ -120731,13 +121464,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
120731
121464
|
true
|
120732
121465
|
);
|
120733
121466
|
mark("beforeProgram");
|
120734
|
-
const host =
|
121467
|
+
const host = createProgramOptionsHost || createCompilerHost(options);
|
120735
121468
|
const configParsingHost = parseConfigHostFromCompilerHostLike(host);
|
120736
121469
|
let skipDefaultLib = options.noLib;
|
120737
121470
|
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
|
120738
121471
|
const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
|
120739
|
-
|
120740
|
-
let lazyProgramDiagnosticExplainingFile = [];
|
121472
|
+
let skipVerifyCompilerOptions = false;
|
120741
121473
|
const currentDirectory = host.getCurrentDirectory();
|
120742
121474
|
const supportedExtensions = getSupportedExtensions(options);
|
120743
121475
|
const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
@@ -121015,7 +121747,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121015
121747
|
getTypeCount: () => getTypeChecker().getTypeCount(),
|
121016
121748
|
getInstantiationCount: () => getTypeChecker().getInstantiationCount(),
|
121017
121749
|
getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
|
121018
|
-
getFileProcessingDiagnostics: () =>
|
121750
|
+
getFileProcessingDiagnostics: () => programDiagnostics.getFileProcessingDiagnostics(),
|
121019
121751
|
getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
|
121020
121752
|
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
121021
121753
|
isSourceFileFromExternalLibrary,
|
@@ -121031,6 +121763,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121031
121763
|
resolvedModules,
|
121032
121764
|
resolvedTypeReferenceDirectiveNames,
|
121033
121765
|
resolvedLibReferences,
|
121766
|
+
getProgramDiagnosticsContainer: () => programDiagnostics,
|
121034
121767
|
getResolvedModule,
|
121035
121768
|
getResolvedModuleFromModuleSpecifier,
|
121036
121769
|
getResolvedTypeReferenceDirective,
|
@@ -121063,70 +121796,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121063
121796
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
121064
121797
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
121065
121798
|
getCanonicalFileName,
|
121066
|
-
getFileIncludeReasons: () =>
|
121799
|
+
getFileIncludeReasons: () => programDiagnostics.getFileReasons(),
|
121067
121800
|
structureIsReused,
|
121068
121801
|
writeFile: writeFile2,
|
121069
121802
|
getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
|
121070
121803
|
};
|
121071
121804
|
onProgramCreateComplete();
|
121072
|
-
|
121805
|
+
if (!skipVerifyCompilerOptions) {
|
121806
|
+
verifyCompilerOptions();
|
121807
|
+
}
|
121073
121808
|
mark("afterProgram");
|
121074
121809
|
measure("Program", "beforeProgram", "afterProgram");
|
121075
121810
|
(_p = tracing) == null ? void 0 : _p.pop();
|
121076
121811
|
return program;
|
121077
|
-
function updateAndGetProgramDiagnostics() {
|
121078
|
-
if (lazyProgramDiagnosticExplainingFile) {
|
121079
|
-
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
121080
|
-
switch (diagnostic.kind) {
|
121081
|
-
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
121082
|
-
return programDiagnostics.add(
|
121083
|
-
createDiagnosticExplainingFile(
|
121084
|
-
diagnostic.file && getSourceFileByPath(diagnostic.file),
|
121085
|
-
diagnostic.fileProcessingReason,
|
121086
|
-
diagnostic.diagnostic,
|
121087
|
-
diagnostic.args || emptyArray
|
121088
|
-
)
|
121089
|
-
);
|
121090
|
-
case 0 /* FilePreprocessingLibReferenceDiagnostic */:
|
121091
|
-
return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
|
121092
|
-
case 2 /* ResolutionDiagnostics */:
|
121093
|
-
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
121094
|
-
default:
|
121095
|
-
Debug.assertNever(diagnostic);
|
121096
|
-
}
|
121097
|
-
});
|
121098
|
-
lazyProgramDiagnosticExplainingFile.forEach(
|
121099
|
-
({ file, diagnostic, args }) => programDiagnostics.add(
|
121100
|
-
createDiagnosticExplainingFile(
|
121101
|
-
file,
|
121102
|
-
/*fileProcessingReason*/
|
121103
|
-
void 0,
|
121104
|
-
diagnostic,
|
121105
|
-
args
|
121106
|
-
)
|
121107
|
-
)
|
121108
|
-
);
|
121109
|
-
lazyProgramDiagnosticExplainingFile = void 0;
|
121110
|
-
fileReasonsToChain = void 0;
|
121111
|
-
reasonToRelatedInfo = void 0;
|
121112
|
-
}
|
121113
|
-
return programDiagnostics;
|
121114
|
-
}
|
121115
|
-
function filePreprocessingLibreferenceDiagnostic({ reason }) {
|
121116
|
-
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
121117
|
-
const libReference = file.libReferenceDirectives[reason.index];
|
121118
|
-
const libName = getLibNameFromLibReference(libReference);
|
121119
|
-
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
121120
|
-
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
121121
|
-
return createFileDiagnostic(
|
121122
|
-
file,
|
121123
|
-
Debug.checkDefined(pos),
|
121124
|
-
Debug.checkDefined(end) - pos,
|
121125
|
-
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
121126
|
-
libName,
|
121127
|
-
suggestion
|
121128
|
-
);
|
121129
|
-
}
|
121130
121812
|
function getResolvedModule(file, moduleName, mode) {
|
121131
121813
|
var _a2;
|
121132
121814
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
@@ -121175,7 +121857,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121175
121857
|
function addResolutionDiagnostics(resolution) {
|
121176
121858
|
var _a2;
|
121177
121859
|
if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length)) return;
|
121178
|
-
|
121860
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
121179
121861
|
kind: 2 /* ResolutionDiagnostics */,
|
121180
121862
|
diagnostics: resolution.resolutionDiagnostics
|
121181
121863
|
});
|
@@ -121269,16 +121951,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121269
121951
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
121270
121952
|
}
|
121271
121953
|
function getCommonSourceDirectory2() {
|
121272
|
-
|
121273
|
-
|
121274
|
-
commonSourceDirectory
|
121275
|
-
options,
|
121276
|
-
() => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
|
121277
|
-
currentDirectory,
|
121278
|
-
getCanonicalFileName,
|
121279
|
-
(commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
|
121280
|
-
);
|
121954
|
+
let commonSourceDirectory = programDiagnostics.getCommonSourceDirectory();
|
121955
|
+
if (commonSourceDirectory !== void 0) {
|
121956
|
+
return commonSourceDirectory;
|
121281
121957
|
}
|
121958
|
+
const emittedFiles = filter(files, (file) => sourceFileMayBeEmitted(file, program));
|
121959
|
+
commonSourceDirectory = getCommonSourceDirectory(
|
121960
|
+
options,
|
121961
|
+
() => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
|
121962
|
+
currentDirectory,
|
121963
|
+
getCanonicalFileName,
|
121964
|
+
(commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
|
121965
|
+
);
|
121966
|
+
programDiagnostics.setCommonSourceDirectory(commonSourceDirectory);
|
121282
121967
|
return commonSourceDirectory;
|
121283
121968
|
}
|
121284
121969
|
function getClassifiableNames() {
|
@@ -121589,9 +122274,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121589
122274
|
}
|
121590
122275
|
filesByName.set(path, filesByName.get(oldFile.path));
|
121591
122276
|
});
|
122277
|
+
const isConfigIdentical = oldOptions.configFile && oldOptions.configFile === options.configFile || !oldOptions.configFile && !options.configFile && !optionsHaveChanges(oldOptions, options, optionDeclarations);
|
122278
|
+
programDiagnostics.reuseStateFromOldProgram(oldProgram.getProgramDiagnosticsContainer(), isConfigIdentical);
|
122279
|
+
skipVerifyCompilerOptions = isConfigIdentical;
|
121592
122280
|
files = newSourceFiles;
|
121593
|
-
fileReasons = oldProgram.getFileIncludeReasons();
|
121594
|
-
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
121595
122281
|
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
121596
122282
|
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
121597
122283
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
@@ -121807,7 +122493,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121807
122493
|
if (skipTypeChecking(sourceFile, options, program)) {
|
121808
122494
|
return emptyArray;
|
121809
122495
|
}
|
121810
|
-
const programDiagnosticsInFile =
|
122496
|
+
const programDiagnosticsInFile = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(sourceFile.fileName);
|
121811
122497
|
if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
121812
122498
|
return programDiagnosticsInFile;
|
121813
122499
|
}
|
@@ -122165,15 +122851,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122165
122851
|
}
|
122166
122852
|
function getOptionsDiagnostics() {
|
122167
122853
|
return sortAndDeduplicateDiagnostics(concatenate(
|
122168
|
-
|
122854
|
+
programDiagnostics.getCombinedDiagnostics(program).getGlobalDiagnostics(),
|
122169
122855
|
getOptionsDiagnosticsOfConfigFile()
|
122170
122856
|
));
|
122171
122857
|
}
|
122172
122858
|
function getOptionsDiagnosticsOfConfigFile() {
|
122173
122859
|
if (!options.configFile) return emptyArray;
|
122174
|
-
let diagnostics =
|
122860
|
+
let diagnostics = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(options.configFile.fileName);
|
122175
122861
|
forEachResolvedProjectReference2((resolvedRef) => {
|
122176
|
-
diagnostics = concatenate(diagnostics,
|
122862
|
+
diagnostics = concatenate(diagnostics, programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(resolvedRef.sourceFile.fileName));
|
122177
122863
|
});
|
122178
122864
|
return diagnostics;
|
122179
122865
|
}
|
@@ -122380,7 +123066,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122380
123066
|
);
|
122381
123067
|
}
|
122382
123068
|
function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) {
|
122383
|
-
const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(
|
123069
|
+
const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(programDiagnostics.getFileReasons().get(existingFile.path), isReferencedFile);
|
122384
123070
|
if (hasExistingReasonToReportErrorOn) {
|
122385
123071
|
addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]);
|
122386
123072
|
} else {
|
@@ -122567,7 +123253,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122567
123253
|
}
|
122568
123254
|
function addFileIncludeReason(file, reason, checkExisting) {
|
122569
123255
|
if (file && (!checkExisting || !isReferencedFile(reason) || !(filesWithReferencesProcessed == null ? void 0 : filesWithReferencesProcessed.has(reason.file)))) {
|
122570
|
-
|
123256
|
+
programDiagnostics.getFileReasons().add(file.path, reason);
|
122571
123257
|
return true;
|
122572
123258
|
}
|
122573
123259
|
return false;
|
@@ -122719,6 +123405,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122719
123405
|
var _a2, _b2, _c2, _d2, _e2;
|
122720
123406
|
const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
|
122721
123407
|
if (existing) return existing;
|
123408
|
+
if (options.libReplacement === false) {
|
123409
|
+
const result2 = {
|
123410
|
+
resolution: {
|
123411
|
+
resolvedModule: void 0
|
123412
|
+
},
|
123413
|
+
actual: combinePaths(defaultLibraryPath, libFileName)
|
123414
|
+
};
|
123415
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result2);
|
123416
|
+
return result2;
|
123417
|
+
}
|
122722
123418
|
if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
122723
123419
|
const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
|
122724
123420
|
if (oldResolution) {
|
@@ -122766,7 +123462,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122766
123462
|
{ kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
122767
123463
|
);
|
122768
123464
|
} else {
|
122769
|
-
|
123465
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
122770
123466
|
kind: 0 /* FilePreprocessingLibReferenceDiagnostic */,
|
122771
123467
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
122772
123468
|
});
|
@@ -122829,10 +123525,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122829
123525
|
if (!sourceFile.isDeclarationFile) {
|
122830
123526
|
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
122831
123527
|
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
122832
|
-
|
123528
|
+
programDiagnostics.addLazyConfigDiagnostic(
|
122833
123529
|
sourceFile,
|
122834
123530
|
Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
|
122835
|
-
|
123531
|
+
sourceFile.fileName,
|
123532
|
+
rootDirectory
|
122836
123533
|
);
|
122837
123534
|
allFilesBelongToPath = false;
|
122838
123535
|
}
|
@@ -122947,7 +123644,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122947
123644
|
}
|
122948
123645
|
const outputFile = options.outFile;
|
122949
123646
|
if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) {
|
122950
|
-
programDiagnostics.
|
123647
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
|
122951
123648
|
}
|
122952
123649
|
verifyDeprecatedCompilerOptions();
|
122953
123650
|
verifyProjectReferences();
|
@@ -122955,10 +123652,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
122955
123652
|
const rootPaths = new Set(rootNames.map(toPath3));
|
122956
123653
|
for (const file of files) {
|
122957
123654
|
if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
|
122958
|
-
|
123655
|
+
programDiagnostics.addLazyConfigDiagnostic(
|
122959
123656
|
file,
|
122960
123657
|
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
|
122961
|
-
|
123658
|
+
file.fileName,
|
123659
|
+
options.configFilePath || ""
|
122962
123660
|
);
|
122963
123661
|
}
|
122964
123662
|
}
|
@@ -123049,14 +123747,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123049
123747
|
}
|
123050
123748
|
} else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === 0 /* None */) {
|
123051
123749
|
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
|
123052
|
-
programDiagnostics.
|
123750
|
+
programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
|
123053
123751
|
}
|
123054
123752
|
if (outputFile && !options.emitDeclarationOnly) {
|
123055
123753
|
if (options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) {
|
123056
123754
|
createDiagnosticForOptionName(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, "outFile", "module");
|
123057
123755
|
} else if (options.module === void 0 && firstNonAmbientExternalModuleSourceFile) {
|
123058
123756
|
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
|
123059
|
-
programDiagnostics.
|
123757
|
+
programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, "outFile"));
|
123060
123758
|
}
|
123061
123759
|
}
|
123062
123760
|
if (getResolveJsonModule(options)) {
|
@@ -123145,7 +123843,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123145
123843
|
}
|
123146
123844
|
if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
123147
123845
|
const moduleKindName = ModuleKind[moduleKind];
|
123148
|
-
|
123846
|
+
const moduleResolutionName = ModuleResolutionKind[moduleKindName] ? moduleKindName : "Node16";
|
123847
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1, moduleResolutionName, moduleKindName);
|
123149
123848
|
} else if (ModuleResolutionKind[moduleResolution] && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) && !(100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */)) {
|
123150
123849
|
const moduleResolutionName = ModuleResolutionKind[moduleResolution];
|
123151
123850
|
createOptionValueDiagnostic("module", Diagnostics.Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1, moduleResolutionName, moduleResolutionName);
|
@@ -123307,90 +124006,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123307
124006
|
}
|
123308
124007
|
});
|
123309
124008
|
}
|
123310
|
-
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
123311
|
-
let seenReasons;
|
123312
|
-
const reasons = file && fileReasons.get(file.path);
|
123313
|
-
let fileIncludeReasons;
|
123314
|
-
let relatedInfo;
|
123315
|
-
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
123316
|
-
let fileIncludeReasonDetails;
|
123317
|
-
let redirectInfo;
|
123318
|
-
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
123319
|
-
let chain;
|
123320
|
-
if (cachedChain) {
|
123321
|
-
if (cachedChain.fileIncludeReasonDetails) {
|
123322
|
-
seenReasons = new Set(reasons);
|
123323
|
-
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
123324
|
-
} else {
|
123325
|
-
reasons == null ? void 0 : reasons.forEach(processReason);
|
123326
|
-
}
|
123327
|
-
redirectInfo = cachedChain.redirectInfo;
|
123328
|
-
} else {
|
123329
|
-
reasons == null ? void 0 : reasons.forEach(processReason);
|
123330
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
123331
|
-
}
|
123332
|
-
if (fileProcessingReason) processReason(fileProcessingReason);
|
123333
|
-
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
123334
|
-
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
|
123335
|
-
if (seenReasons && cachedChain) {
|
123336
|
-
if (cachedChain.details && !processedExtraReason) {
|
123337
|
-
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
|
123338
|
-
} else if (cachedChain.fileIncludeReasonDetails) {
|
123339
|
-
if (!processedExtraReason) {
|
123340
|
-
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
123341
|
-
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
123342
|
-
} else {
|
123343
|
-
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
123344
|
-
}
|
123345
|
-
} else {
|
123346
|
-
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
123347
|
-
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
123348
|
-
} else {
|
123349
|
-
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
123350
|
-
}
|
123351
|
-
}
|
123352
|
-
}
|
123353
|
-
}
|
123354
|
-
if (!chain) {
|
123355
|
-
if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
123356
|
-
chain = chainDiagnosticMessages(
|
123357
|
-
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
123358
|
-
diagnostic,
|
123359
|
-
...args || emptyArray
|
123360
|
-
);
|
123361
|
-
}
|
123362
|
-
if (file) {
|
123363
|
-
if (cachedChain) {
|
123364
|
-
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
123365
|
-
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
123366
|
-
}
|
123367
|
-
} else {
|
123368
|
-
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
123369
|
-
}
|
123370
|
-
if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
|
123371
|
-
}
|
123372
|
-
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
123373
|
-
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
123374
|
-
function processReason(reason) {
|
123375
|
-
if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
|
123376
|
-
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
123377
|
-
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
123378
|
-
populateRelatedInfo(reason);
|
123379
|
-
}
|
123380
|
-
function populateRelatedInfo(reason) {
|
123381
|
-
if (!locationReason && isReferencedFile(reason)) {
|
123382
|
-
locationReason = reason;
|
123383
|
-
} else if (locationReason !== reason) {
|
123384
|
-
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
|
123385
|
-
}
|
123386
|
-
}
|
123387
|
-
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
123388
|
-
var _a2;
|
123389
|
-
return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
|
123390
|
-
}
|
123391
|
-
}
|
123392
124009
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
123393
|
-
|
124010
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
123394
124011
|
kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
|
123395
124012
|
file: file && file.path,
|
123396
124013
|
fileProcessingReason,
|
@@ -123398,99 +124015,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123398
124015
|
args
|
123399
124016
|
});
|
123400
124017
|
}
|
123401
|
-
function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
|
123402
|
-
lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
|
123403
|
-
}
|
123404
|
-
function getFileIncludeReasonToRelatedInformation(reason) {
|
123405
|
-
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
123406
|
-
if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
|
123407
|
-
return relatedInfo || void 0;
|
123408
|
-
}
|
123409
|
-
function fileIncludeReasonToRelatedInformation(reason) {
|
123410
|
-
if (isReferencedFile(reason)) {
|
123411
|
-
const referenceLocation = getReferencedFileLocation(program, reason);
|
123412
|
-
let message2;
|
123413
|
-
switch (reason.kind) {
|
123414
|
-
case 3 /* Import */:
|
123415
|
-
message2 = Diagnostics.File_is_included_via_import_here;
|
123416
|
-
break;
|
123417
|
-
case 4 /* ReferenceFile */:
|
123418
|
-
message2 = Diagnostics.File_is_included_via_reference_here;
|
123419
|
-
break;
|
123420
|
-
case 5 /* TypeReferenceDirective */:
|
123421
|
-
message2 = Diagnostics.File_is_included_via_type_library_reference_here;
|
123422
|
-
break;
|
123423
|
-
case 7 /* LibReferenceDirective */:
|
123424
|
-
message2 = Diagnostics.File_is_included_via_library_reference_here;
|
123425
|
-
break;
|
123426
|
-
default:
|
123427
|
-
Debug.assertNever(reason);
|
123428
|
-
}
|
123429
|
-
return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
|
123430
|
-
referenceLocation.file,
|
123431
|
-
referenceLocation.pos,
|
123432
|
-
referenceLocation.end - referenceLocation.pos,
|
123433
|
-
message2
|
123434
|
-
) : void 0;
|
123435
|
-
}
|
123436
|
-
if (!options.configFile) return void 0;
|
123437
|
-
let configFileNode;
|
123438
|
-
let message;
|
123439
|
-
switch (reason.kind) {
|
123440
|
-
case 0 /* RootFile */:
|
123441
|
-
if (!options.configFile.configFileSpecs) return void 0;
|
123442
|
-
const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
|
123443
|
-
const matchedByFiles = getMatchedFileSpec(program, fileName);
|
123444
|
-
if (matchedByFiles) {
|
123445
|
-
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
|
123446
|
-
message = Diagnostics.File_is_matched_by_files_list_specified_here;
|
123447
|
-
break;
|
123448
|
-
}
|
123449
|
-
const matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
123450
|
-
if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
|
123451
|
-
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
123452
|
-
message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
123453
|
-
break;
|
123454
|
-
case 1 /* SourceFromProjectReference */:
|
123455
|
-
case 2 /* OutputFromProjectReference */:
|
123456
|
-
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
123457
|
-
const referenceInfo = forEachProjectReference(
|
123458
|
-
projectReferences,
|
123459
|
-
resolvedProjectReferences,
|
123460
|
-
(resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0
|
123461
|
-
);
|
123462
|
-
if (!referenceInfo) return void 0;
|
123463
|
-
const { sourceFile, index } = referenceInfo;
|
123464
|
-
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
123465
|
-
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
123466
|
-
sourceFile,
|
123467
|
-
referencesSyntax.elements[index],
|
123468
|
-
reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
|
123469
|
-
) : void 0;
|
123470
|
-
case 8 /* AutomaticTypeDirectiveFile */:
|
123471
|
-
if (!options.types) return void 0;
|
123472
|
-
configFileNode = getOptionsSyntaxByArrayElementValue("types", reason.typeReference);
|
123473
|
-
message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
|
123474
|
-
break;
|
123475
|
-
case 6 /* LibFile */:
|
123476
|
-
if (reason.index !== void 0) {
|
123477
|
-
configFileNode = getOptionsSyntaxByArrayElementValue("lib", options.lib[reason.index]);
|
123478
|
-
message = Diagnostics.File_is_library_specified_here;
|
123479
|
-
break;
|
123480
|
-
}
|
123481
|
-
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
123482
|
-
configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0;
|
123483
|
-
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
123484
|
-
break;
|
123485
|
-
default:
|
123486
|
-
Debug.assertNever(reason);
|
123487
|
-
}
|
123488
|
-
return configFileNode && createDiagnosticForNodeInSourceFile(
|
123489
|
-
options.configFile,
|
123490
|
-
configFileNode,
|
123491
|
-
message
|
123492
|
-
);
|
123493
|
-
}
|
123494
124018
|
function verifyProjectReferences() {
|
123495
124019
|
const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : void 0;
|
123496
124020
|
forEachProjectReference(
|
@@ -123526,7 +124050,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123526
124050
|
forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
|
123527
124051
|
const initializer = keyProps.initializer;
|
123528
124052
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
123529
|
-
programDiagnostics.
|
124053
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
123530
124054
|
needCompilerDiagnostic = false;
|
123531
124055
|
}
|
123532
124056
|
});
|
@@ -123555,18 +124079,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123555
124079
|
createCompilerOptionsDiagnostic(message, ...args);
|
123556
124080
|
}
|
123557
124081
|
}
|
123558
|
-
function forEachOptionsSyntaxByName(name, callback) {
|
123559
|
-
return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
|
123560
|
-
}
|
123561
124082
|
function forEachOptionPathsSyntax(callback) {
|
123562
|
-
return forEachOptionsSyntaxByName("paths", callback);
|
123563
|
-
}
|
123564
|
-
function getOptionsSyntaxByValue(name, value) {
|
123565
|
-
return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
123566
|
-
}
|
123567
|
-
function getOptionsSyntaxByArrayElementValue(name, value) {
|
123568
|
-
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
123569
|
-
return compilerOptionsObjectLiteralSyntax && getPropertyArrayElementValue(compilerOptionsObjectLiteralSyntax, name, value);
|
124083
|
+
return forEachOptionsSyntaxByName(getCompilerOptionsObjectLiteralSyntax(), "paths", callback);
|
123570
124084
|
}
|
123571
124085
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
123572
124086
|
createDiagnosticForOption(
|
@@ -123594,9 +124108,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123594
124108
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
123595
124109
|
const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
123596
124110
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
123597
|
-
programDiagnostics.
|
124111
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
123598
124112
|
} else {
|
123599
|
-
programDiagnostics.
|
124113
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
|
123600
124114
|
}
|
123601
124115
|
}
|
123602
124116
|
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
@@ -123610,14 +124124,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123610
124124
|
const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
|
123611
124125
|
if (compilerOptionsProperty) {
|
123612
124126
|
if ("messageText" in message) {
|
123613
|
-
programDiagnostics.
|
124127
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
|
123614
124128
|
} else {
|
123615
|
-
programDiagnostics.
|
124129
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
|
123616
124130
|
}
|
123617
124131
|
} else if ("messageText" in message) {
|
123618
|
-
programDiagnostics.
|
124132
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnosticFromMessageChain(message));
|
123619
124133
|
} else {
|
123620
|
-
programDiagnostics.
|
124134
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
|
123621
124135
|
}
|
123622
124136
|
}
|
123623
124137
|
function getCompilerOptionsObjectLiteralSyntax() {
|
@@ -123641,9 +124155,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123641
124155
|
let needsCompilerDiagnostic = false;
|
123642
124156
|
forEachPropertyAssignment(objectLiteral, key1, (prop) => {
|
123643
124157
|
if ("messageText" in message) {
|
123644
|
-
programDiagnostics.
|
124158
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
123645
124159
|
} else {
|
123646
|
-
programDiagnostics.
|
124160
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
123647
124161
|
}
|
123648
124162
|
needsCompilerDiagnostic = true;
|
123649
124163
|
}, key2);
|
@@ -123651,7 +124165,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123651
124165
|
}
|
123652
124166
|
function blockEmittingOfFile(emitFileName, diag2) {
|
123653
124167
|
hasEmitBlockingDiagnostics.set(toPath3(emitFileName), true);
|
123654
|
-
programDiagnostics.
|
124168
|
+
programDiagnostics.addConfigDiagnostic(diag2);
|
123655
124169
|
}
|
123656
124170
|
function isEmittedFile(file) {
|
123657
124171
|
if (options.noEmit) {
|
@@ -123974,6 +124488,293 @@ function getModuleNameStringLiteralAt({ imports, moduleAugmentations }, index) {
|
|
123974
124488
|
Debug.fail("should never ask for module name at index higher than possible module name");
|
123975
124489
|
}
|
123976
124490
|
|
124491
|
+
// src/compiler/programDiagnostics.ts
|
124492
|
+
function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax) {
|
124493
|
+
let computedDiagnostics;
|
124494
|
+
let fileReasons = createMultiMap();
|
124495
|
+
let fileProcessingDiagnostics;
|
124496
|
+
let commonSourceDirectory;
|
124497
|
+
let configDiagnostics;
|
124498
|
+
let lazyConfigDiagnostics;
|
124499
|
+
let fileReasonsToChain;
|
124500
|
+
let reasonToRelatedInfo;
|
124501
|
+
return {
|
124502
|
+
addConfigDiagnostic(diag2) {
|
124503
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
124504
|
+
(configDiagnostics ?? (configDiagnostics = createDiagnosticCollection())).add(diag2);
|
124505
|
+
},
|
124506
|
+
addLazyConfigDiagnostic(file, message, ...args) {
|
124507
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
124508
|
+
(lazyConfigDiagnostics ?? (lazyConfigDiagnostics = [])).push({ file, diagnostic: message, args });
|
124509
|
+
},
|
124510
|
+
addFileProcessingDiagnostic(diag2) {
|
124511
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
124512
|
+
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push(diag2);
|
124513
|
+
},
|
124514
|
+
setCommonSourceDirectory(directory) {
|
124515
|
+
commonSourceDirectory = directory;
|
124516
|
+
},
|
124517
|
+
reuseStateFromOldProgram(oldProgramDiagnostics, isConfigIdentical) {
|
124518
|
+
fileReasons = oldProgramDiagnostics.getFileReasons();
|
124519
|
+
fileProcessingDiagnostics = oldProgramDiagnostics.getFileProcessingDiagnostics();
|
124520
|
+
if (isConfigIdentical) {
|
124521
|
+
commonSourceDirectory = oldProgramDiagnostics.getCommonSourceDirectory();
|
124522
|
+
configDiagnostics = oldProgramDiagnostics.getConfigDiagnostics();
|
124523
|
+
lazyConfigDiagnostics = oldProgramDiagnostics.getLazyConfigDiagnostics();
|
124524
|
+
}
|
124525
|
+
},
|
124526
|
+
getFileProcessingDiagnostics() {
|
124527
|
+
return fileProcessingDiagnostics;
|
124528
|
+
},
|
124529
|
+
getFileReasons() {
|
124530
|
+
return fileReasons;
|
124531
|
+
},
|
124532
|
+
getCommonSourceDirectory() {
|
124533
|
+
return commonSourceDirectory;
|
124534
|
+
},
|
124535
|
+
getConfigDiagnostics() {
|
124536
|
+
return configDiagnostics;
|
124537
|
+
},
|
124538
|
+
getLazyConfigDiagnostics() {
|
124539
|
+
return lazyConfigDiagnostics;
|
124540
|
+
},
|
124541
|
+
getCombinedDiagnostics(program) {
|
124542
|
+
if (computedDiagnostics) {
|
124543
|
+
return computedDiagnostics;
|
124544
|
+
}
|
124545
|
+
computedDiagnostics = createDiagnosticCollection();
|
124546
|
+
configDiagnostics == null ? void 0 : configDiagnostics.getDiagnostics().forEach((d) => computedDiagnostics.add(d));
|
124547
|
+
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
124548
|
+
switch (diagnostic.kind) {
|
124549
|
+
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
124550
|
+
return computedDiagnostics.add(
|
124551
|
+
createDiagnosticExplainingFile(
|
124552
|
+
program,
|
124553
|
+
diagnostic.file && program.getSourceFileByPath(diagnostic.file),
|
124554
|
+
diagnostic.fileProcessingReason,
|
124555
|
+
diagnostic.diagnostic,
|
124556
|
+
diagnostic.args || emptyArray
|
124557
|
+
)
|
124558
|
+
);
|
124559
|
+
case 0 /* FilePreprocessingLibReferenceDiagnostic */:
|
124560
|
+
return computedDiagnostics.add(filePreprocessingLibreferenceDiagnostic(program, diagnostic));
|
124561
|
+
case 2 /* ResolutionDiagnostics */:
|
124562
|
+
return diagnostic.diagnostics.forEach((d) => computedDiagnostics.add(d));
|
124563
|
+
default:
|
124564
|
+
Debug.assertNever(diagnostic);
|
124565
|
+
}
|
124566
|
+
});
|
124567
|
+
lazyConfigDiagnostics == null ? void 0 : lazyConfigDiagnostics.forEach(
|
124568
|
+
({ file, diagnostic, args }) => computedDiagnostics.add(
|
124569
|
+
createDiagnosticExplainingFile(
|
124570
|
+
program,
|
124571
|
+
file,
|
124572
|
+
/*fileProcessingReason*/
|
124573
|
+
void 0,
|
124574
|
+
diagnostic,
|
124575
|
+
args
|
124576
|
+
)
|
124577
|
+
)
|
124578
|
+
);
|
124579
|
+
fileReasonsToChain = void 0;
|
124580
|
+
reasonToRelatedInfo = void 0;
|
124581
|
+
return computedDiagnostics;
|
124582
|
+
}
|
124583
|
+
};
|
124584
|
+
function filePreprocessingLibreferenceDiagnostic(program, { reason }) {
|
124585
|
+
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
124586
|
+
const libReference = file.libReferenceDirectives[reason.index];
|
124587
|
+
const libName = getLibNameFromLibReference(libReference);
|
124588
|
+
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
124589
|
+
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
124590
|
+
return createFileDiagnostic(
|
124591
|
+
file,
|
124592
|
+
Debug.checkDefined(pos),
|
124593
|
+
Debug.checkDefined(end) - pos,
|
124594
|
+
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
124595
|
+
libName,
|
124596
|
+
suggestion
|
124597
|
+
);
|
124598
|
+
}
|
124599
|
+
function createDiagnosticExplainingFile(program, file, fileProcessingReason, diagnostic, args) {
|
124600
|
+
let seenReasons;
|
124601
|
+
let fileIncludeReasons;
|
124602
|
+
let relatedInfo;
|
124603
|
+
let fileIncludeReasonDetails;
|
124604
|
+
let redirectInfo;
|
124605
|
+
let chain;
|
124606
|
+
const reasons = file && fileReasons.get(file.path);
|
124607
|
+
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
124608
|
+
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
124609
|
+
if (cachedChain) {
|
124610
|
+
if (cachedChain.fileIncludeReasonDetails) {
|
124611
|
+
seenReasons = new Set(reasons);
|
124612
|
+
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
124613
|
+
} else {
|
124614
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
124615
|
+
}
|
124616
|
+
redirectInfo = cachedChain.redirectInfo;
|
124617
|
+
} else {
|
124618
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
124619
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file));
|
124620
|
+
}
|
124621
|
+
if (fileProcessingReason) processReason(fileProcessingReason);
|
124622
|
+
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
124623
|
+
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
|
124624
|
+
if (seenReasons && cachedChain) {
|
124625
|
+
if (cachedChain.details && !processedExtraReason) {
|
124626
|
+
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args ?? emptyArray);
|
124627
|
+
} else if (cachedChain.fileIncludeReasonDetails) {
|
124628
|
+
if (!processedExtraReason) {
|
124629
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
124630
|
+
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
124631
|
+
} else {
|
124632
|
+
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
124633
|
+
}
|
124634
|
+
} else {
|
124635
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
124636
|
+
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
124637
|
+
} else {
|
124638
|
+
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
124639
|
+
}
|
124640
|
+
}
|
124641
|
+
}
|
124642
|
+
}
|
124643
|
+
if (!chain) {
|
124644
|
+
if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
124645
|
+
chain = chainDiagnosticMessages(
|
124646
|
+
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
124647
|
+
diagnostic,
|
124648
|
+
...args || emptyArray
|
124649
|
+
);
|
124650
|
+
}
|
124651
|
+
if (file) {
|
124652
|
+
if (cachedChain) {
|
124653
|
+
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
124654
|
+
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
124655
|
+
}
|
124656
|
+
} else {
|
124657
|
+
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
124658
|
+
}
|
124659
|
+
if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
|
124660
|
+
}
|
124661
|
+
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
124662
|
+
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
124663
|
+
function processReason(reason) {
|
124664
|
+
if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
|
124665
|
+
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
124666
|
+
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
124667
|
+
populateRelatedInfo(reason);
|
124668
|
+
}
|
124669
|
+
function populateRelatedInfo(reason) {
|
124670
|
+
if (!locationReason && isReferencedFile(reason)) {
|
124671
|
+
locationReason = reason;
|
124672
|
+
} else if (locationReason !== reason) {
|
124673
|
+
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(program, reason));
|
124674
|
+
}
|
124675
|
+
}
|
124676
|
+
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
124677
|
+
var _a;
|
124678
|
+
return ((_a = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a.length) !== (reasons == null ? void 0 : reasons.length);
|
124679
|
+
}
|
124680
|
+
}
|
124681
|
+
function getFileIncludeReasonToRelatedInformation(program, reason) {
|
124682
|
+
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
124683
|
+
if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(program, reason) ?? false);
|
124684
|
+
return relatedInfo || void 0;
|
124685
|
+
}
|
124686
|
+
function fileIncludeReasonToRelatedInformation(program, reason) {
|
124687
|
+
if (isReferencedFile(reason)) {
|
124688
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
124689
|
+
let message2;
|
124690
|
+
switch (reason.kind) {
|
124691
|
+
case 3 /* Import */:
|
124692
|
+
message2 = Diagnostics.File_is_included_via_import_here;
|
124693
|
+
break;
|
124694
|
+
case 4 /* ReferenceFile */:
|
124695
|
+
message2 = Diagnostics.File_is_included_via_reference_here;
|
124696
|
+
break;
|
124697
|
+
case 5 /* TypeReferenceDirective */:
|
124698
|
+
message2 = Diagnostics.File_is_included_via_type_library_reference_here;
|
124699
|
+
break;
|
124700
|
+
case 7 /* LibReferenceDirective */:
|
124701
|
+
message2 = Diagnostics.File_is_included_via_library_reference_here;
|
124702
|
+
break;
|
124703
|
+
default:
|
124704
|
+
Debug.assertNever(reason);
|
124705
|
+
}
|
124706
|
+
return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
|
124707
|
+
referenceLocation.file,
|
124708
|
+
referenceLocation.pos,
|
124709
|
+
referenceLocation.end - referenceLocation.pos,
|
124710
|
+
message2
|
124711
|
+
) : void 0;
|
124712
|
+
}
|
124713
|
+
const currentDirectory = program.getCurrentDirectory();
|
124714
|
+
const rootNames = program.getRootFileNames();
|
124715
|
+
const options = program.getCompilerOptions();
|
124716
|
+
if (!options.configFile) return void 0;
|
124717
|
+
let configFileNode;
|
124718
|
+
let message;
|
124719
|
+
switch (reason.kind) {
|
124720
|
+
case 0 /* RootFile */:
|
124721
|
+
if (!options.configFile.configFileSpecs) return void 0;
|
124722
|
+
const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
|
124723
|
+
const matchedByFiles = getMatchedFileSpec(program, fileName);
|
124724
|
+
if (matchedByFiles) {
|
124725
|
+
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
|
124726
|
+
message = Diagnostics.File_is_matched_by_files_list_specified_here;
|
124727
|
+
break;
|
124728
|
+
}
|
124729
|
+
const matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
124730
|
+
if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
|
124731
|
+
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
124732
|
+
message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
124733
|
+
break;
|
124734
|
+
case 1 /* SourceFromProjectReference */:
|
124735
|
+
case 2 /* OutputFromProjectReference */:
|
124736
|
+
const resolvedProjectReferences = program.getResolvedProjectReferences();
|
124737
|
+
const projectReferences = program.getProjectReferences();
|
124738
|
+
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
124739
|
+
const referenceInfo = forEachProjectReference(
|
124740
|
+
projectReferences,
|
124741
|
+
resolvedProjectReferences,
|
124742
|
+
(resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0
|
124743
|
+
);
|
124744
|
+
if (!referenceInfo) return void 0;
|
124745
|
+
const { sourceFile, index } = referenceInfo;
|
124746
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
124747
|
+
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
124748
|
+
sourceFile,
|
124749
|
+
referencesSyntax.elements[index],
|
124750
|
+
reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
|
124751
|
+
) : void 0;
|
124752
|
+
case 8 /* AutomaticTypeDirectiveFile */:
|
124753
|
+
if (!options.types) return void 0;
|
124754
|
+
configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "types", reason.typeReference);
|
124755
|
+
message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
|
124756
|
+
break;
|
124757
|
+
case 6 /* LibFile */:
|
124758
|
+
if (reason.index !== void 0) {
|
124759
|
+
configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "lib", options.lib[reason.index]);
|
124760
|
+
message = Diagnostics.File_is_library_specified_here;
|
124761
|
+
break;
|
124762
|
+
}
|
124763
|
+
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
124764
|
+
configFileNode = target ? getOptionsSyntaxByValue(getCompilerOptionsObjectLiteralSyntax(), "target", target) : void 0;
|
124765
|
+
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
124766
|
+
break;
|
124767
|
+
default:
|
124768
|
+
Debug.assertNever(reason);
|
124769
|
+
}
|
124770
|
+
return configFileNode && createDiagnosticForNodeInSourceFile(
|
124771
|
+
options.configFile,
|
124772
|
+
configFileNode,
|
124773
|
+
message
|
124774
|
+
);
|
124775
|
+
}
|
124776
|
+
}
|
124777
|
+
|
123977
124778
|
// src/compiler/builderState.ts
|
123978
124779
|
var BuilderState;
|
123979
124780
|
((BuilderState2) => {
|
@@ -132011,18 +132812,21 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132011
132812
|
return failed;
|
132012
132813
|
}
|
132013
132814
|
function typeFromFunctionLikeExpression(fnNode, context) {
|
132014
|
-
const
|
132015
|
-
context.noInferenceFallback = true;
|
132016
|
-
createReturnFromSignature(
|
132815
|
+
const returnType = createReturnFromSignature(
|
132017
132816
|
fnNode,
|
132018
132817
|
/*symbol*/
|
132019
132818
|
void 0,
|
132020
132819
|
context
|
132021
132820
|
);
|
132022
|
-
reuseTypeParameters(fnNode.typeParameters, context);
|
132023
|
-
fnNode.parameters.map((p) => ensureParameter(p, context));
|
132024
|
-
|
132025
|
-
|
132821
|
+
const typeParameters = reuseTypeParameters(fnNode.typeParameters, context);
|
132822
|
+
const parameters = fnNode.parameters.map((p) => ensureParameter(p, context));
|
132823
|
+
return syntacticResult(
|
132824
|
+
factory.createFunctionTypeNode(
|
132825
|
+
typeParameters,
|
132826
|
+
parameters,
|
132827
|
+
returnType
|
132828
|
+
)
|
132829
|
+
);
|
132026
132830
|
}
|
132027
132831
|
function canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext) {
|
132028
132832
|
if (!isConstContext) {
|