typescript 5.9.0-dev.20250608 → 5.9.0-dev.20250610
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_tsc.js +118 -106
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +124 -110
- package/package.json +2 -2
package/lib/_tsc.js
CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
18
18
|
|
19
19
|
// src/compiler/corePublic.ts
|
20
20
|
var versionMajorMinor = "5.9";
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20250610`;
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -3665,6 +3665,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
3665
3665
|
ObjectFlags3[ObjectFlags3["NonInferrableType"] = 262144] = "NonInferrableType";
|
3666
3666
|
ObjectFlags3[ObjectFlags3["CouldContainTypeVariablesComputed"] = 524288] = "CouldContainTypeVariablesComputed";
|
3667
3667
|
ObjectFlags3[ObjectFlags3["CouldContainTypeVariables"] = 1048576] = "CouldContainTypeVariables";
|
3668
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
3668
3669
|
ObjectFlags3[ObjectFlags3["ClassOrInterface"] = 3] = "ClassOrInterface";
|
3669
3670
|
ObjectFlags3[ObjectFlags3["RequiresWidening"] = 196608] = "RequiresWidening";
|
3670
3671
|
ObjectFlags3[ObjectFlags3["PropagatingFlags"] = 458752] = "PropagatingFlags";
|
@@ -3673,7 +3674,6 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
3673
3674
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
3674
3675
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
3675
3676
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
3676
|
-
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
3677
3677
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
3678
3678
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
3679
3679
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
@@ -3735,6 +3735,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
|
|
3735
3735
|
ModuleKind2[ModuleKind2["ESNext"] = 99] = "ESNext";
|
3736
3736
|
ModuleKind2[ModuleKind2["Node16"] = 100] = "Node16";
|
3737
3737
|
ModuleKind2[ModuleKind2["Node18"] = 101] = "Node18";
|
3738
|
+
ModuleKind2[ModuleKind2["Node20"] = 102] = "Node20";
|
3738
3739
|
ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
|
3739
3740
|
ModuleKind2[ModuleKind2["Preserve"] = 200] = "Preserve";
|
3740
3741
|
return ModuleKind2;
|
@@ -6036,8 +6037,8 @@ var Diagnostics = {
|
|
6036
6037
|
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."),
|
6037
6038
|
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."),
|
6038
6039
|
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."),
|
6039
|
-
|
6040
|
-
|
6040
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_node20_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', 'node20', or 'nodenext'."),
|
6041
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_node20_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', 'node20', 'nodenext', or 'preserve'."),
|
6041
6042
|
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."),
|
6042
6043
|
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."),
|
6043
6044
|
String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
@@ -6054,7 +6055,7 @@ var Diagnostics = {
|
|
6054
6055
|
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."),
|
6055
6056
|
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}')'?"),
|
6056
6057
|
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."),
|
6057
|
-
|
6058
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_node20_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', 'node20', or 'nodenext'."),
|
6058
6059
|
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
6059
6060
|
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."),
|
6060
6061
|
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."),
|
@@ -6084,7 +6085,7 @@ var Diagnostics = {
|
|
6084
6085
|
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."),
|
6085
6086
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
6086
6087
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
6087
|
-
|
6088
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_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', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
6088
6089
|
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'."),
|
6089
6090
|
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'."),
|
6090
6091
|
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 `}`?"),
|
@@ -6135,7 +6136,7 @@ var Diagnostics = {
|
|
6135
6136
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
6136
6137
|
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:"),
|
6137
6138
|
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."),
|
6138
|
-
|
6139
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_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', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
6139
6140
|
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."),
|
6140
6141
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
6141
6142
|
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}'?"),
|
@@ -6779,9 +6780,9 @@ var Diagnostics = {
|
|
6779
6780
|
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."),
|
6780
6781
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
6781
6782
|
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}'?"),
|
6782
|
-
|
6783
|
+
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext__2821", "Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'."),
|
6783
6784
|
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."),
|
6784
|
-
|
6785
|
+
Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext__2823", "Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'."),
|
6785
6786
|
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}'?"),
|
6786
6787
|
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."),
|
6787
6788
|
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}'?"),
|
@@ -6801,7 +6802,7 @@ var Diagnostics = {
|
|
6801
6802
|
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'."),
|
6802
6803
|
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."),
|
6803
6804
|
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."),
|
6804
|
-
|
6805
|
+
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_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', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
6805
6806
|
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."),
|
6806
6807
|
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."),
|
6807
6808
|
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."),
|
@@ -17939,7 +17940,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
17939
17940
|
dependencies: ["module"],
|
17940
17941
|
computeValue: (compilerOptions) => {
|
17941
17942
|
const target = compilerOptions.target === 0 /* ES3 */ ? void 0 : compilerOptions.target;
|
17942
|
-
return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 101 /* Node18 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
17943
|
+
return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 101 /* Node18 */ && 9 /* ES2022 */ || compilerOptions.module === 102 /* Node20 */ && 10 /* ES2023 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
17943
17944
|
}
|
17944
17945
|
},
|
17945
17946
|
module: {
|
@@ -17959,6 +17960,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
17959
17960
|
break;
|
17960
17961
|
case 100 /* Node16 */:
|
17961
17962
|
case 101 /* Node18 */:
|
17963
|
+
case 102 /* Node20 */:
|
17962
17964
|
moduleResolution = 3 /* Node16 */;
|
17963
17965
|
break;
|
17964
17966
|
case 199 /* NodeNext */:
|
@@ -18000,6 +18002,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
18000
18002
|
switch (_computedOptions.module.computeValue(compilerOptions)) {
|
18001
18003
|
case 100 /* Node16 */:
|
18002
18004
|
case 101 /* Node18 */:
|
18005
|
+
case 102 /* Node20 */:
|
18003
18006
|
case 199 /* NodeNext */:
|
18004
18007
|
case 200 /* Preserve */:
|
18005
18008
|
return true;
|
@@ -18060,6 +18063,14 @@ var _computedOptions = createComputedCompilerOptions({
|
|
18060
18063
|
if (compilerOptions.resolveJsonModule !== void 0) {
|
18061
18064
|
return compilerOptions.resolveJsonModule;
|
18062
18065
|
}
|
18066
|
+
switch (_computedOptions.module.computeValue(compilerOptions)) {
|
18067
|
+
// TODO in 6.0: uncomment
|
18068
|
+
// case ModuleKind.Node16:
|
18069
|
+
// case ModuleKind.Node18:
|
18070
|
+
case 102 /* Node20 */:
|
18071
|
+
case 199 /* NodeNext */:
|
18072
|
+
return true;
|
18073
|
+
}
|
18063
18074
|
return _computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
|
18064
18075
|
}
|
18065
18076
|
},
|
@@ -34312,7 +34323,7 @@ var Parser;
|
|
34312
34323
|
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
34313
34324
|
phaseModifier = 156 /* TypeKeyword */;
|
34314
34325
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
34315
|
-
} else if ((identifier == null ? void 0 : identifier.escapedText) === "defer" && token()
|
34326
|
+
} else if ((identifier == null ? void 0 : identifier.escapedText) === "defer" && (token() === 161 /* FromKeyword */ ? !lookAhead(nextTokenIsStringLiteral) : token() !== 28 /* CommaToken */ && token() !== 64 /* EqualsToken */)) {
|
34316
34327
|
phaseModifier = 166 /* DeferKeyword */;
|
34317
34328
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
34318
34329
|
}
|
@@ -36734,6 +36745,7 @@ var moduleOptionDeclaration = {
|
|
36734
36745
|
esnext: 99 /* ESNext */,
|
36735
36746
|
node16: 100 /* Node16 */,
|
36736
36747
|
node18: 101 /* Node18 */,
|
36748
|
+
node20: 102 /* Node20 */,
|
36737
36749
|
nodenext: 199 /* NodeNext */,
|
36738
36750
|
preserve: 200 /* Preserve */
|
36739
36751
|
})),
|
@@ -48408,6 +48420,12 @@ function createTypeChecker(host) {
|
|
48408
48420
|
getExternalModuleRequireArgument(node) || getExternalModuleImportEqualsDeclarationExpression(node)
|
48409
48421
|
);
|
48410
48422
|
const resolved2 = resolveExternalModuleSymbol(immediate);
|
48423
|
+
if (resolved2 && 102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
48424
|
+
const moduleExports = getExportOfModule(resolved2, "module.exports", node, dontResolveAlias);
|
48425
|
+
if (moduleExports) {
|
48426
|
+
return moduleExports;
|
48427
|
+
}
|
48428
|
+
}
|
48411
48429
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
48412
48430
|
node,
|
48413
48431
|
immediate,
|
@@ -48537,14 +48555,29 @@ function createTypeChecker(host) {
|
|
48537
48555
|
}
|
48538
48556
|
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
48539
48557
|
var _a;
|
48558
|
+
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
48559
|
+
const specifier = getModuleSpecifierForImportOrExport(node);
|
48540
48560
|
let exportDefaultSymbol;
|
48561
|
+
let exportModuleDotExportsSymbol;
|
48541
48562
|
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
48542
48563
|
exportDefaultSymbol = moduleSymbol;
|
48564
|
+
} else if (file && specifier && 102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && getEmitSyntaxForModuleSpecifierExpression(specifier) === 1 /* CommonJS */ && host.getImpliedNodeFormatForEmit(file) === 99 /* ESNext */ && (exportModuleDotExportsSymbol = resolveExportByName(moduleSymbol, "module.exports", node, dontResolveAlias))) {
|
48565
|
+
if (!getESModuleInterop(compilerOptions)) {
|
48566
|
+
error(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), "esModuleInterop");
|
48567
|
+
return void 0;
|
48568
|
+
}
|
48569
|
+
markSymbolOfAliasDeclarationIfTypeOnly(
|
48570
|
+
node,
|
48571
|
+
exportModuleDotExportsSymbol,
|
48572
|
+
/*finalTarget*/
|
48573
|
+
void 0,
|
48574
|
+
/*overwriteEmpty*/
|
48575
|
+
false
|
48576
|
+
);
|
48577
|
+
return exportModuleDotExportsSymbol;
|
48543
48578
|
} else {
|
48544
48579
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
48545
48580
|
}
|
48546
|
-
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
48547
|
-
const specifier = getModuleSpecifierForImportOrExport(node);
|
48548
48581
|
if (!specifier) {
|
48549
48582
|
return exportDefaultSymbol;
|
48550
48583
|
}
|
@@ -49591,7 +49624,8 @@ function createTypeChecker(host) {
|
|
49591
49624
|
return symbol;
|
49592
49625
|
}
|
49593
49626
|
const referenceParent = referencingLocation.parent;
|
49594
|
-
|
49627
|
+
const namespaceImport = isImportDeclaration(referenceParent) && getNamespaceDeclarationNode(referenceParent);
|
49628
|
+
if (namespaceImport || isImportCall(referenceParent)) {
|
49595
49629
|
const reference = isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
|
49596
49630
|
const type = getTypeOfSymbol(symbol);
|
49597
49631
|
const defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
|
@@ -49599,13 +49633,20 @@ function createTypeChecker(host) {
|
|
49599
49633
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
49600
49634
|
}
|
49601
49635
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
49602
|
-
const
|
49603
|
-
|
49604
|
-
|
49605
|
-
if (!
|
49606
|
-
|
49636
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(reference);
|
49637
|
+
let exportModuleDotExportsSymbol;
|
49638
|
+
if (namespaceImport && targetFile && 102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && usageMode === 1 /* CommonJS */ && host.getImpliedNodeFormatForEmit(targetFile) === 99 /* ESNext */ && (exportModuleDotExportsSymbol = resolveExportByName(symbol, "module.exports", namespaceImport, dontResolveAlias))) {
|
49639
|
+
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) {
|
49640
|
+
error(referencingLocation, Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, "esModuleInterop");
|
49641
|
+
}
|
49642
|
+
if (getESModuleInterop(compilerOptions) && hasSignatures(type)) {
|
49643
|
+
return cloneTypeAsModuleType(exportModuleDotExportsSymbol, type, referenceParent);
|
49607
49644
|
}
|
49608
|
-
|
49645
|
+
return exportModuleDotExportsSymbol;
|
49646
|
+
}
|
49647
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(usageMode, host.getImpliedNodeFormatForEmit(targetFile));
|
49648
|
+
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
49649
|
+
if (hasSignatures(type) || getPropertyOfType(
|
49609
49650
|
type,
|
49610
49651
|
"default" /* Default */,
|
49611
49652
|
/*skipObjectFunctionPropertyAugment*/
|
@@ -49619,6 +49660,9 @@ function createTypeChecker(host) {
|
|
49619
49660
|
}
|
49620
49661
|
return symbol;
|
49621
49662
|
}
|
49663
|
+
function hasSignatures(type) {
|
49664
|
+
return some(getSignaturesOfStructuredType(type, 0 /* Call */)) || some(getSignaturesOfStructuredType(type, 1 /* Construct */));
|
49665
|
+
}
|
49622
49666
|
function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
|
49623
49667
|
const result = createSymbol(symbol.flags, symbol.escapedName);
|
49624
49668
|
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
@@ -51732,7 +51776,7 @@ function createTypeChecker(host) {
|
|
51732
51776
|
}
|
51733
51777
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
51734
51778
|
if (some(abstractSignatures)) {
|
51735
|
-
const types = map(abstractSignatures,
|
51779
|
+
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
51736
51780
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
51737
51781
|
// the logic in `createTypeNodesFromResolvedType`.
|
51738
51782
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
@@ -59634,8 +59678,10 @@ function createTypeChecker(host) {
|
|
59634
59678
|
if (returnSignature) {
|
59635
59679
|
const newReturnSignature = cloneSignature(returnSignature);
|
59636
59680
|
newReturnSignature.typeParameters = inferredTypeParameters;
|
59681
|
+
const newReturnType = getOrCreateTypeFromSignature(newReturnSignature);
|
59682
|
+
newReturnType.mapper = instantiatedSignature.mapper;
|
59637
59683
|
const newInstantiatedSignature = cloneSignature(instantiatedSignature);
|
59638
|
-
newInstantiatedSignature.resolvedReturnType =
|
59684
|
+
newInstantiatedSignature.resolvedReturnType = newReturnType;
|
59639
59685
|
return newInstantiatedSignature;
|
59640
59686
|
}
|
59641
59687
|
}
|
@@ -59685,12 +59731,6 @@ function createTypeChecker(host) {
|
|
59685
59731
|
isInJSFile(signature.declaration)
|
59686
59732
|
);
|
59687
59733
|
}
|
59688
|
-
function getImplementationSignature(signature) {
|
59689
|
-
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
59690
|
-
}
|
59691
|
-
function createImplementationSignature(signature) {
|
59692
|
-
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
59693
|
-
}
|
59694
59734
|
function getBaseSignature(signature) {
|
59695
59735
|
const typeParameters = signature.typeParameters;
|
59696
59736
|
if (typeParameters) {
|
@@ -59713,22 +59753,12 @@ function createTypeChecker(host) {
|
|
59713
59753
|
}
|
59714
59754
|
return signature;
|
59715
59755
|
}
|
59716
|
-
function getOrCreateTypeFromSignature(signature
|
59717
|
-
var _a;
|
59756
|
+
function getOrCreateTypeFromSignature(signature) {
|
59757
|
+
var _a, _b;
|
59718
59758
|
if (!signature.isolatedSignatureType) {
|
59719
59759
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
59720
59760
|
const isConstructor = kind === void 0 || kind === 177 /* Constructor */ || kind === 181 /* ConstructSignature */ || kind === 186 /* ConstructorType */;
|
59721
|
-
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */,
|
59722
|
-
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
59723
|
-
type.symbol.declarations = [signature.declaration];
|
59724
|
-
type.symbol.valueDeclaration = signature.declaration;
|
59725
|
-
}
|
59726
|
-
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
59727
|
-
signature.declaration,
|
59728
|
-
/*includeThisTypes*/
|
59729
|
-
true
|
59730
|
-
));
|
59731
|
-
type.outerTypeParameters = outerTypeParameters;
|
59761
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, (_b = signature.declaration) == null ? void 0 : _b.symbol);
|
59732
59762
|
type.members = emptySymbols;
|
59733
59763
|
type.properties = emptyArray;
|
59734
59764
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
@@ -63141,6 +63171,9 @@ function createTypeChecker(host) {
|
|
63141
63171
|
const forwardInferences = context.inferences.slice(index);
|
63142
63172
|
return createTypeMapper(map(forwardInferences, (i) => i.typeParameter), map(forwardInferences, () => unknownType));
|
63143
63173
|
}
|
63174
|
+
function createOuterReturnMapper(context) {
|
63175
|
+
return context.outerReturnMapper ?? (context.outerReturnMapper = mergeTypeMappers(context.returnMapper, cloneInferenceContext(context).mapper));
|
63176
|
+
}
|
63144
63177
|
function combineTypeMappers(mapper1, mapper2) {
|
63145
63178
|
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
63146
63179
|
}
|
@@ -63220,7 +63253,7 @@ function createTypeChecker(host) {
|
|
63220
63253
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
63221
63254
|
const links = getNodeLinks(declaration);
|
63222
63255
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
63223
|
-
let typeParameters =
|
63256
|
+
let typeParameters = links.outerTypeParameters;
|
63224
63257
|
if (!typeParameters) {
|
63225
63258
|
let outerTypeParameters = getOuterTypeParameters(
|
63226
63259
|
declaration,
|
@@ -63241,19 +63274,17 @@ function createTypeChecker(host) {
|
|
63241
63274
|
const typeArguments = map(typeParameters, (t) => getMappedType(t, combinedMapper));
|
63242
63275
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
63243
63276
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
63244
|
-
const id =
|
63277
|
+
const id = getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
|
63245
63278
|
if (!target.instantiations) {
|
63246
63279
|
target.instantiations = /* @__PURE__ */ new Map();
|
63247
63280
|
target.instantiations.set(getTypeListId(typeParameters) + getAliasId(target.aliasSymbol, target.aliasTypeArguments), target);
|
63248
63281
|
}
|
63249
63282
|
let result = target.instantiations.get(id);
|
63250
63283
|
if (!result) {
|
63251
|
-
|
63252
|
-
|
63253
|
-
|
63254
|
-
return result;
|
63284
|
+
let newMapper = createTypeMapper(typeParameters, typeArguments);
|
63285
|
+
if (target.objectFlags & 134217728 /* SingleSignatureType */ && mapper) {
|
63286
|
+
newMapper = combineTypeMappers(newMapper, mapper);
|
63255
63287
|
}
|
63256
|
-
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
63257
63288
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
63258
63289
|
target.instantiations.set(id, result);
|
63259
63290
|
const resultObjectFlags = getObjectFlags(result);
|
@@ -63406,9 +63437,6 @@ function createTypeChecker(host) {
|
|
63406
63437
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
63407
63438
|
result.node = type.node;
|
63408
63439
|
}
|
63409
|
-
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
63410
|
-
result.outerTypeParameters = type.outerTypeParameters;
|
63411
|
-
}
|
63412
63440
|
result.target = type;
|
63413
63441
|
result.mapper = mapper;
|
63414
63442
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
@@ -67016,10 +67044,12 @@ function createTypeChecker(host) {
|
|
67016
67044
|
for (let i = 0; i < types.length; i++) {
|
67017
67045
|
if (include[i]) {
|
67018
67046
|
const targetType = getTypeOfPropertyOrIndexSignatureOfType(types[i], propertyName);
|
67019
|
-
if (targetType
|
67020
|
-
|
67021
|
-
|
67022
|
-
|
67047
|
+
if (targetType) {
|
67048
|
+
if (someType(getDiscriminatingType(), (t) => !!related(t, targetType))) {
|
67049
|
+
matched = true;
|
67050
|
+
} else {
|
67051
|
+
include[i] = 3 /* Maybe */;
|
67052
|
+
}
|
67023
67053
|
}
|
67024
67054
|
}
|
67025
67055
|
}
|
@@ -68079,7 +68109,7 @@ function createTypeChecker(host) {
|
|
68079
68109
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
68080
68110
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
68081
68111
|
}
|
68082
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags &
|
68112
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
68083
68113
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
68084
68114
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
68085
68115
|
}
|
@@ -68380,9 +68410,6 @@ function createTypeChecker(host) {
|
|
68380
68410
|
pos = p;
|
68381
68411
|
}
|
68382
68412
|
}
|
68383
|
-
function isTupleOfSelf(typeParameter, type) {
|
68384
|
-
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
68385
|
-
}
|
68386
68413
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
68387
68414
|
let bivariant = false;
|
68388
68415
|
let propagationType;
|
@@ -68468,9 +68495,6 @@ function createTypeChecker(host) {
|
|
68468
68495
|
inference.priority = priority;
|
68469
68496
|
}
|
68470
68497
|
if (priority === inference.priority) {
|
68471
|
-
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
68472
|
-
return;
|
68473
|
-
}
|
68474
68498
|
if (contravariant && !bivariant) {
|
68475
68499
|
if (!contains(inference.contraCandidates, candidate)) {
|
68476
68500
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
@@ -75681,7 +75705,7 @@ function createTypeChecker(host) {
|
|
75681
75705
|
inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
|
75682
75706
|
}
|
75683
75707
|
const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
|
75684
|
-
const returnSourceType = instantiateType(contextualType, outerContext && outerContext
|
75708
|
+
const returnSourceType = instantiateType(contextualType, outerContext && createOuterReturnMapper(outerContext));
|
75685
75709
|
inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
|
75686
75710
|
context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
|
75687
75711
|
}
|
@@ -75917,7 +75941,7 @@ function createTypeChecker(host) {
|
|
75917
75941
|
const flags = isInJSFile(argument) ? 1 /* Parentheses */ | 32 /* Satisfies */ | -2147483648 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */ | 32 /* Satisfies */;
|
75918
75942
|
return skipOuterExpressions(argument, flags);
|
75919
75943
|
}
|
75920
|
-
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain
|
75944
|
+
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
75921
75945
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
75922
75946
|
if (isJsxCallLike(node)) {
|
75923
75947
|
if (!checkApplicableSignatureForJsxCallLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
|
@@ -75951,8 +75975,7 @@ function createTypeChecker(host) {
|
|
75951
75975
|
void 0,
|
75952
75976
|
checkMode
|
75953
75977
|
);
|
75954
|
-
const
|
75955
|
-
const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
|
75978
|
+
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
75956
75979
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
75957
75980
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
75958
75981
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
@@ -76373,9 +76396,7 @@ function createTypeChecker(host) {
|
|
76373
76396
|
0 /* Normal */,
|
76374
76397
|
/*reportErrors*/
|
76375
76398
|
true,
|
76376
|
-
() => chain
|
76377
|
-
/*inferenceContext*/
|
76378
|
-
void 0
|
76399
|
+
() => chain
|
76379
76400
|
);
|
76380
76401
|
if (diags) {
|
76381
76402
|
for (const d of diags) {
|
@@ -76411,9 +76432,7 @@ function createTypeChecker(host) {
|
|
76411
76432
|
0 /* Normal */,
|
76412
76433
|
/*reportErrors*/
|
76413
76434
|
true,
|
76414
|
-
chain2
|
76415
|
-
/*inferenceContext*/
|
76416
|
-
void 0
|
76435
|
+
chain2
|
76417
76436
|
);
|
76418
76437
|
if (diags2) {
|
76419
76438
|
if (diags2.length <= min2) {
|
@@ -76487,7 +76506,6 @@ function createTypeChecker(host) {
|
|
76487
76506
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
76488
76507
|
}
|
76489
76508
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
76490
|
-
var _a, _b;
|
76491
76509
|
candidatesForArgumentError = void 0;
|
76492
76510
|
candidateForArgumentArityError = void 0;
|
76493
76511
|
candidateForTypeArgumentError = void 0;
|
@@ -76505,8 +76523,6 @@ function createTypeChecker(host) {
|
|
76505
76523
|
/*reportErrors*/
|
76506
76524
|
false,
|
76507
76525
|
/*containingMessageChain*/
|
76508
|
-
void 0,
|
76509
|
-
/*inferenceContext*/
|
76510
76526
|
void 0
|
76511
76527
|
)) {
|
76512
76528
|
candidatesForArgumentError = [candidate];
|
@@ -76515,18 +76531,13 @@ function createTypeChecker(host) {
|
|
76515
76531
|
return candidate;
|
76516
76532
|
}
|
76517
76533
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
76518
|
-
|
76534
|
+
const candidate = candidates2[candidateIndex];
|
76519
76535
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
76520
76536
|
continue;
|
76521
76537
|
}
|
76522
76538
|
let checkCandidate;
|
76523
76539
|
let inferenceContext;
|
76524
76540
|
if (candidate.typeParameters) {
|
76525
|
-
const paramLocation = (_b = (_a = candidate.typeParameters[0].symbol.declarations) == null ? void 0 : _a[0]) == null ? void 0 : _b.parent;
|
76526
|
-
const candidateParameterContext = paramLocation || (candidate.declaration && isConstructorDeclaration(candidate.declaration) ? candidate.declaration.parent : candidate.declaration);
|
76527
|
-
if (candidateParameterContext && findAncestor(node, (a) => a === candidateParameterContext)) {
|
76528
|
-
candidate = getImplementationSignature(candidate);
|
76529
|
-
}
|
76530
76541
|
let typeArgumentTypes;
|
76531
76542
|
if (some(typeArguments)) {
|
76532
76543
|
typeArgumentTypes = checkTypeArguments(
|
@@ -76546,7 +76557,7 @@ function createTypeChecker(host) {
|
|
76546
76557
|
/*flags*/
|
76547
76558
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
76548
76559
|
);
|
76549
|
-
typeArgumentTypes =
|
76560
|
+
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
76550
76561
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
76551
76562
|
}
|
76552
76563
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
@@ -76566,8 +76577,7 @@ function createTypeChecker(host) {
|
|
76566
76577
|
/*reportErrors*/
|
76567
76578
|
false,
|
76568
76579
|
/*containingMessageChain*/
|
76569
|
-
void 0
|
76570
|
-
inferenceContext
|
76580
|
+
void 0
|
76571
76581
|
)) {
|
76572
76582
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
76573
76583
|
continue;
|
@@ -76575,7 +76585,7 @@ function createTypeChecker(host) {
|
|
76575
76585
|
if (argCheckMode) {
|
76576
76586
|
argCheckMode = 0 /* Normal */;
|
76577
76587
|
if (inferenceContext) {
|
76578
|
-
const typeArgumentTypes =
|
76588
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
76579
76589
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
76580
76590
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
76581
76591
|
candidateForArgumentArityError = checkCandidate;
|
@@ -76591,8 +76601,7 @@ function createTypeChecker(host) {
|
|
76591
76601
|
/*reportErrors*/
|
76592
76602
|
false,
|
76593
76603
|
/*containingMessageChain*/
|
76594
|
-
void 0
|
76595
|
-
inferenceContext
|
76604
|
+
void 0
|
76596
76605
|
)) {
|
76597
76606
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
76598
76607
|
continue;
|
@@ -76907,11 +76916,11 @@ function createTypeChecker(host) {
|
|
76907
76916
|
const maybeMissingAwait = awaitedType && getSignaturesOfType(awaitedType, kind).length > 0;
|
76908
76917
|
if (apparentType.flags & 1048576 /* Union */) {
|
76909
76918
|
const types = apparentType.types;
|
76910
|
-
let
|
76919
|
+
let hasSignatures2 = false;
|
76911
76920
|
for (const constituent of types) {
|
76912
76921
|
const signatures = getSignaturesOfType(constituent, kind);
|
76913
76922
|
if (signatures.length !== 0) {
|
76914
|
-
|
76923
|
+
hasSignatures2 = true;
|
76915
76924
|
if (errorInfo) {
|
76916
76925
|
break;
|
76917
76926
|
}
|
@@ -76928,12 +76937,12 @@ function createTypeChecker(host) {
|
|
76928
76937
|
typeToString(apparentType)
|
76929
76938
|
);
|
76930
76939
|
}
|
76931
|
-
if (
|
76940
|
+
if (hasSignatures2) {
|
76932
76941
|
break;
|
76933
76942
|
}
|
76934
76943
|
}
|
76935
76944
|
}
|
76936
|
-
if (!
|
76945
|
+
if (!hasSignatures2) {
|
76937
76946
|
errorInfo = chainDiagnosticMessages(
|
76938
76947
|
/*details*/
|
76939
76948
|
void 0,
|
@@ -77722,11 +77731,11 @@ function createTypeChecker(host) {
|
|
77722
77731
|
}
|
77723
77732
|
return result;
|
77724
77733
|
function getInstantiatedType(type) {
|
77725
|
-
let
|
77734
|
+
let hasSignatures2 = false;
|
77726
77735
|
let hasApplicableSignature = false;
|
77727
77736
|
const result2 = getInstantiatedTypePart(type);
|
77728
77737
|
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
77729
|
-
if (
|
77738
|
+
if (hasSignatures2 && !hasApplicableSignature) {
|
77730
77739
|
nonApplicableType ?? (nonApplicableType = type);
|
77731
77740
|
}
|
77732
77741
|
return result2;
|
@@ -77735,7 +77744,7 @@ function createTypeChecker(host) {
|
|
77735
77744
|
const resolved = resolveStructuredTypeMembers(type2);
|
77736
77745
|
const callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
77737
77746
|
const constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
77738
|
-
|
77747
|
+
hasSignatures2 || (hasSignatures2 = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
77739
77748
|
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
77740
77749
|
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
77741
77750
|
const result3 = createAnonymousType(createSymbol(0 /* None */, "__instantiationExpression" /* InstantiationExpression */), resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
@@ -77830,7 +77839,7 @@ function createTypeChecker(host) {
|
|
77830
77839
|
error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
77831
77840
|
}
|
77832
77841
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
77833
|
-
error(node, Diagnostics.
|
77842
|
+
error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_node20_or_nodenext);
|
77834
77843
|
}
|
77835
77844
|
const file = getSourceFileOfNode(node);
|
77836
77845
|
Debug.assert(!!(file.flags & 8388608 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
@@ -79079,6 +79088,7 @@ function createTypeChecker(host) {
|
|
79079
79088
|
switch (moduleKind) {
|
79080
79089
|
case 100 /* Node16 */:
|
79081
79090
|
case 101 /* Node18 */:
|
79091
|
+
case 102 /* Node20 */:
|
79082
79092
|
case 199 /* NodeNext */:
|
79083
79093
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
79084
79094
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
@@ -79099,7 +79109,7 @@ function createTypeChecker(host) {
|
|
79099
79109
|
// fallthrough
|
79100
79110
|
default:
|
79101
79111
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
79102
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
79112
|
+
const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_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_node20_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
|
79103
79113
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
79104
79114
|
hasError = true;
|
79105
79115
|
break;
|
@@ -80532,7 +80542,7 @@ function createTypeChecker(host) {
|
|
80532
80542
|
}
|
80533
80543
|
}
|
80534
80544
|
}
|
80535
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context)
|
80545
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
80536
80546
|
}
|
80537
80547
|
}
|
80538
80548
|
}
|
@@ -85838,10 +85848,10 @@ function createTypeChecker(host) {
|
|
85838
85848
|
if (!moduleSupportsImportAttributes(moduleKind)) {
|
85839
85849
|
return grammarErrorOnNode(
|
85840
85850
|
node,
|
85841
|
-
isImportAttributes2 ? Diagnostics.
|
85851
|
+
isImportAttributes2 ? Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve
|
85842
85852
|
);
|
85843
85853
|
}
|
85844
|
-
if (moduleKind
|
85854
|
+
if (102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && !isImportAttributes2) {
|
85845
85855
|
return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
|
85846
85856
|
}
|
85847
85857
|
if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === 1 /* CommonJS */) {
|
@@ -89343,6 +89353,7 @@ function createTypeChecker(host) {
|
|
89343
89353
|
switch (moduleKind) {
|
89344
89354
|
case 100 /* Node16 */:
|
89345
89355
|
case 101 /* Node18 */:
|
89356
|
+
case 102 /* Node20 */:
|
89346
89357
|
case 199 /* NodeNext */:
|
89347
89358
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
89348
89359
|
diagnostics.add(
|
@@ -89361,7 +89372,7 @@ function createTypeChecker(host) {
|
|
89361
89372
|
// fallthrough
|
89362
89373
|
default:
|
89363
89374
|
diagnostics.add(
|
89364
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
89375
|
+
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
|
89365
89376
|
);
|
89366
89377
|
break;
|
89367
89378
|
}
|
@@ -89998,7 +90009,7 @@ function createTypeChecker(host) {
|
|
89998
90009
|
return grammarErrorOnNode(node, Diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve);
|
89999
90010
|
}
|
90000
90011
|
} else if (moduleKind === 5 /* ES2015 */) {
|
90001
|
-
return grammarErrorOnNode(node, Diagnostics.
|
90012
|
+
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_node20_or_nodenext);
|
90002
90013
|
}
|
90003
90014
|
if (node.typeArguments) {
|
90004
90015
|
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);
|
@@ -90008,7 +90019,7 @@ function createTypeChecker(host) {
|
|
90008
90019
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
90009
90020
|
if (nodeArguments.length > 1) {
|
90010
90021
|
const importAttributesArgument = nodeArguments[1];
|
90011
|
-
return grammarErrorOnNode(importAttributesArgument, Diagnostics.
|
90022
|
+
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_node20_nodenext_or_preserve);
|
90012
90023
|
}
|
90013
90024
|
}
|
90014
90025
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
@@ -90044,8 +90055,8 @@ function createTypeChecker(host) {
|
|
90044
90055
|
}
|
90045
90056
|
function findBestTypeForInvokable(source, unionTarget) {
|
90046
90057
|
let signatureKind = 0 /* Call */;
|
90047
|
-
const
|
90048
|
-
if (
|
90058
|
+
const hasSignatures2 = getSignaturesOfType(source, signatureKind).length > 0 || (signatureKind = 1 /* Construct */, getSignaturesOfType(source, signatureKind).length > 0);
|
90059
|
+
if (hasSignatures2) {
|
90049
90060
|
return find(unionTarget.types, (t) => getSignaturesOfType(t, signatureKind).length > 0);
|
90050
90061
|
}
|
90051
90062
|
}
|
@@ -115182,6 +115193,7 @@ function getModuleTransformer(moduleKind) {
|
|
115182
115193
|
case 5 /* ES2015 */:
|
115183
115194
|
case 100 /* Node16 */:
|
115184
115195
|
case 101 /* Node18 */:
|
115196
|
+
case 102 /* Node20 */:
|
115185
115197
|
case 199 /* NodeNext */:
|
115186
115198
|
case 1 /* CommonJS */:
|
115187
115199
|
return transformImpliedNodeFormatDependentModule;
|
@@ -124823,7 +124835,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
124823
124835
|
}
|
124824
124836
|
function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) {
|
124825
124837
|
var _a;
|
124826
|
-
const fileOrDirectoryExistsUsingSource2 = isFile ?
|
124838
|
+
const fileOrDirectoryExistsUsingSource2 = isFile ? fileExistsIfProjectReferenceDts : directoryExistsIfProjectReferenceDeclDir;
|
124827
124839
|
const result = fileOrDirectoryExistsUsingSource2(fileOrDirectory);
|
124828
124840
|
if (result !== void 0) return result;
|
124829
124841
|
const symlinkCache = host.getSymlinkCache();
|