typescript 5.9.0-dev.20250609 → 5.9.0-dev.20250611
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/typescript.js
CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
2285
2285
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
2287
2287
|
var versionMajorMinor = "5.9";
|
2288
|
-
var version = `${versionMajorMinor}.0-dev.
|
2288
|
+
var version = `${versionMajorMinor}.0-dev.20250611`;
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -6523,6 +6523,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
6523
6523
|
ObjectFlags3[ObjectFlags3["NonInferrableType"] = 262144] = "NonInferrableType";
|
6524
6524
|
ObjectFlags3[ObjectFlags3["CouldContainTypeVariablesComputed"] = 524288] = "CouldContainTypeVariablesComputed";
|
6525
6525
|
ObjectFlags3[ObjectFlags3["CouldContainTypeVariables"] = 1048576] = "CouldContainTypeVariables";
|
6526
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
6526
6527
|
ObjectFlags3[ObjectFlags3["ClassOrInterface"] = 3] = "ClassOrInterface";
|
6527
6528
|
ObjectFlags3[ObjectFlags3["RequiresWidening"] = 196608] = "RequiresWidening";
|
6528
6529
|
ObjectFlags3[ObjectFlags3["PropagatingFlags"] = 458752] = "PropagatingFlags";
|
@@ -6531,7 +6532,6 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
6531
6532
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
6532
6533
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
6533
6534
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
6534
|
-
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
6535
6535
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
6536
6536
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
6537
6537
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
@@ -6736,6 +6736,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind3) => {
|
|
6736
6736
|
ModuleKind3[ModuleKind3["ESNext"] = 99] = "ESNext";
|
6737
6737
|
ModuleKind3[ModuleKind3["Node16"] = 100] = "Node16";
|
6738
6738
|
ModuleKind3[ModuleKind3["Node18"] = 101] = "Node18";
|
6739
|
+
ModuleKind3[ModuleKind3["Node20"] = 102] = "Node20";
|
6739
6740
|
ModuleKind3[ModuleKind3["NodeNext"] = 199] = "NodeNext";
|
6740
6741
|
ModuleKind3[ModuleKind3["Preserve"] = 200] = "Preserve";
|
6741
6742
|
return ModuleKind3;
|
@@ -9422,8 +9423,8 @@ var Diagnostics = {
|
|
9422
9423
|
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."),
|
9423
9424
|
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."),
|
9424
9425
|
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."),
|
9425
|
-
|
9426
|
-
|
9426
|
+
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'."),
|
9427
|
+
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'."),
|
9427
9428
|
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."),
|
9428
9429
|
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."),
|
9429
9430
|
String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
@@ -9440,7 +9441,7 @@ var Diagnostics = {
|
|
9440
9441
|
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."),
|
9441
9442
|
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}')'?"),
|
9442
9443
|
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."),
|
9443
|
-
|
9444
|
+
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'."),
|
9444
9445
|
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
9445
9446
|
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."),
|
9446
9447
|
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."),
|
@@ -9470,7 +9471,7 @@ var Diagnostics = {
|
|
9470
9471
|
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."),
|
9471
9472
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
9472
9473
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
9473
|
-
|
9474
|
+
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."),
|
9474
9475
|
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'."),
|
9475
9476
|
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'."),
|
9476
9477
|
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 `}`?"),
|
@@ -9521,7 +9522,7 @@ var Diagnostics = {
|
|
9521
9522
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
9522
9523
|
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:"),
|
9523
9524
|
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."),
|
9524
|
-
|
9525
|
+
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."),
|
9525
9526
|
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."),
|
9526
9527
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
9527
9528
|
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}'?"),
|
@@ -10165,9 +10166,9 @@ var Diagnostics = {
|
|
10165
10166
|
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."),
|
10166
10167
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
10167
10168
|
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}'?"),
|
10168
|
-
|
10169
|
+
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'."),
|
10169
10170
|
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."),
|
10170
|
-
|
10171
|
+
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'."),
|
10171
10172
|
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}'?"),
|
10172
10173
|
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."),
|
10173
10174
|
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}'?"),
|
@@ -10187,7 +10188,7 @@ var Diagnostics = {
|
|
10187
10188
|
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'."),
|
10188
10189
|
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."),
|
10189
10190
|
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."),
|
10190
|
-
|
10191
|
+
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."),
|
10191
10192
|
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."),
|
10192
10193
|
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."),
|
10193
10194
|
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."),
|
@@ -21897,7 +21898,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
21897
21898
|
dependencies: ["module"],
|
21898
21899
|
computeValue: (compilerOptions) => {
|
21899
21900
|
const target = compilerOptions.target === 0 /* ES3 */ ? void 0 : compilerOptions.target;
|
21900
|
-
return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 101 /* Node18 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
|
21901
|
+
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 */);
|
21901
21902
|
}
|
21902
21903
|
},
|
21903
21904
|
module: {
|
@@ -21917,6 +21918,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
21917
21918
|
break;
|
21918
21919
|
case 100 /* Node16 */:
|
21919
21920
|
case 101 /* Node18 */:
|
21921
|
+
case 102 /* Node20 */:
|
21920
21922
|
moduleResolution = 3 /* Node16 */;
|
21921
21923
|
break;
|
21922
21924
|
case 199 /* NodeNext */:
|
@@ -21958,6 +21960,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
21958
21960
|
switch (_computedOptions.module.computeValue(compilerOptions)) {
|
21959
21961
|
case 100 /* Node16 */:
|
21960
21962
|
case 101 /* Node18 */:
|
21963
|
+
case 102 /* Node20 */:
|
21961
21964
|
case 199 /* NodeNext */:
|
21962
21965
|
case 200 /* Preserve */:
|
21963
21966
|
return true;
|
@@ -22018,6 +22021,14 @@ var _computedOptions = createComputedCompilerOptions({
|
|
22018
22021
|
if (compilerOptions.resolveJsonModule !== void 0) {
|
22019
22022
|
return compilerOptions.resolveJsonModule;
|
22020
22023
|
}
|
22024
|
+
switch (_computedOptions.module.computeValue(compilerOptions)) {
|
22025
|
+
// TODO in 6.0: uncomment
|
22026
|
+
// case ModuleKind.Node16:
|
22027
|
+
// case ModuleKind.Node18:
|
22028
|
+
case 102 /* Node20 */:
|
22029
|
+
case 199 /* NodeNext */:
|
22030
|
+
return true;
|
22031
|
+
}
|
22021
22032
|
return _computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
|
22022
22033
|
}
|
22023
22034
|
},
|
@@ -38573,7 +38584,7 @@ var Parser;
|
|
38573
38584
|
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
38574
38585
|
phaseModifier = 156 /* TypeKeyword */;
|
38575
38586
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
38576
|
-
} else if ((identifier == null ? void 0 : identifier.escapedText) === "defer" && token()
|
38587
|
+
} else if ((identifier == null ? void 0 : identifier.escapedText) === "defer" && (token() === 161 /* FromKeyword */ ? !lookAhead(nextTokenIsStringLiteral) : token() !== 28 /* CommaToken */ && token() !== 64 /* EqualsToken */)) {
|
38577
38588
|
phaseModifier = 166 /* DeferKeyword */;
|
38578
38589
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
38579
38590
|
}
|
@@ -40995,6 +41006,7 @@ var moduleOptionDeclaration = {
|
|
40995
41006
|
esnext: 99 /* ESNext */,
|
40996
41007
|
node16: 100 /* Node16 */,
|
40997
41008
|
node18: 101 /* Node18 */,
|
41009
|
+
node20: 102 /* Node20 */,
|
40998
41010
|
nodenext: 199 /* NodeNext */,
|
40999
41011
|
preserve: 200 /* Preserve */
|
41000
41012
|
})),
|
@@ -53019,6 +53031,12 @@ function createTypeChecker(host) {
|
|
53019
53031
|
getExternalModuleRequireArgument(node) || getExternalModuleImportEqualsDeclarationExpression(node)
|
53020
53032
|
);
|
53021
53033
|
const resolved2 = resolveExternalModuleSymbol(immediate);
|
53034
|
+
if (resolved2 && 102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
53035
|
+
const moduleExports = getExportOfModule(resolved2, "module.exports", node, dontResolveAlias);
|
53036
|
+
if (moduleExports) {
|
53037
|
+
return moduleExports;
|
53038
|
+
}
|
53039
|
+
}
|
53022
53040
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
53023
53041
|
node,
|
53024
53042
|
immediate,
|
@@ -53148,14 +53166,29 @@ function createTypeChecker(host) {
|
|
53148
53166
|
}
|
53149
53167
|
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
53150
53168
|
var _a;
|
53169
|
+
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
53170
|
+
const specifier = getModuleSpecifierForImportOrExport(node);
|
53151
53171
|
let exportDefaultSymbol;
|
53172
|
+
let exportModuleDotExportsSymbol;
|
53152
53173
|
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
53153
53174
|
exportDefaultSymbol = moduleSymbol;
|
53175
|
+
} 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))) {
|
53176
|
+
if (!getESModuleInterop(compilerOptions)) {
|
53177
|
+
error2(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), "esModuleInterop");
|
53178
|
+
return void 0;
|
53179
|
+
}
|
53180
|
+
markSymbolOfAliasDeclarationIfTypeOnly(
|
53181
|
+
node,
|
53182
|
+
exportModuleDotExportsSymbol,
|
53183
|
+
/*finalTarget*/
|
53184
|
+
void 0,
|
53185
|
+
/*overwriteEmpty*/
|
53186
|
+
false
|
53187
|
+
);
|
53188
|
+
return exportModuleDotExportsSymbol;
|
53154
53189
|
} else {
|
53155
53190
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
53156
53191
|
}
|
53157
|
-
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
53158
|
-
const specifier = getModuleSpecifierForImportOrExport(node);
|
53159
53192
|
if (!specifier) {
|
53160
53193
|
return exportDefaultSymbol;
|
53161
53194
|
}
|
@@ -54202,7 +54235,8 @@ function createTypeChecker(host) {
|
|
54202
54235
|
return symbol;
|
54203
54236
|
}
|
54204
54237
|
const referenceParent = referencingLocation.parent;
|
54205
|
-
|
54238
|
+
const namespaceImport = isImportDeclaration(referenceParent) && getNamespaceDeclarationNode(referenceParent);
|
54239
|
+
if (namespaceImport || isImportCall(referenceParent)) {
|
54206
54240
|
const reference = isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
|
54207
54241
|
const type = getTypeOfSymbol(symbol);
|
54208
54242
|
const defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
|
@@ -54210,13 +54244,20 @@ function createTypeChecker(host) {
|
|
54210
54244
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
54211
54245
|
}
|
54212
54246
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
54213
|
-
const
|
54214
|
-
|
54215
|
-
|
54216
|
-
if (!
|
54217
|
-
|
54247
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(reference);
|
54248
|
+
let exportModuleDotExportsSymbol;
|
54249
|
+
if (namespaceImport && targetFile && 102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && usageMode === 1 /* CommonJS */ && host.getImpliedNodeFormatForEmit(targetFile) === 99 /* ESNext */ && (exportModuleDotExportsSymbol = resolveExportByName(symbol, "module.exports", namespaceImport, dontResolveAlias))) {
|
54250
|
+
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) {
|
54251
|
+
error2(referencingLocation, Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, "esModuleInterop");
|
54252
|
+
}
|
54253
|
+
if (getESModuleInterop(compilerOptions) && hasSignatures(type)) {
|
54254
|
+
return cloneTypeAsModuleType(exportModuleDotExportsSymbol, type, referenceParent);
|
54218
54255
|
}
|
54219
|
-
|
54256
|
+
return exportModuleDotExportsSymbol;
|
54257
|
+
}
|
54258
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(usageMode, host.getImpliedNodeFormatForEmit(targetFile));
|
54259
|
+
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
54260
|
+
if (hasSignatures(type) || getPropertyOfType(
|
54220
54261
|
type,
|
54221
54262
|
"default" /* Default */,
|
54222
54263
|
/*skipObjectFunctionPropertyAugment*/
|
@@ -54230,6 +54271,9 @@ function createTypeChecker(host) {
|
|
54230
54271
|
}
|
54231
54272
|
return symbol;
|
54232
54273
|
}
|
54274
|
+
function hasSignatures(type) {
|
54275
|
+
return some(getSignaturesOfStructuredType(type, 0 /* Call */)) || some(getSignaturesOfStructuredType(type, 1 /* Construct */));
|
54276
|
+
}
|
54233
54277
|
function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
|
54234
54278
|
const result = createSymbol(symbol.flags, symbol.escapedName);
|
54235
54279
|
result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
|
@@ -56343,7 +56387,7 @@ function createTypeChecker(host) {
|
|
56343
56387
|
}
|
56344
56388
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
56345
56389
|
if (some(abstractSignatures)) {
|
56346
|
-
const types = map(abstractSignatures,
|
56390
|
+
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
56347
56391
|
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
|
56348
56392
|
// the logic in `createTypeNodesFromResolvedType`.
|
56349
56393
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
@@ -64245,8 +64289,10 @@ function createTypeChecker(host) {
|
|
64245
64289
|
if (returnSignature) {
|
64246
64290
|
const newReturnSignature = cloneSignature(returnSignature);
|
64247
64291
|
newReturnSignature.typeParameters = inferredTypeParameters;
|
64292
|
+
const newReturnType = getOrCreateTypeFromSignature(newReturnSignature);
|
64293
|
+
newReturnType.mapper = instantiatedSignature.mapper;
|
64248
64294
|
const newInstantiatedSignature = cloneSignature(instantiatedSignature);
|
64249
|
-
newInstantiatedSignature.resolvedReturnType =
|
64295
|
+
newInstantiatedSignature.resolvedReturnType = newReturnType;
|
64250
64296
|
return newInstantiatedSignature;
|
64251
64297
|
}
|
64252
64298
|
}
|
@@ -64296,12 +64342,6 @@ function createTypeChecker(host) {
|
|
64296
64342
|
isInJSFile(signature.declaration)
|
64297
64343
|
);
|
64298
64344
|
}
|
64299
|
-
function getImplementationSignature(signature) {
|
64300
|
-
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
64301
|
-
}
|
64302
|
-
function createImplementationSignature(signature) {
|
64303
|
-
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
64304
|
-
}
|
64305
64345
|
function getBaseSignature(signature) {
|
64306
64346
|
const typeParameters = signature.typeParameters;
|
64307
64347
|
if (typeParameters) {
|
@@ -64324,22 +64364,12 @@ function createTypeChecker(host) {
|
|
64324
64364
|
}
|
64325
64365
|
return signature;
|
64326
64366
|
}
|
64327
|
-
function getOrCreateTypeFromSignature(signature
|
64328
|
-
var _a;
|
64367
|
+
function getOrCreateTypeFromSignature(signature) {
|
64368
|
+
var _a, _b;
|
64329
64369
|
if (!signature.isolatedSignatureType) {
|
64330
64370
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
64331
64371
|
const isConstructor = kind === void 0 || kind === 177 /* Constructor */ || kind === 181 /* ConstructSignature */ || kind === 186 /* ConstructorType */;
|
64332
|
-
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */,
|
64333
|
-
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
64334
|
-
type.symbol.declarations = [signature.declaration];
|
64335
|
-
type.symbol.valueDeclaration = signature.declaration;
|
64336
|
-
}
|
64337
|
-
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
64338
|
-
signature.declaration,
|
64339
|
-
/*includeThisTypes*/
|
64340
|
-
true
|
64341
|
-
));
|
64342
|
-
type.outerTypeParameters = outerTypeParameters;
|
64372
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, (_b = signature.declaration) == null ? void 0 : _b.symbol);
|
64343
64373
|
type.members = emptySymbols;
|
64344
64374
|
type.properties = emptyArray;
|
64345
64375
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
@@ -67752,6 +67782,9 @@ function createTypeChecker(host) {
|
|
67752
67782
|
const forwardInferences = context.inferences.slice(index);
|
67753
67783
|
return createTypeMapper(map(forwardInferences, (i) => i.typeParameter), map(forwardInferences, () => unknownType));
|
67754
67784
|
}
|
67785
|
+
function createOuterReturnMapper(context) {
|
67786
|
+
return context.outerReturnMapper ?? (context.outerReturnMapper = mergeTypeMappers(context.returnMapper, cloneInferenceContext(context).mapper));
|
67787
|
+
}
|
67755
67788
|
function combineTypeMappers(mapper1, mapper2) {
|
67756
67789
|
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
67757
67790
|
}
|
@@ -67831,7 +67864,7 @@ function createTypeChecker(host) {
|
|
67831
67864
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
67832
67865
|
const links = getNodeLinks(declaration);
|
67833
67866
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
67834
|
-
let typeParameters =
|
67867
|
+
let typeParameters = links.outerTypeParameters;
|
67835
67868
|
if (!typeParameters) {
|
67836
67869
|
let outerTypeParameters = getOuterTypeParameters(
|
67837
67870
|
declaration,
|
@@ -67852,19 +67885,17 @@ function createTypeChecker(host) {
|
|
67852
67885
|
const typeArguments = map(typeParameters, (t) => getMappedType(t, combinedMapper));
|
67853
67886
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
67854
67887
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
67855
|
-
const id =
|
67888
|
+
const id = getTypeListId(typeArguments) + getAliasId(newAliasSymbol, newAliasTypeArguments);
|
67856
67889
|
if (!target.instantiations) {
|
67857
67890
|
target.instantiations = /* @__PURE__ */ new Map();
|
67858
67891
|
target.instantiations.set(getTypeListId(typeParameters) + getAliasId(target.aliasSymbol, target.aliasTypeArguments), target);
|
67859
67892
|
}
|
67860
67893
|
let result = target.instantiations.get(id);
|
67861
67894
|
if (!result) {
|
67862
|
-
|
67863
|
-
|
67864
|
-
|
67865
|
-
return result;
|
67895
|
+
let newMapper = createTypeMapper(typeParameters, typeArguments);
|
67896
|
+
if (target.objectFlags & 134217728 /* SingleSignatureType */ && mapper) {
|
67897
|
+
newMapper = combineTypeMappers(newMapper, mapper);
|
67866
67898
|
}
|
67867
|
-
const newMapper = createTypeMapper(typeParameters, typeArguments);
|
67868
67899
|
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);
|
67869
67900
|
target.instantiations.set(id, result);
|
67870
67901
|
const resultObjectFlags = getObjectFlags(result);
|
@@ -68017,9 +68048,6 @@ function createTypeChecker(host) {
|
|
68017
68048
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
68018
68049
|
result.node = type.node;
|
68019
68050
|
}
|
68020
|
-
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
68021
|
-
result.outerTypeParameters = type.outerTypeParameters;
|
68022
|
-
}
|
68023
68051
|
result.target = type;
|
68024
68052
|
result.mapper = mapper;
|
68025
68053
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
@@ -71627,10 +71655,12 @@ function createTypeChecker(host) {
|
|
71627
71655
|
for (let i = 0; i < types.length; i++) {
|
71628
71656
|
if (include[i]) {
|
71629
71657
|
const targetType = getTypeOfPropertyOrIndexSignatureOfType(types[i], propertyName);
|
71630
|
-
if (targetType
|
71631
|
-
|
71632
|
-
|
71633
|
-
|
71658
|
+
if (targetType) {
|
71659
|
+
if (someType(getDiscriminatingType(), (t) => !!related(t, targetType))) {
|
71660
|
+
matched = true;
|
71661
|
+
} else {
|
71662
|
+
include[i] = 3 /* Maybe */;
|
71663
|
+
}
|
71634
71664
|
}
|
71635
71665
|
}
|
71636
71666
|
}
|
@@ -72690,7 +72720,7 @@ function createTypeChecker(host) {
|
|
72690
72720
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
72691
72721
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
72692
72722
|
}
|
72693
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags &
|
72723
|
+
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));
|
72694
72724
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
72695
72725
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
72696
72726
|
}
|
@@ -72991,9 +73021,6 @@ function createTypeChecker(host) {
|
|
72991
73021
|
pos = p;
|
72992
73022
|
}
|
72993
73023
|
}
|
72994
|
-
function isTupleOfSelf(typeParameter, type) {
|
72995
|
-
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
72996
|
-
}
|
72997
73024
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
72998
73025
|
let bivariant = false;
|
72999
73026
|
let propagationType;
|
@@ -73079,9 +73106,6 @@ function createTypeChecker(host) {
|
|
73079
73106
|
inference.priority = priority;
|
73080
73107
|
}
|
73081
73108
|
if (priority === inference.priority) {
|
73082
|
-
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
73083
|
-
return;
|
73084
|
-
}
|
73085
73109
|
if (contravariant && !bivariant) {
|
73086
73110
|
if (!contains(inference.contraCandidates, candidate)) {
|
73087
73111
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
@@ -80292,7 +80316,7 @@ function createTypeChecker(host) {
|
|
80292
80316
|
inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
|
80293
80317
|
}
|
80294
80318
|
const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
|
80295
|
-
const returnSourceType = instantiateType(contextualType, outerContext && outerContext
|
80319
|
+
const returnSourceType = instantiateType(contextualType, outerContext && createOuterReturnMapper(outerContext));
|
80296
80320
|
inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
|
80297
80321
|
context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
|
80298
80322
|
}
|
@@ -80528,7 +80552,7 @@ function createTypeChecker(host) {
|
|
80528
80552
|
const flags = isInJSFile(argument) ? 1 /* Parentheses */ | 32 /* Satisfies */ | -2147483648 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */ | 32 /* Satisfies */;
|
80529
80553
|
return skipOuterExpressions(argument, flags);
|
80530
80554
|
}
|
80531
|
-
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain
|
80555
|
+
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
80532
80556
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
80533
80557
|
if (isJsxCallLike(node)) {
|
80534
80558
|
if (!checkApplicableSignatureForJsxCallLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
|
@@ -80562,8 +80586,7 @@ function createTypeChecker(host) {
|
|
80562
80586
|
void 0,
|
80563
80587
|
checkMode
|
80564
80588
|
);
|
80565
|
-
const
|
80566
|
-
const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
|
80589
|
+
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
80567
80590
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
80568
80591
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
80569
80592
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
@@ -80984,9 +81007,7 @@ function createTypeChecker(host) {
|
|
80984
81007
|
0 /* Normal */,
|
80985
81008
|
/*reportErrors*/
|
80986
81009
|
true,
|
80987
|
-
() => chain
|
80988
|
-
/*inferenceContext*/
|
80989
|
-
void 0
|
81010
|
+
() => chain
|
80990
81011
|
);
|
80991
81012
|
if (diags) {
|
80992
81013
|
for (const d of diags) {
|
@@ -81022,9 +81043,7 @@ function createTypeChecker(host) {
|
|
81022
81043
|
0 /* Normal */,
|
81023
81044
|
/*reportErrors*/
|
81024
81045
|
true,
|
81025
|
-
chain2
|
81026
|
-
/*inferenceContext*/
|
81027
|
-
void 0
|
81046
|
+
chain2
|
81028
81047
|
);
|
81029
81048
|
if (diags2) {
|
81030
81049
|
if (diags2.length <= min2) {
|
@@ -81098,7 +81117,6 @@ function createTypeChecker(host) {
|
|
81098
81117
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
81099
81118
|
}
|
81100
81119
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
81101
|
-
var _a, _b;
|
81102
81120
|
candidatesForArgumentError = void 0;
|
81103
81121
|
candidateForArgumentArityError = void 0;
|
81104
81122
|
candidateForTypeArgumentError = void 0;
|
@@ -81116,8 +81134,6 @@ function createTypeChecker(host) {
|
|
81116
81134
|
/*reportErrors*/
|
81117
81135
|
false,
|
81118
81136
|
/*containingMessageChain*/
|
81119
|
-
void 0,
|
81120
|
-
/*inferenceContext*/
|
81121
81137
|
void 0
|
81122
81138
|
)) {
|
81123
81139
|
candidatesForArgumentError = [candidate];
|
@@ -81126,18 +81142,13 @@ function createTypeChecker(host) {
|
|
81126
81142
|
return candidate;
|
81127
81143
|
}
|
81128
81144
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
81129
|
-
|
81145
|
+
const candidate = candidates2[candidateIndex];
|
81130
81146
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
81131
81147
|
continue;
|
81132
81148
|
}
|
81133
81149
|
let checkCandidate;
|
81134
81150
|
let inferenceContext;
|
81135
81151
|
if (candidate.typeParameters) {
|
81136
|
-
const paramLocation = (_b = (_a = candidate.typeParameters[0].symbol.declarations) == null ? void 0 : _a[0]) == null ? void 0 : _b.parent;
|
81137
|
-
const candidateParameterContext = paramLocation || (candidate.declaration && isConstructorDeclaration(candidate.declaration) ? candidate.declaration.parent : candidate.declaration);
|
81138
|
-
if (candidateParameterContext && findAncestor(node, (a) => a === candidateParameterContext)) {
|
81139
|
-
candidate = getImplementationSignature(candidate);
|
81140
|
-
}
|
81141
81152
|
let typeArgumentTypes;
|
81142
81153
|
if (some(typeArguments)) {
|
81143
81154
|
typeArgumentTypes = checkTypeArguments(
|
@@ -81157,7 +81168,7 @@ function createTypeChecker(host) {
|
|
81157
81168
|
/*flags*/
|
81158
81169
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
81159
81170
|
);
|
81160
|
-
typeArgumentTypes =
|
81171
|
+
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
81161
81172
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
81162
81173
|
}
|
81163
81174
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
@@ -81177,8 +81188,7 @@ function createTypeChecker(host) {
|
|
81177
81188
|
/*reportErrors*/
|
81178
81189
|
false,
|
81179
81190
|
/*containingMessageChain*/
|
81180
|
-
void 0
|
81181
|
-
inferenceContext
|
81191
|
+
void 0
|
81182
81192
|
)) {
|
81183
81193
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
81184
81194
|
continue;
|
@@ -81186,7 +81196,7 @@ function createTypeChecker(host) {
|
|
81186
81196
|
if (argCheckMode) {
|
81187
81197
|
argCheckMode = 0 /* Normal */;
|
81188
81198
|
if (inferenceContext) {
|
81189
|
-
const typeArgumentTypes =
|
81199
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
81190
81200
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
81191
81201
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
81192
81202
|
candidateForArgumentArityError = checkCandidate;
|
@@ -81202,8 +81212,7 @@ function createTypeChecker(host) {
|
|
81202
81212
|
/*reportErrors*/
|
81203
81213
|
false,
|
81204
81214
|
/*containingMessageChain*/
|
81205
|
-
void 0
|
81206
|
-
inferenceContext
|
81215
|
+
void 0
|
81207
81216
|
)) {
|
81208
81217
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
81209
81218
|
continue;
|
@@ -81518,11 +81527,11 @@ function createTypeChecker(host) {
|
|
81518
81527
|
const maybeMissingAwait = awaitedType && getSignaturesOfType(awaitedType, kind).length > 0;
|
81519
81528
|
if (apparentType.flags & 1048576 /* Union */) {
|
81520
81529
|
const types = apparentType.types;
|
81521
|
-
let
|
81530
|
+
let hasSignatures2 = false;
|
81522
81531
|
for (const constituent of types) {
|
81523
81532
|
const signatures = getSignaturesOfType(constituent, kind);
|
81524
81533
|
if (signatures.length !== 0) {
|
81525
|
-
|
81534
|
+
hasSignatures2 = true;
|
81526
81535
|
if (errorInfo) {
|
81527
81536
|
break;
|
81528
81537
|
}
|
@@ -81539,12 +81548,12 @@ function createTypeChecker(host) {
|
|
81539
81548
|
typeToString(apparentType)
|
81540
81549
|
);
|
81541
81550
|
}
|
81542
|
-
if (
|
81551
|
+
if (hasSignatures2) {
|
81543
81552
|
break;
|
81544
81553
|
}
|
81545
81554
|
}
|
81546
81555
|
}
|
81547
|
-
if (!
|
81556
|
+
if (!hasSignatures2) {
|
81548
81557
|
errorInfo = chainDiagnosticMessages(
|
81549
81558
|
/*details*/
|
81550
81559
|
void 0,
|
@@ -82333,11 +82342,11 @@ function createTypeChecker(host) {
|
|
82333
82342
|
}
|
82334
82343
|
return result;
|
82335
82344
|
function getInstantiatedType(type) {
|
82336
|
-
let
|
82345
|
+
let hasSignatures2 = false;
|
82337
82346
|
let hasApplicableSignature = false;
|
82338
82347
|
const result2 = getInstantiatedTypePart(type);
|
82339
82348
|
hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
|
82340
|
-
if (
|
82349
|
+
if (hasSignatures2 && !hasApplicableSignature) {
|
82341
82350
|
nonApplicableType ?? (nonApplicableType = type);
|
82342
82351
|
}
|
82343
82352
|
return result2;
|
@@ -82346,7 +82355,7 @@ function createTypeChecker(host) {
|
|
82346
82355
|
const resolved = resolveStructuredTypeMembers(type2);
|
82347
82356
|
const callSignatures = getInstantiatedSignatures(resolved.callSignatures);
|
82348
82357
|
const constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
|
82349
|
-
|
82358
|
+
hasSignatures2 || (hasSignatures2 = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
82350
82359
|
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
82351
82360
|
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
82352
82361
|
const result3 = createAnonymousType(createSymbol(0 /* None */, "__instantiationExpression" /* InstantiationExpression */), resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
@@ -82441,7 +82450,7 @@ function createTypeChecker(host) {
|
|
82441
82450
|
error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
82442
82451
|
}
|
82443
82452
|
} else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
|
82444
|
-
error2(node, Diagnostics.
|
82453
|
+
error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_node20_or_nodenext);
|
82445
82454
|
}
|
82446
82455
|
const file = getSourceFileOfNode(node);
|
82447
82456
|
Debug.assert(!!(file.flags & 8388608 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
@@ -83690,6 +83699,7 @@ function createTypeChecker(host) {
|
|
83690
83699
|
switch (moduleKind) {
|
83691
83700
|
case 100 /* Node16 */:
|
83692
83701
|
case 101 /* Node18 */:
|
83702
|
+
case 102 /* Node20 */:
|
83693
83703
|
case 199 /* NodeNext */:
|
83694
83704
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
83695
83705
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
@@ -83710,7 +83720,7 @@ function createTypeChecker(host) {
|
|
83710
83720
|
// fallthrough
|
83711
83721
|
default:
|
83712
83722
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
83713
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
83723
|
+
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;
|
83714
83724
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
83715
83725
|
hasError = true;
|
83716
83726
|
break;
|
@@ -85143,7 +85153,7 @@ function createTypeChecker(host) {
|
|
85143
85153
|
}
|
85144
85154
|
}
|
85145
85155
|
}
|
85146
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context)
|
85156
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
85147
85157
|
}
|
85148
85158
|
}
|
85149
85159
|
}
|
@@ -90449,10 +90459,10 @@ function createTypeChecker(host) {
|
|
90449
90459
|
if (!moduleSupportsImportAttributes(moduleKind)) {
|
90450
90460
|
return grammarErrorOnNode(
|
90451
90461
|
node,
|
90452
|
-
isImportAttributes2 ? Diagnostics.
|
90462
|
+
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
|
90453
90463
|
);
|
90454
90464
|
}
|
90455
|
-
if (moduleKind
|
90465
|
+
if (102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && !isImportAttributes2) {
|
90456
90466
|
return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
|
90457
90467
|
}
|
90458
90468
|
if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === 1 /* CommonJS */) {
|
@@ -93954,6 +93964,7 @@ function createTypeChecker(host) {
|
|
93954
93964
|
switch (moduleKind) {
|
93955
93965
|
case 100 /* Node16 */:
|
93956
93966
|
case 101 /* Node18 */:
|
93967
|
+
case 102 /* Node20 */:
|
93957
93968
|
case 199 /* NodeNext */:
|
93958
93969
|
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
|
93959
93970
|
diagnostics.add(
|
@@ -93972,7 +93983,7 @@ function createTypeChecker(host) {
|
|
93972
93983
|
// fallthrough
|
93973
93984
|
default:
|
93974
93985
|
diagnostics.add(
|
93975
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
93986
|
+
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)
|
93976
93987
|
);
|
93977
93988
|
break;
|
93978
93989
|
}
|
@@ -94609,7 +94620,7 @@ function createTypeChecker(host) {
|
|
94609
94620
|
return grammarErrorOnNode(node, Diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve);
|
94610
94621
|
}
|
94611
94622
|
} else if (moduleKind === 5 /* ES2015 */) {
|
94612
|
-
return grammarErrorOnNode(node, Diagnostics.
|
94623
|
+
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);
|
94613
94624
|
}
|
94614
94625
|
if (node.typeArguments) {
|
94615
94626
|
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);
|
@@ -94619,7 +94630,7 @@ function createTypeChecker(host) {
|
|
94619
94630
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
94620
94631
|
if (nodeArguments.length > 1) {
|
94621
94632
|
const importAttributesArgument = nodeArguments[1];
|
94622
|
-
return grammarErrorOnNode(importAttributesArgument, Diagnostics.
|
94633
|
+
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);
|
94623
94634
|
}
|
94624
94635
|
}
|
94625
94636
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
@@ -94655,8 +94666,8 @@ function createTypeChecker(host) {
|
|
94655
94666
|
}
|
94656
94667
|
function findBestTypeForInvokable(source, unionTarget) {
|
94657
94668
|
let signatureKind = 0 /* Call */;
|
94658
|
-
const
|
94659
|
-
if (
|
94669
|
+
const hasSignatures2 = getSignaturesOfType(source, signatureKind).length > 0 || (signatureKind = 1 /* Construct */, getSignaturesOfType(source, signatureKind).length > 0);
|
94670
|
+
if (hasSignatures2) {
|
94660
94671
|
return find(unionTarget.types, (t) => getSignaturesOfType(t, signatureKind).length > 0);
|
94661
94672
|
}
|
94662
94673
|
}
|
@@ -119975,6 +119986,7 @@ function getModuleTransformer(moduleKind) {
|
|
119975
119986
|
case 5 /* ES2015 */:
|
119976
119987
|
case 100 /* Node16 */:
|
119977
119988
|
case 101 /* Node18 */:
|
119989
|
+
case 102 /* Node20 */:
|
119978
119990
|
case 199 /* NodeNext */:
|
119979
119991
|
case 1 /* CommonJS */:
|
119980
119992
|
return transformImpliedNodeFormatDependentModule;
|
@@ -129673,7 +129685,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
129673
129685
|
}
|
129674
129686
|
function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) {
|
129675
129687
|
var _a;
|
129676
|
-
const fileOrDirectoryExistsUsingSource2 = isFile ?
|
129688
|
+
const fileOrDirectoryExistsUsingSource2 = isFile ? fileExistsIfProjectReferenceDts : directoryExistsIfProjectReferenceDeclDir;
|
129677
129689
|
const result = fileOrDirectoryExistsUsingSource2(fileOrDirectory);
|
129678
129690
|
if (result !== void 0) return result;
|
129679
129691
|
const symlinkCache = host.getSymlinkCache();
|
@@ -158261,7 +158273,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
158261
158273
|
preferences
|
158262
158274
|
);
|
158263
158275
|
let fix;
|
158264
|
-
if (existingFix && importKind !== 2 /* Namespace */) {
|
158276
|
+
if (existingFix && importKind !== 2 /* Namespace */ && existingFix.kind !== 0 /* UseNamespace */ && existingFix.kind !== 1 /* JsdocTypeImport */) {
|
158265
158277
|
fix = {
|
158266
158278
|
...existingFix,
|
158267
158279
|
addAsTypeOnly,
|
@@ -159186,6 +159198,7 @@ function getUmdImportKind(importingFile, program, forceImportKeyword) {
|
|
159186
159198
|
return 2 /* Namespace */;
|
159187
159199
|
case 100 /* Node16 */:
|
159188
159200
|
case 101 /* Node18 */:
|
159201
|
+
case 102 /* Node20 */:
|
159189
159202
|
case 199 /* NodeNext */:
|
159190
159203
|
return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
|
159191
159204
|
default:
|
@@ -161743,9 +161756,9 @@ function getSuggestion(messageText) {
|
|
161743
161756
|
// src/services/codefixes/fixModuleAndTargetOptions.ts
|
161744
161757
|
registerCodeFix({
|
161745
161758
|
errorCodes: [
|
161746
|
-
Diagnostics.
|
161747
|
-
Diagnostics.
|
161748
|
-
Diagnostics.
|
161759
|
+
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.code,
|
161760
|
+
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.code,
|
161761
|
+
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.code
|
161749
161762
|
],
|
161750
161763
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
161751
161764
|
const compilerOptions = context.program.getCompilerOptions();
|
@@ -186278,6 +186291,7 @@ var ModuleKind2 = /* @__PURE__ */ ((ModuleKind3) => {
|
|
186278
186291
|
ModuleKind3["ESNext"] = "esnext";
|
186279
186292
|
ModuleKind3["Node16"] = "node16";
|
186280
186293
|
ModuleKind3["Node18"] = "node18";
|
186294
|
+
ModuleKind3["Node20"] = "node20";
|
186281
186295
|
ModuleKind3["NodeNext"] = "nodenext";
|
186282
186296
|
ModuleKind3["Preserve"] = "preserve";
|
186283
186297
|
return ModuleKind3;
|