@typescript-deploys/pr-build 5.6.0-pr-59287-2 → 5.6.0-pr-58296-32
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/lib.dom.d.ts +7 -7
- package/lib/lib.es2015.collection.d.ts +4 -4
- package/lib/lib.es2015.core.d.ts +1 -1
- package/lib/lib.es2015.generator.d.ts +2 -2
- package/lib/lib.es2015.promise.d.ts +1 -1
- package/lib/lib.es2015.symbol.d.ts +1 -1
- package/lib/lib.es2017.object.d.ts +2 -2
- package/lib/lib.es2017.sharedmemory.d.ts +1 -1
- package/lib/lib.es2018.asyncgenerator.d.ts +2 -2
- package/lib/lib.es2018.intl.d.ts +1 -1
- package/lib/lib.es2020.bigint.d.ts +3 -3
- package/lib/lib.es2020.intl.d.ts +1 -1
- package/lib/lib.es2021.promise.d.ts +1 -1
- package/lib/lib.es2021.weakref.d.ts +2 -2
- package/lib/lib.es2023.array.d.ts +5 -5
- package/lib/lib.es5.d.ts +31 -31
- package/lib/lib.esnext.disposable.d.ts +3 -3
- package/lib/lib.webworker.d.ts +6 -6
- package/lib/tsc.js +401 -222
- package/lib/typescript.d.ts +108 -40
- package/lib/typescript.js +588 -355
- package/package.json +15 -14
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.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240718`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -2515,10 +2515,12 @@ function tryGetPerformance() {
|
|
|
2515
2515
|
if (isNodeLikeSystem()) {
|
|
2516
2516
|
try {
|
|
2517
2517
|
const { performance: performance2 } = require("perf_hooks");
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2518
|
+
if (performance2) {
|
|
2519
|
+
return {
|
|
2520
|
+
shouldWriteNativeEvents: false,
|
|
2521
|
+
performance: performance2
|
|
2522
|
+
};
|
|
2523
|
+
}
|
|
2522
2524
|
} catch {
|
|
2523
2525
|
}
|
|
2524
2526
|
}
|
|
@@ -5912,6 +5914,7 @@ var Diagnostics = {
|
|
|
5912
5914
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
5913
5915
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
|
5914
5916
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
5917
|
+
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
|
5915
5918
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5916
5919
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5917
5920
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
@@ -6120,6 +6123,7 @@ var Diagnostics = {
|
|
|
6120
6123
|
This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
|
|
6121
6124
|
Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
|
|
6122
6125
|
Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
|
|
6126
|
+
Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1538, 1 /* Error */, "Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_se_1538", "Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
|
|
6123
6127
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6124
6128
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6125
6129
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6795,6 +6799,8 @@ var Diagnostics = {
|
|
|
6795
6799
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6796
6800
|
Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
|
|
6797
6801
|
One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
|
|
6802
|
+
Property_0_is_readonly_in_the_source_but_not_in_the_target: diag(4127, 1 /* Error */, "Property_0_is_readonly_in_the_source_but_not_in_the_target_4127", "Property '{0}' is 'readonly' in the source but not in the target."),
|
|
6803
|
+
_0_index_signature_is_readonly_in_the_source_but_not_in_the_target: diag(4128, 1 /* Error */, "_0_index_signature_is_readonly_in_the_source_but_not_in_the_target_4128", "'{0}' index signature is 'readonly' in the source but not in the target."),
|
|
6798
6804
|
The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
6799
6805
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6800
6806
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -7361,6 +7367,7 @@ var Diagnostics = {
|
|
|
7361
7367
|
Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
|
|
7362
7368
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
7363
7369
|
Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
|
|
7370
|
+
Ensure_that_readonly_properties_remain_read_only_in_type_relationships: diag(6720, 3 /* Message */, "Ensure_that_readonly_properties_remain_read_only_in_type_relationships_6720", "Ensure that 'readonly' properties remain read-only in type relationships."),
|
|
7364
7371
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
7365
7372
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
7366
7373
|
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
|
|
@@ -8967,9 +8974,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8967
8974
|
case 34 /* doubleQuote */:
|
|
8968
8975
|
return '"';
|
|
8969
8976
|
case 117 /* u */:
|
|
8970
|
-
if (
|
|
8977
|
+
if (pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
8971
8978
|
pos -= 2;
|
|
8972
|
-
|
|
8979
|
+
const result = scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
|
|
8980
|
+
if (!(flags & 17 /* AllowExtendedUnicodeEscape */)) {
|
|
8981
|
+
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
8982
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
8983
|
+
error(Diagnostics.Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
8984
|
+
}
|
|
8985
|
+
}
|
|
8986
|
+
return result;
|
|
8973
8987
|
}
|
|
8974
8988
|
for (; pos < start2 + 6; pos++) {
|
|
8975
8989
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
@@ -8987,7 +9001,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8987
9001
|
const nextStart = pos;
|
|
8988
9002
|
let nextPos = pos + 2;
|
|
8989
9003
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
8990
|
-
if (!isHexDigit(charCodeUnchecked(
|
|
9004
|
+
if (!isHexDigit(charCodeUnchecked(nextPos))) {
|
|
8991
9005
|
return escapedValueString;
|
|
8992
9006
|
}
|
|
8993
9007
|
}
|
|
@@ -10615,7 +10629,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10615
10629
|
return value;
|
|
10616
10630
|
}
|
|
10617
10631
|
function scanSourceCharacter() {
|
|
10618
|
-
const size = anyUnicodeMode ? charSize(
|
|
10632
|
+
const size = anyUnicodeMode ? charSize(codePointChecked(pos)) : 1;
|
|
10619
10633
|
pos += size;
|
|
10620
10634
|
return size > 0 ? text.substring(pos - size, pos) : "";
|
|
10621
10635
|
}
|
|
@@ -12585,6 +12599,34 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
12585
12599
|
if (result) result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
|
|
12586
12600
|
return result;
|
|
12587
12601
|
}
|
|
12602
|
+
function createModeMismatchDetails(currentSourceFile) {
|
|
12603
|
+
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
12604
|
+
const scope = currentSourceFile.packageJsonScope;
|
|
12605
|
+
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
12606
|
+
const result = scope && !scope.contents.packageJsonContent.type ? targetExt ? chainDiagnosticMessages(
|
|
12607
|
+
/*details*/
|
|
12608
|
+
void 0,
|
|
12609
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
12610
|
+
targetExt,
|
|
12611
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
12612
|
+
) : chainDiagnosticMessages(
|
|
12613
|
+
/*details*/
|
|
12614
|
+
void 0,
|
|
12615
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
12616
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
12617
|
+
) : targetExt ? chainDiagnosticMessages(
|
|
12618
|
+
/*details*/
|
|
12619
|
+
void 0,
|
|
12620
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
12621
|
+
targetExt
|
|
12622
|
+
) : chainDiagnosticMessages(
|
|
12623
|
+
/*details*/
|
|
12624
|
+
void 0,
|
|
12625
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
12626
|
+
);
|
|
12627
|
+
result.repopulateInfo = () => true;
|
|
12628
|
+
return result;
|
|
12629
|
+
}
|
|
12588
12630
|
function packageIdIsEqual(a, b) {
|
|
12589
12631
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
|
|
12590
12632
|
}
|
|
@@ -14796,6 +14838,23 @@ function isFunctionSymbol(symbol) {
|
|
|
14796
14838
|
const decl = symbol.valueDeclaration;
|
|
14797
14839
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
14798
14840
|
}
|
|
14841
|
+
function canHaveModuleSpecifier(node) {
|
|
14842
|
+
switch (node == null ? void 0 : node.kind) {
|
|
14843
|
+
case 260 /* VariableDeclaration */:
|
|
14844
|
+
case 208 /* BindingElement */:
|
|
14845
|
+
case 272 /* ImportDeclaration */:
|
|
14846
|
+
case 278 /* ExportDeclaration */:
|
|
14847
|
+
case 271 /* ImportEqualsDeclaration */:
|
|
14848
|
+
case 273 /* ImportClause */:
|
|
14849
|
+
case 280 /* NamespaceExport */:
|
|
14850
|
+
case 274 /* NamespaceImport */:
|
|
14851
|
+
case 281 /* ExportSpecifier */:
|
|
14852
|
+
case 276 /* ImportSpecifier */:
|
|
14853
|
+
case 205 /* ImportType */:
|
|
14854
|
+
return true;
|
|
14855
|
+
}
|
|
14856
|
+
return false;
|
|
14857
|
+
}
|
|
14799
14858
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
14800
14859
|
var _a, _b;
|
|
14801
14860
|
switch (node.kind) {
|
|
@@ -17513,8 +17572,8 @@ function walkTreeForJSXTags(node) {
|
|
|
17513
17572
|
function isFileModuleFromUsingJSXTag(file) {
|
|
17514
17573
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
17515
17574
|
}
|
|
17516
|
-
function isFileForcedToBeModuleByFormat(file) {
|
|
17517
|
-
return (file
|
|
17575
|
+
function isFileForcedToBeModuleByFormat(file, options) {
|
|
17576
|
+
return (getImpliedNodeFormatForEmitWorker(file, options) === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
|
|
17518
17577
|
}
|
|
17519
17578
|
function getSetExternalModuleIndicator(options) {
|
|
17520
17579
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -17533,10 +17592,14 @@ function getSetExternalModuleIndicator(options) {
|
|
|
17533
17592
|
}
|
|
17534
17593
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
17535
17594
|
const combined = or(...checks);
|
|
17536
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
17595
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
|
|
17537
17596
|
return callback;
|
|
17538
17597
|
}
|
|
17539
17598
|
}
|
|
17599
|
+
function importSyntaxAffectsModuleResolution(options) {
|
|
17600
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
17601
|
+
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
17602
|
+
}
|
|
17540
17603
|
function createComputedCompilerOptions(options) {
|
|
17541
17604
|
return options;
|
|
17542
17605
|
}
|
|
@@ -26736,7 +26799,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
26736
26799
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
26737
26800
|
let namedBindings;
|
|
26738
26801
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
26739
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile
|
|
26802
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
|
|
26740
26803
|
const helpers = getEmitHelpers(sourceFile);
|
|
26741
26804
|
if (helpers) {
|
|
26742
26805
|
const helperNames = [];
|
|
@@ -26801,8 +26864,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
26801
26864
|
if (externalHelpersModuleName) {
|
|
26802
26865
|
return externalHelpersModuleName;
|
|
26803
26866
|
}
|
|
26804
|
-
|
|
26805
|
-
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
|
|
26867
|
+
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
|
|
26806
26868
|
if (!create) {
|
|
26807
26869
|
const helpers = getEmitHelpers(node);
|
|
26808
26870
|
if (helpers) {
|
|
@@ -35756,7 +35818,6 @@ var commonOptionsWithBuild = [
|
|
|
35756
35818
|
affectsBuildInfo: true,
|
|
35757
35819
|
showInSimplifiedHelpView: true,
|
|
35758
35820
|
category: Diagnostics.Emit,
|
|
35759
|
-
transpileOptionValue: void 0,
|
|
35760
35821
|
defaultValueDescription: false,
|
|
35761
35822
|
description: Diagnostics.Create_sourcemaps_for_d_ts_files
|
|
35762
35823
|
},
|
|
@@ -36303,6 +36364,15 @@ var commandOptionsWithoutBuild = [
|
|
|
36303
36364
|
description: Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
|
|
36304
36365
|
defaultValueDescription: false
|
|
36305
36366
|
},
|
|
36367
|
+
{
|
|
36368
|
+
name: "enforceReadonly",
|
|
36369
|
+
type: "boolean",
|
|
36370
|
+
affectsSemanticDiagnostics: true,
|
|
36371
|
+
affectsBuildInfo: true,
|
|
36372
|
+
category: Diagnostics.Type_Checking,
|
|
36373
|
+
description: Diagnostics.Ensure_that_readonly_properties_remain_read_only_in_type_relationships,
|
|
36374
|
+
defaultValueDescription: false
|
|
36375
|
+
},
|
|
36306
36376
|
// Module Resolution
|
|
36307
36377
|
{
|
|
36308
36378
|
name: "moduleResolution",
|
|
@@ -40133,22 +40203,16 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
40133
40203
|
resolvedPackageDirectory: false
|
|
40134
40204
|
};
|
|
40135
40205
|
}
|
|
40136
|
-
function getPackageScopeForPath(
|
|
40137
|
-
|
|
40138
|
-
|
|
40139
|
-
|
|
40140
|
-
|
|
40141
|
-
getPathFromPathComponents(parts),
|
|
40206
|
+
function getPackageScopeForPath(directory, state) {
|
|
40207
|
+
return forEachAncestorDirectory(
|
|
40208
|
+
directory,
|
|
40209
|
+
(dir) => getPackageJsonInfo(
|
|
40210
|
+
dir,
|
|
40142
40211
|
/*onlyRecordFailures*/
|
|
40143
40212
|
false,
|
|
40144
40213
|
state
|
|
40145
|
-
)
|
|
40146
|
-
|
|
40147
|
-
return pkg;
|
|
40148
|
-
}
|
|
40149
|
-
parts.pop();
|
|
40150
|
-
}
|
|
40151
|
-
return void 0;
|
|
40214
|
+
)
|
|
40215
|
+
);
|
|
40152
40216
|
}
|
|
40153
40217
|
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
40154
40218
|
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
@@ -40311,7 +40375,7 @@ function noKeyStartsWithDot(obj) {
|
|
|
40311
40375
|
}
|
|
40312
40376
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
40313
40377
|
var _a, _b;
|
|
40314
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
40378
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
40315
40379
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
40316
40380
|
if (!scope || !scope.contents.packageJsonContent.exports) {
|
|
40317
40381
|
return void 0;
|
|
@@ -40407,7 +40471,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
|
|
|
40407
40471
|
void 0
|
|
40408
40472
|
);
|
|
40409
40473
|
}
|
|
40410
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
40474
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
40411
40475
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
40412
40476
|
if (!scope) {
|
|
40413
40477
|
if (state.traceEnabled) {
|
|
@@ -44225,13 +44289,15 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
44225
44289
|
}
|
|
44226
44290
|
|
|
44227
44291
|
// src/compiler/moduleSpecifiers.ts
|
|
44228
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44292
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44229
44293
|
const filePreferredEnding = getPreferredEnding();
|
|
44230
44294
|
return {
|
|
44231
44295
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
44232
44296
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
44233
|
-
const
|
|
44234
|
-
|
|
44297
|
+
const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
|
|
44298
|
+
const preferredEnding = syntaxImpliedNodeFormat !== impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
44299
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
44300
|
+
if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
44235
44301
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
44236
44302
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
44237
44303
|
}
|
|
@@ -44262,7 +44328,7 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
44262
44328
|
}
|
|
44263
44329
|
return getModuleSpecifierEndingPreference(
|
|
44264
44330
|
importModuleSpecifierEnding,
|
|
44265
|
-
resolutionMode ?? importingSourceFile
|
|
44331
|
+
resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
|
|
44266
44332
|
compilerOptions,
|
|
44267
44333
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
44268
44334
|
);
|
|
@@ -44320,12 +44386,16 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
44320
44386
|
}
|
|
44321
44387
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
44322
44388
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
44323
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
44389
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
|
|
44324
44390
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
44325
44391
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
44326
44392
|
(reason) => {
|
|
44327
44393
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
|
|
44328
|
-
|
|
44394
|
+
const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index);
|
|
44395
|
+
const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
|
|
44396
|
+
if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
|
|
44397
|
+
return void 0;
|
|
44398
|
+
}
|
|
44329
44399
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
44330
44400
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
44331
44401
|
}
|
|
@@ -44518,7 +44588,7 @@ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions,
|
|
|
44518
44588
|
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
44519
44589
|
Debug.type(host);
|
|
44520
44590
|
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
|
|
44521
|
-
const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
|
|
44591
|
+
const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
|
|
44522
44592
|
if (packageJson) {
|
|
44523
44593
|
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
44524
44594
|
for (const depName of toResolve || emptyArray) {
|
|
@@ -44840,7 +44910,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44840
44910
|
if (!parts) {
|
|
44841
44911
|
return void 0;
|
|
44842
44912
|
}
|
|
44843
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
44913
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
|
|
44844
44914
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
44845
44915
|
let moduleSpecifier = path;
|
|
44846
44916
|
let isPackageRootPath = false;
|
|
@@ -44890,7 +44960,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44890
44960
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
44891
44961
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
44892
44962
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
44893
|
-
const importMode = overrideMode || importingSourceFile
|
|
44963
|
+
const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
|
|
44894
44964
|
if (getResolvePackageJsonExports(options)) {
|
|
44895
44965
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
44896
44966
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -45040,6 +45110,9 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
45040
45110
|
function isPathRelativeToParent(path) {
|
|
45041
45111
|
return startsWith(path, "..");
|
|
45042
45112
|
}
|
|
45113
|
+
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
45114
|
+
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
45115
|
+
}
|
|
45043
45116
|
|
|
45044
45117
|
// src/compiler/checker.ts
|
|
45045
45118
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -45225,6 +45298,7 @@ function createTypeChecker(host) {
|
|
|
45225
45298
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45226
45299
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45227
45300
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
45301
|
+
var enforceReadonly = compilerOptions.enforceReadonly;
|
|
45228
45302
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
45229
45303
|
var emitResolver = createResolver();
|
|
45230
45304
|
var nodeBuilder = createNodeBuilder();
|
|
@@ -47260,22 +47334,28 @@ function createTypeChecker(host) {
|
|
|
47260
47334
|
function isSyntacticDefault(node) {
|
|
47261
47335
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
47262
47336
|
}
|
|
47263
|
-
function
|
|
47264
|
-
return isStringLiteralLike(usage) ? host.
|
|
47337
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage) {
|
|
47338
|
+
return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
47265
47339
|
}
|
|
47266
47340
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
47267
47341
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
47268
47342
|
}
|
|
47269
|
-
function
|
|
47270
|
-
|
|
47271
|
-
|
|
47343
|
+
function isOnlyImportableAsDefault(usage) {
|
|
47344
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
47345
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
47346
|
+
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
47347
|
+
}
|
|
47348
|
+
return false;
|
|
47272
47349
|
}
|
|
47273
47350
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
47274
|
-
const usageMode = file &&
|
|
47275
|
-
if (file && usageMode !== void 0
|
|
47276
|
-
const
|
|
47277
|
-
if (usageMode === 99 /* ESNext */
|
|
47278
|
-
return
|
|
47351
|
+
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
47352
|
+
if (file && usageMode !== void 0) {
|
|
47353
|
+
const targetMode = host.getImpliedNodeFormatForEmit(file);
|
|
47354
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */ && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
47355
|
+
return true;
|
|
47356
|
+
}
|
|
47357
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
|
|
47358
|
+
return false;
|
|
47279
47359
|
}
|
|
47280
47360
|
}
|
|
47281
47361
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -47334,7 +47414,7 @@ function createTypeChecker(host) {
|
|
|
47334
47414
|
if (!specifier) {
|
|
47335
47415
|
return exportDefaultSymbol;
|
|
47336
47416
|
}
|
|
47337
|
-
const hasDefaultOnly =
|
|
47417
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
47338
47418
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47339
47419
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47340
47420
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -47536,7 +47616,7 @@ function createTypeChecker(host) {
|
|
|
47536
47616
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
47537
47617
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
47538
47618
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
47539
|
-
if (
|
|
47619
|
+
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
47540
47620
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
47541
47621
|
}
|
|
47542
47622
|
}
|
|
@@ -48140,7 +48220,7 @@ function createTypeChecker(host) {
|
|
|
48140
48220
|
/*requireStringLiteralLikeArgument*/
|
|
48141
48221
|
true
|
|
48142
48222
|
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
|
|
48143
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile
|
|
48223
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
48144
48224
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48145
48225
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
48146
48226
|
const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -48187,41 +48267,7 @@ function createTypeChecker(host) {
|
|
|
48187
48267
|
let diagnosticDetails;
|
|
48188
48268
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
48189
48269
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
48190
|
-
|
|
48191
|
-
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
48192
|
-
if (scope && !scope.contents.packageJsonContent.type) {
|
|
48193
|
-
if (targetExt) {
|
|
48194
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48195
|
-
/*details*/
|
|
48196
|
-
void 0,
|
|
48197
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
48198
|
-
targetExt,
|
|
48199
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
48200
|
-
);
|
|
48201
|
-
} else {
|
|
48202
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48203
|
-
/*details*/
|
|
48204
|
-
void 0,
|
|
48205
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
48206
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
48207
|
-
);
|
|
48208
|
-
}
|
|
48209
|
-
} else {
|
|
48210
|
-
if (targetExt) {
|
|
48211
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48212
|
-
/*details*/
|
|
48213
|
-
void 0,
|
|
48214
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
48215
|
-
targetExt
|
|
48216
|
-
);
|
|
48217
|
-
} else {
|
|
48218
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
48219
|
-
/*details*/
|
|
48220
|
-
void 0,
|
|
48221
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
48222
|
-
);
|
|
48223
|
-
}
|
|
48224
|
-
}
|
|
48270
|
+
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
48225
48271
|
}
|
|
48226
48272
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
48227
48273
|
getSourceFileOfNode(errorNode),
|
|
@@ -48387,7 +48433,7 @@ function createTypeChecker(host) {
|
|
|
48387
48433
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
48388
48434
|
}
|
|
48389
48435
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
48390
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
48436
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
48391
48437
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
48392
48438
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
48393
48439
|
if (!sigs || !sigs.length) {
|
|
@@ -51007,8 +51053,10 @@ function createTypeChecker(host) {
|
|
|
51007
51053
|
}
|
|
51008
51054
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
51009
51055
|
}
|
|
51056
|
+
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
51057
|
+
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
51010
51058
|
const contextFile = context.enclosingFile;
|
|
51011
|
-
const resolutionMode = overrideImportMode || (contextFile
|
|
51059
|
+
const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
|
|
51012
51060
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
51013
51061
|
const links = getSymbolLinks(symbol);
|
|
51014
51062
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -52081,7 +52129,7 @@ function createTypeChecker(host) {
|
|
|
52081
52129
|
if (result) {
|
|
52082
52130
|
if (result.pos !== -1 || result.end !== -1) {
|
|
52083
52131
|
if (result === nodes) {
|
|
52084
|
-
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
52132
|
+
result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
|
|
52085
52133
|
}
|
|
52086
52134
|
setTextRangePosEnd(result, -1, -1);
|
|
52087
52135
|
}
|
|
@@ -56057,18 +56105,18 @@ function createTypeChecker(host) {
|
|
|
56057
56105
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
56058
56106
|
if (signatureHasRestParameter(sig)) {
|
|
56059
56107
|
const restIndex = sig.parameters.length - 1;
|
|
56060
|
-
const
|
|
56061
|
-
const restType = getTypeOfSymbol(
|
|
56108
|
+
const restSymbol = sig.parameters[restIndex];
|
|
56109
|
+
const restType = getTypeOfSymbol(restSymbol);
|
|
56062
56110
|
if (isTupleType(restType)) {
|
|
56063
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex,
|
|
56111
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol)];
|
|
56064
56112
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
56065
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex,
|
|
56113
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restSymbol));
|
|
56066
56114
|
}
|
|
56067
56115
|
}
|
|
56068
56116
|
return [sig.parameters];
|
|
56069
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex,
|
|
56117
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol) {
|
|
56070
56118
|
const elementTypes = getTypeArguments(restType);
|
|
56071
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType,
|
|
56119
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restSymbol);
|
|
56072
56120
|
const restParams = map(elementTypes, (t, i) => {
|
|
56073
56121
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
56074
56122
|
const flags = restType.target.elementFlags[i];
|
|
@@ -56079,19 +56127,29 @@ function createTypeChecker(host) {
|
|
|
56079
56127
|
});
|
|
56080
56128
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
56081
56129
|
}
|
|
56082
|
-
function getUniqAssociatedNamesFromTupleType(type,
|
|
56083
|
-
const
|
|
56084
|
-
|
|
56085
|
-
const
|
|
56086
|
-
const
|
|
56087
|
-
|
|
56088
|
-
|
|
56089
|
-
|
|
56090
|
-
|
|
56091
|
-
|
|
56092
|
-
return `${name}_${prevCounter}`;
|
|
56130
|
+
function getUniqAssociatedNamesFromTupleType(type, restSymbol) {
|
|
56131
|
+
const names = map(type.target.labeledElementDeclarations, (labeledElement, i) => getTupleElementLabel(labeledElement, i, type.target.elementFlags[i], restSymbol));
|
|
56132
|
+
if (names) {
|
|
56133
|
+
const duplicates = [];
|
|
56134
|
+
const uniqueNames = /* @__PURE__ */ new Set();
|
|
56135
|
+
for (let i = 0; i < names.length; i++) {
|
|
56136
|
+
const name = names[i];
|
|
56137
|
+
if (!tryAddToSet(uniqueNames, name)) {
|
|
56138
|
+
duplicates.push(i);
|
|
56139
|
+
}
|
|
56093
56140
|
}
|
|
56094
|
-
|
|
56141
|
+
const counters = /* @__PURE__ */ new Map();
|
|
56142
|
+
for (const i of duplicates) {
|
|
56143
|
+
let counter = counters.get(names[i]) ?? 1;
|
|
56144
|
+
let name;
|
|
56145
|
+
while (!tryAddToSet(uniqueNames, name = `${names[i]}_${counter}`)) {
|
|
56146
|
+
counter++;
|
|
56147
|
+
}
|
|
56148
|
+
names[i] = name;
|
|
56149
|
+
counters.set(names[i], counter + 1);
|
|
56150
|
+
}
|
|
56151
|
+
}
|
|
56152
|
+
return names;
|
|
56095
56153
|
}
|
|
56096
56154
|
}
|
|
56097
56155
|
function getDefaultConstructSignatures(classType) {
|
|
@@ -56775,20 +56833,20 @@ function createTypeChecker(host) {
|
|
|
56775
56833
|
const declaration = type.declaration;
|
|
56776
56834
|
return (declaration.readonlyToken ? declaration.readonlyToken.kind === 41 /* MinusToken */ ? 2 /* ExcludeReadonly */ : 1 /* IncludeReadonly */ : 0) | (declaration.questionToken ? declaration.questionToken.kind === 41 /* MinusToken */ ? 8 /* ExcludeOptional */ : 4 /* IncludeOptional */ : 0);
|
|
56777
56835
|
}
|
|
56778
|
-
function
|
|
56779
|
-
const modifiers = getMappedTypeModifiers(type);
|
|
56780
|
-
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
56781
|
-
}
|
|
56782
|
-
function getCombinedMappedTypeOptionality(type) {
|
|
56836
|
+
function getEffectiveMappedTypeModifiers(type, mask) {
|
|
56783
56837
|
if (getObjectFlags(type) & 32 /* Mapped */) {
|
|
56784
|
-
return
|
|
56838
|
+
return getMappedTypeModifiers(type) & mask || getEffectiveMappedTypeModifiers(getModifiersTypeFromMappedType(type), mask);
|
|
56785
56839
|
}
|
|
56786
56840
|
if (type.flags & 2097152 /* Intersection */) {
|
|
56787
|
-
const
|
|
56788
|
-
return every(type.types, (t, i) => i === 0 ||
|
|
56841
|
+
const modifiers = getEffectiveMappedTypeModifiers(type.types[0], mask);
|
|
56842
|
+
return every(type.types, (t, i) => i === 0 || getEffectiveMappedTypeModifiers(t, mask) === modifiers) ? modifiers : 0;
|
|
56789
56843
|
}
|
|
56790
56844
|
return 0;
|
|
56791
56845
|
}
|
|
56846
|
+
function getMappedTypeModifiersRank(type, mask) {
|
|
56847
|
+
const modifiers = getEffectiveMappedTypeModifiers(type, mask);
|
|
56848
|
+
return modifiers & 10 /* Exclude */ ? -1 : modifiers & 5 /* Include */ ? 1 : 0;
|
|
56849
|
+
}
|
|
56792
56850
|
function isPartialMappedType(type) {
|
|
56793
56851
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
56794
56852
|
}
|
|
@@ -58300,14 +58358,14 @@ function createTypeChecker(host) {
|
|
|
58300
58358
|
var _a, _b;
|
|
58301
58359
|
if (!type.resolvedTypeArguments) {
|
|
58302
58360
|
if (!pushTypeResolution(type, 5 /* ResolvedTypeArguments */)) {
|
|
58303
|
-
return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
|
|
58361
|
+
return concatenate(type.target.outerTypeParameters, (_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
|
|
58304
58362
|
}
|
|
58305
58363
|
const node = type.node;
|
|
58306
58364
|
const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
|
|
58307
58365
|
if (popTypeResolution()) {
|
|
58308
58366
|
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments);
|
|
58309
58367
|
} else {
|
|
58310
|
-
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray);
|
|
58368
|
+
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = concatenate(type.target.outerTypeParameters, ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray));
|
|
58311
58369
|
error(
|
|
58312
58370
|
type.node || currentNode,
|
|
58313
58371
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
@@ -60594,12 +60652,12 @@ function createTypeChecker(host) {
|
|
|
60594
60652
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
60595
60653
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
60596
60654
|
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
60597
|
-
const isOptional =
|
|
60655
|
+
const isOptional = getMappedTypeModifiers(objectType) & 4 /* IncludeOptional */ || (isGenericType(objectType) ? getEffectiveMappedTypeModifiers(getModifiersTypeFromMappedType(objectType), 12 /* Optional */) & 4 /* IncludeOptional */ : couldAccessOptionalProperty(objectType, index));
|
|
60598
60656
|
return addOptionality(
|
|
60599
60657
|
instantiatedTemplateType,
|
|
60600
60658
|
/*isProperty*/
|
|
60601
60659
|
true,
|
|
60602
|
-
isOptional
|
|
60660
|
+
!!isOptional
|
|
60603
60661
|
);
|
|
60604
60662
|
}
|
|
60605
60663
|
function couldAccessOptionalProperty(objectType, indexType) {
|
|
@@ -64097,7 +64155,7 @@ function createTypeChecker(host) {
|
|
|
64097
64155
|
}
|
|
64098
64156
|
if (targetFlags & 262144 /* TypeParameter */) {
|
|
64099
64157
|
if (getObjectFlags(source2) & 32 /* Mapped */ && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2), 3 /* Both */)) {
|
|
64100
|
-
if (!(getMappedTypeModifiers(source2) & 4 /* IncludeOptional */)) {
|
|
64158
|
+
if (!(getMappedTypeModifiers(source2) & 4 /* IncludeOptional */) && !(enforceReadonly && relation !== comparableRelation && getMappedTypeModifiers(source2) & 1 /* IncludeReadonly */)) {
|
|
64101
64159
|
const templateType = getTemplateTypeFromMappedType(source2);
|
|
64102
64160
|
const indexedAccessType = getIndexedAccessType(target2, getTypeParameterFromMappedType(source2));
|
|
64103
64161
|
if (result2 = isRelatedTo(templateType, indexedAccessType, 3 /* Both */, reportErrors2)) {
|
|
@@ -64209,7 +64267,7 @@ function createTypeChecker(host) {
|
|
|
64209
64267
|
const keysRemapped = !!target2.declaration.nameType;
|
|
64210
64268
|
const templateType = getTemplateTypeFromMappedType(target2);
|
|
64211
64269
|
const modifiers = getMappedTypeModifiers(target2);
|
|
64212
|
-
if (!(modifiers & 8 /* ExcludeOptional */)) {
|
|
64270
|
+
if (!(modifiers & 8 /* ExcludeOptional */) && !(enforceReadonly && relation !== comparableRelation && modifiers & 2 /* ExcludeReadonly */)) {
|
|
64213
64271
|
if (!keysRemapped && templateType.flags & 8388608 /* IndexedAccess */ && templateType.objectType === source2 && templateType.indexType === getTypeParameterFromMappedType(target2)) {
|
|
64214
64272
|
return -1 /* True */;
|
|
64215
64273
|
}
|
|
@@ -64506,11 +64564,11 @@ function createTypeChecker(host) {
|
|
|
64506
64564
|
}
|
|
64507
64565
|
}
|
|
64508
64566
|
function mappedTypeRelatedTo(source2, target2, reportErrors2) {
|
|
64509
|
-
const modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source2) === getMappedTypeModifiers(target2) :
|
|
64567
|
+
const modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source2) === getMappedTypeModifiers(target2) : getMappedTypeModifiersRank(source2, 12 /* Optional */) <= getMappedTypeModifiersRank(target2, 12 /* Optional */) && (!enforceReadonly || relation === comparableRelation || getMappedTypeModifiersRank(source2, 3 /* Readonly */) <= getMappedTypeModifiersRank(target2, 3 /* Readonly */)));
|
|
64510
64568
|
if (modifiersRelated) {
|
|
64511
64569
|
let result2;
|
|
64512
64570
|
const targetConstraint = getConstraintTypeFromMappedType(target2);
|
|
64513
|
-
const sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source2),
|
|
64571
|
+
const sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source2), getEffectiveMappedTypeModifiers(source2, 12 /* Optional */) & 8 /* ExcludeOptional */ ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
64514
64572
|
if (result2 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors2)) {
|
|
64515
64573
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(source2)], [getTypeParameterFromMappedType(target2)]);
|
|
64516
64574
|
if (instantiateType(getNameTypeFromMappedType(source2), mapper) === instantiateType(getNameTypeFromMappedType(target2), mapper)) {
|
|
@@ -64684,7 +64742,10 @@ function createTypeChecker(host) {
|
|
|
64684
64742
|
}
|
|
64685
64743
|
return 0 /* False */;
|
|
64686
64744
|
}
|
|
64687
|
-
if (relation === strictSubtypeRelation && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
|
|
64745
|
+
if ((relation === strictSubtypeRelation || enforceReadonly && relation !== comparableRelation) && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp) && !(targetProp.flags & 8192 /* Method */)) {
|
|
64746
|
+
if (reportErrors2) {
|
|
64747
|
+
reportError(Diagnostics.Property_0_is_readonly_in_the_source_but_not_in_the_target, symbolToString(targetProp));
|
|
64748
|
+
}
|
|
64688
64749
|
return 0 /* False */;
|
|
64689
64750
|
}
|
|
64690
64751
|
const related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState);
|
|
@@ -65152,12 +65213,21 @@ function createTypeChecker(host) {
|
|
|
65152
65213
|
void 0,
|
|
65153
65214
|
intersectionState
|
|
65154
65215
|
);
|
|
65155
|
-
if (!related
|
|
65156
|
-
if (
|
|
65157
|
-
|
|
65158
|
-
|
|
65159
|
-
|
|
65216
|
+
if (!related) {
|
|
65217
|
+
if (reportErrors2) {
|
|
65218
|
+
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
65219
|
+
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
65220
|
+
} else {
|
|
65221
|
+
reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
|
|
65222
|
+
}
|
|
65223
|
+
}
|
|
65224
|
+
return 0 /* False */;
|
|
65225
|
+
}
|
|
65226
|
+
if (enforceReadonly && relation !== comparableRelation && sourceInfo.isReadonly && !targetInfo.isReadonly) {
|
|
65227
|
+
if (reportErrors2) {
|
|
65228
|
+
reportError(Diagnostics._0_index_signature_is_readonly_in_the_source_but_not_in_the_target, typeToString(sourceInfo.keyType));
|
|
65160
65229
|
}
|
|
65230
|
+
return 0 /* False */;
|
|
65161
65231
|
}
|
|
65162
65232
|
return related;
|
|
65163
65233
|
}
|
|
@@ -65975,12 +66045,12 @@ function createTypeChecker(host) {
|
|
|
65975
66045
|
const widened = getWidenedTypeWithContext(original, propContext);
|
|
65976
66046
|
return widened === original ? prop : createSymbolWithType(prop, widened);
|
|
65977
66047
|
}
|
|
65978
|
-
function
|
|
66048
|
+
function getUndefinedProperty(prop) {
|
|
65979
66049
|
const cached = undefinedProperties.get(prop.escapedName);
|
|
65980
66050
|
if (cached) {
|
|
65981
66051
|
return cached;
|
|
65982
66052
|
}
|
|
65983
|
-
const result = createSymbolWithType(prop,
|
|
66053
|
+
const result = createSymbolWithType(prop, undefinedOrMissingType);
|
|
65984
66054
|
result.flags |= 16777216 /* Optional */;
|
|
65985
66055
|
undefinedProperties.set(prop.escapedName, result);
|
|
65986
66056
|
return result;
|
|
@@ -65993,7 +66063,7 @@ function createTypeChecker(host) {
|
|
|
65993
66063
|
if (context) {
|
|
65994
66064
|
for (const prop of getPropertiesOfContext(context)) {
|
|
65995
66065
|
if (!members.has(prop.escapedName)) {
|
|
65996
|
-
members.set(prop.escapedName,
|
|
66066
|
+
members.set(prop.escapedName, getUndefinedProperty(prop));
|
|
65997
66067
|
}
|
|
65998
66068
|
}
|
|
65999
66069
|
}
|
|
@@ -69583,7 +69653,7 @@ function createTypeChecker(host) {
|
|
|
69583
69653
|
if (!canCollectSymbolAliasAccessabilityData) {
|
|
69584
69654
|
return;
|
|
69585
69655
|
}
|
|
69586
|
-
if (location.flags & 33554432 /* Ambient */) {
|
|
69656
|
+
if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
|
|
69587
69657
|
return;
|
|
69588
69658
|
}
|
|
69589
69659
|
switch (hint) {
|
|
@@ -71013,10 +71083,9 @@ function createTypeChecker(host) {
|
|
|
71013
71083
|
(t) => {
|
|
71014
71084
|
var _a;
|
|
71015
71085
|
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
71016
|
-
const constraint = getConstraintTypeFromMappedType(t);
|
|
71017
|
-
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
71086
|
+
const constraint = getBaseConstraintOrType(getConstraintTypeFromMappedType(t));
|
|
71018
71087
|
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
71019
|
-
if (isTypeAssignableTo(propertyNameType,
|
|
71088
|
+
if (isTypeAssignableTo(propertyNameType, constraint)) {
|
|
71020
71089
|
return substituteIndexedMappedType(t, propertyNameType);
|
|
71021
71090
|
}
|
|
71022
71091
|
} else if (t.flags & 3670016 /* StructuredType */) {
|
|
@@ -71066,23 +71135,17 @@ function createTypeChecker(host) {
|
|
|
71066
71135
|
const symbol = getSymbolOfDeclaration(element);
|
|
71067
71136
|
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
71068
71137
|
}
|
|
71069
|
-
|
|
71070
|
-
|
|
71071
|
-
|
|
71072
|
-
|
|
71073
|
-
|
|
71074
|
-
if (propType) {
|
|
71075
|
-
return propType;
|
|
71076
|
-
}
|
|
71138
|
+
const name = getNameOfDeclaration(element);
|
|
71139
|
+
if (name && isComputedPropertyName(name)) {
|
|
71140
|
+
const exprType = checkExpression(name.expression);
|
|
71141
|
+
if (isTypeUsableAsPropertyName(exprType)) {
|
|
71142
|
+
return getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType), exprType);
|
|
71077
71143
|
}
|
|
71078
|
-
}
|
|
71079
|
-
if (element.name) {
|
|
71080
|
-
const nameType = getLiteralTypeFromPropertyName(element.name);
|
|
71081
71144
|
return mapType(
|
|
71082
71145
|
type,
|
|
71083
71146
|
(t) => {
|
|
71084
71147
|
var _a;
|
|
71085
|
-
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t),
|
|
71148
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), exprType)) == null ? void 0 : _a.type;
|
|
71086
71149
|
},
|
|
71087
71150
|
/*noReductions*/
|
|
71088
71151
|
true
|
|
@@ -71091,6 +71154,20 @@ function createTypeChecker(host) {
|
|
|
71091
71154
|
}
|
|
71092
71155
|
return void 0;
|
|
71093
71156
|
}
|
|
71157
|
+
function isContextualPropertyMutable(type, name, nameType) {
|
|
71158
|
+
return someType(type, (t) => {
|
|
71159
|
+
const propName = nameType ? isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : void 0 : name;
|
|
71160
|
+
const prop = propName && getPropertyOfType(t, propName);
|
|
71161
|
+
if (prop) {
|
|
71162
|
+
return !isReadonlySymbol(prop);
|
|
71163
|
+
}
|
|
71164
|
+
const indexInfo = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)));
|
|
71165
|
+
if (indexInfo) {
|
|
71166
|
+
return !indexInfo.isReadonly;
|
|
71167
|
+
}
|
|
71168
|
+
return false;
|
|
71169
|
+
});
|
|
71170
|
+
}
|
|
71094
71171
|
function getSpreadIndices(elements) {
|
|
71095
71172
|
let first2, last2;
|
|
71096
71173
|
for (let i = 0; i < elements.length; i++) {
|
|
@@ -71936,7 +72013,6 @@ function createTypeChecker(host) {
|
|
|
71936
72013
|
);
|
|
71937
72014
|
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
71938
72015
|
const inConstContext = isConstContext(node);
|
|
71939
|
-
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
71940
72016
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
71941
72017
|
const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
|
|
71942
72018
|
const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
|
|
@@ -71972,6 +72048,7 @@ function createTypeChecker(host) {
|
|
|
71972
72048
|
}
|
|
71973
72049
|
objectFlags |= getObjectFlags(type) & 458752 /* PropagatingFlags */;
|
|
71974
72050
|
const nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : void 0;
|
|
72051
|
+
const checkFlags = inConstContext && !(enforceReadonly && contextualType && isContextualPropertyMutable(contextualType, member.escapedName, nameType)) ? 8 /* Readonly */ : 0;
|
|
71975
72052
|
const prop = nameType ? createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) : createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
|
|
71976
72053
|
if (nameType) {
|
|
71977
72054
|
prop.links.nameType = nameType;
|
|
@@ -72574,7 +72651,7 @@ function createTypeChecker(host) {
|
|
|
72574
72651
|
checkGrammarJsxElement(node);
|
|
72575
72652
|
}
|
|
72576
72653
|
checkJsxPreconditions(node);
|
|
72577
|
-
|
|
72654
|
+
markJsxAliasReferenced(node);
|
|
72578
72655
|
if (isNodeOpeningLikeElement) {
|
|
72579
72656
|
const jsxOpeningLikeNode = node;
|
|
72580
72657
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -75505,7 +75582,7 @@ function createTypeChecker(host) {
|
|
|
75505
75582
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
75506
75583
|
}
|
|
75507
75584
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75508
|
-
const hasDefaultOnly =
|
|
75585
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
|
|
75509
75586
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75510
75587
|
const synthType = type;
|
|
75511
75588
|
if (!synthType.defaultOnlyType) {
|
|
@@ -75831,14 +75908,45 @@ function createTypeChecker(host) {
|
|
|
75831
75908
|
!!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
|
|
75832
75909
|
);
|
|
75833
75910
|
}
|
|
75834
|
-
function
|
|
75911
|
+
function getTupleElementLabelFromBindingElement(node, index, elementFlags) {
|
|
75912
|
+
switch (node.name.kind) {
|
|
75913
|
+
case 80 /* Identifier */: {
|
|
75914
|
+
const name = node.name.escapedText;
|
|
75915
|
+
if (node.dotDotDotToken) {
|
|
75916
|
+
return elementFlags & 12 /* Variable */ ? name : `${name}_${index}`;
|
|
75917
|
+
} else {
|
|
75918
|
+
return elementFlags & 3 /* Fixed */ ? name : `${name}_n`;
|
|
75919
|
+
}
|
|
75920
|
+
}
|
|
75921
|
+
case 207 /* ArrayBindingPattern */: {
|
|
75922
|
+
if (node.dotDotDotToken) {
|
|
75923
|
+
const elements = node.name.elements;
|
|
75924
|
+
const lastElement = tryCast(lastOrUndefined(elements), isBindingElement);
|
|
75925
|
+
const elementCount = elements.length - ((lastElement == null ? void 0 : lastElement.dotDotDotToken) ? 1 : 0);
|
|
75926
|
+
if (index < elementCount) {
|
|
75927
|
+
const element = elements[index];
|
|
75928
|
+
if (isBindingElement(element)) {
|
|
75929
|
+
return getTupleElementLabelFromBindingElement(element, index, elementFlags);
|
|
75930
|
+
}
|
|
75931
|
+
} else if (lastElement == null ? void 0 : lastElement.dotDotDotToken) {
|
|
75932
|
+
return getTupleElementLabelFromBindingElement(lastElement, index - elementCount, elementFlags);
|
|
75933
|
+
}
|
|
75934
|
+
}
|
|
75935
|
+
break;
|
|
75936
|
+
}
|
|
75937
|
+
}
|
|
75938
|
+
return `arg_${index}`;
|
|
75939
|
+
}
|
|
75940
|
+
function getTupleElementLabel(d, index = 0, elementFlags = 3 /* Fixed */, restSymbol) {
|
|
75835
75941
|
if (!d) {
|
|
75836
|
-
|
|
75942
|
+
const restParameter = tryCast(restSymbol == null ? void 0 : restSymbol.valueDeclaration, isParameter);
|
|
75943
|
+
return restParameter ? getTupleElementLabelFromBindingElement(restParameter, index, elementFlags) : `${(restSymbol == null ? void 0 : restSymbol.escapedName) ?? "arg"}_${index}`;
|
|
75837
75944
|
}
|
|
75838
75945
|
Debug.assert(isIdentifier(d.name));
|
|
75839
75946
|
return d.name.escapedText;
|
|
75840
75947
|
}
|
|
75841
75948
|
function getParameterNameAtPosition(signature, pos, overrideRestType) {
|
|
75949
|
+
var _a;
|
|
75842
75950
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
75843
75951
|
if (pos < paramCount) {
|
|
75844
75952
|
return signature.parameters[pos].escapedName;
|
|
@@ -75846,9 +75954,11 @@ function createTypeChecker(host) {
|
|
|
75846
75954
|
const restParameter = signature.parameters[paramCount] || unknownSymbol;
|
|
75847
75955
|
const restType = overrideRestType || getTypeOfSymbol(restParameter);
|
|
75848
75956
|
if (isTupleType(restType)) {
|
|
75849
|
-
const
|
|
75957
|
+
const tupleType = restType.target;
|
|
75850
75958
|
const index = pos - paramCount;
|
|
75851
|
-
|
|
75959
|
+
const associatedName = (_a = tupleType.labeledElementDeclarations) == null ? void 0 : _a[index];
|
|
75960
|
+
const elementFlags = tupleType.elementFlags[index];
|
|
75961
|
+
return getTupleElementLabel(associatedName, index, elementFlags, restParameter);
|
|
75852
75962
|
}
|
|
75853
75963
|
return restParameter.escapedName;
|
|
75854
75964
|
}
|
|
@@ -80779,7 +80889,7 @@ function createTypeChecker(host) {
|
|
|
80779
80889
|
});
|
|
80780
80890
|
}
|
|
80781
80891
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
80782
|
-
if (
|
|
80892
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
|
|
80783
80893
|
return;
|
|
80784
80894
|
}
|
|
80785
80895
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -82200,7 +82310,7 @@ function createTypeChecker(host) {
|
|
|
82200
82310
|
}
|
|
82201
82311
|
}
|
|
82202
82312
|
function checkClassNameCollisionWithObject(name) {
|
|
82203
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (
|
|
82313
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
|
82204
82314
|
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
82205
82315
|
}
|
|
82206
82316
|
}
|
|
@@ -83280,7 +83390,7 @@ function createTypeChecker(host) {
|
|
|
83280
83390
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
83281
83391
|
}
|
|
83282
83392
|
}
|
|
83283
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (
|
|
83393
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
|
|
83284
83394
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
83285
83395
|
if (exportModifier) {
|
|
83286
83396
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -83500,8 +83610,10 @@ function createTypeChecker(host) {
|
|
|
83500
83610
|
}
|
|
83501
83611
|
}
|
|
83502
83612
|
}
|
|
83503
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (
|
|
83613
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
83504
83614
|
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
83615
|
+
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
83616
|
+
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
83505
83617
|
}
|
|
83506
83618
|
}
|
|
83507
83619
|
if (isImportSpecifier(node)) {
|
|
@@ -83542,7 +83654,7 @@ function createTypeChecker(host) {
|
|
|
83542
83654
|
checkAliasSymbol(node);
|
|
83543
83655
|
if (node.kind === 276 /* ImportSpecifier */) {
|
|
83544
83656
|
checkModuleExportName(node.propertyName);
|
|
83545
|
-
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) &&
|
|
83657
|
+
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
83546
83658
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83547
83659
|
}
|
|
83548
83660
|
}
|
|
@@ -83564,7 +83676,7 @@ function createTypeChecker(host) {
|
|
|
83564
83676
|
if (validForTypeAttributes && override) {
|
|
83565
83677
|
return;
|
|
83566
83678
|
}
|
|
83567
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
83679
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
|
|
83568
83680
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
83569
83681
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
83570
83682
|
return grammarErrorOnNode(node, message);
|
|
@@ -83597,7 +83709,7 @@ function createTypeChecker(host) {
|
|
|
83597
83709
|
if (importClause.namedBindings) {
|
|
83598
83710
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
83599
83711
|
checkImportBinding(importClause.namedBindings);
|
|
83600
|
-
if (
|
|
83712
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
|
|
83601
83713
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
83602
83714
|
}
|
|
83603
83715
|
} else {
|
|
@@ -83637,7 +83749,7 @@ function createTypeChecker(host) {
|
|
|
83637
83749
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
83638
83750
|
}
|
|
83639
83751
|
} else {
|
|
83640
|
-
if (
|
|
83752
|
+
if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
83641
83753
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
83642
83754
|
}
|
|
83643
83755
|
}
|
|
@@ -83667,7 +83779,7 @@ function createTypeChecker(host) {
|
|
|
83667
83779
|
checkAliasSymbol(node.exportClause);
|
|
83668
83780
|
checkModuleExportName(node.exportClause.name);
|
|
83669
83781
|
}
|
|
83670
|
-
if (
|
|
83782
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
83671
83783
|
if (node.exportClause) {
|
|
83672
83784
|
if (getESModuleInterop(compilerOptions)) {
|
|
83673
83785
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -83726,7 +83838,7 @@ function createTypeChecker(host) {
|
|
|
83726
83838
|
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
83727
83839
|
}
|
|
83728
83840
|
} else {
|
|
83729
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
83841
|
+
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
|
|
83730
83842
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83731
83843
|
}
|
|
83732
83844
|
}
|
|
@@ -83752,7 +83864,7 @@ function createTypeChecker(host) {
|
|
|
83752
83864
|
if (typeAnnotationNode) {
|
|
83753
83865
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
83754
83866
|
}
|
|
83755
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (
|
|
83867
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
|
|
83756
83868
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
83757
83869
|
const id = node.expression;
|
|
83758
83870
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -83832,7 +83944,7 @@ function createTypeChecker(host) {
|
|
|
83832
83944
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
83833
83945
|
}
|
|
83834
83946
|
if (node.isExportEquals) {
|
|
83835
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node)
|
|
83947
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) !== 1 /* CommonJS */)) {
|
|
83836
83948
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
83837
83949
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
83838
83950
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -85423,15 +85535,14 @@ function createTypeChecker(host) {
|
|
|
85423
85535
|
function checkChildIdentifiers(node2) {
|
|
85424
85536
|
forEachNodeRecursively(node2, checkIdentifiers);
|
|
85425
85537
|
}
|
|
85538
|
+
function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
|
|
85539
|
+
return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
|
|
85540
|
+
}
|
|
85426
85541
|
function checkSingleIdentifier(node2) {
|
|
85427
85542
|
const nodeLinks2 = getNodeLinks(node2);
|
|
85428
85543
|
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
85429
|
-
if (isIdentifier(node2) &&
|
|
85430
|
-
const s =
|
|
85431
|
-
node2,
|
|
85432
|
-
/*ignoreErrors*/
|
|
85433
|
-
true
|
|
85434
|
-
);
|
|
85544
|
+
if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
85545
|
+
const s = getResolvedSymbol(node2);
|
|
85435
85546
|
if (s && s !== unknownSymbol) {
|
|
85436
85547
|
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
85437
85548
|
}
|
|
@@ -86378,7 +86489,7 @@ function createTypeChecker(host) {
|
|
|
86378
86489
|
break;
|
|
86379
86490
|
case 95 /* ExportKeyword */:
|
|
86380
86491
|
if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
|
|
86381
|
-
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (
|
|
86492
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
86382
86493
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
86383
86494
|
}
|
|
86384
86495
|
if (flags & 32 /* Export */) {
|
|
@@ -87288,7 +87399,7 @@ function createTypeChecker(host) {
|
|
|
87288
87399
|
const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
87289
87400
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
87290
87401
|
}
|
|
87291
|
-
if ((
|
|
87402
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
87292
87403
|
checkESModuleMarker(node.name);
|
|
87293
87404
|
}
|
|
87294
87405
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -87789,7 +87900,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
87789
87900
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
87790
87901
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
87791
87902
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
87792
|
-
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
87903
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
|
|
87904
|
+
getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
|
|
87905
|
+
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
|
|
87793
87906
|
};
|
|
87794
87907
|
}
|
|
87795
87908
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -107460,7 +107573,7 @@ function transformModule(context) {
|
|
|
107460
107573
|
case 354 /* PartiallyEmittedExpression */:
|
|
107461
107574
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
107462
107575
|
case 213 /* CallExpression */:
|
|
107463
|
-
if (isImportCall(node) && currentSourceFile
|
|
107576
|
+
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
107464
107577
|
return visitImportCallExpression(node);
|
|
107465
107578
|
}
|
|
107466
107579
|
break;
|
|
@@ -110456,8 +110569,8 @@ function transformECMAScriptModule(context) {
|
|
|
110456
110569
|
}
|
|
110457
110570
|
}
|
|
110458
110571
|
|
|
110459
|
-
// src/compiler/transformers/module/
|
|
110460
|
-
function
|
|
110572
|
+
// src/compiler/transformers/module/impliedNodeFormatDependent.ts
|
|
110573
|
+
function transformImpliedNodeFormatDependentModule(context) {
|
|
110461
110574
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
110462
110575
|
const previousOnEmitNode = context.onEmitNode;
|
|
110463
110576
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -110468,6 +110581,7 @@ function transformNodeModule(context) {
|
|
|
110468
110581
|
const cjsTransform = transformModule(context);
|
|
110469
110582
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
110470
110583
|
const cjsOnEmitNode = context.onEmitNode;
|
|
110584
|
+
const getEmitModuleFormatOfFile = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
110471
110585
|
context.onSubstituteNode = onSubstituteNode;
|
|
110472
110586
|
context.onEmitNode = onEmitNode;
|
|
110473
110587
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -110482,7 +110596,7 @@ function transformNodeModule(context) {
|
|
|
110482
110596
|
if (!currentSourceFile) {
|
|
110483
110597
|
return previousOnSubstituteNode(hint, node);
|
|
110484
110598
|
}
|
|
110485
|
-
if (currentSourceFile
|
|
110599
|
+
if (getEmitModuleFormatOfFile(currentSourceFile) >= 5 /* ES2015 */) {
|
|
110486
110600
|
return esmOnSubstituteNode(hint, node);
|
|
110487
110601
|
}
|
|
110488
110602
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -110495,13 +110609,13 @@ function transformNodeModule(context) {
|
|
|
110495
110609
|
if (!currentSourceFile) {
|
|
110496
110610
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
110497
110611
|
}
|
|
110498
|
-
if (currentSourceFile
|
|
110612
|
+
if (getEmitModuleFormatOfFile(currentSourceFile) >= 5 /* ES2015 */) {
|
|
110499
110613
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
110500
110614
|
}
|
|
110501
110615
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
110502
110616
|
}
|
|
110503
110617
|
function getModuleTransformForFile(file) {
|
|
110504
|
-
return file
|
|
110618
|
+
return getEmitModuleFormatOfFile(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
|
|
110505
110619
|
}
|
|
110506
110620
|
function transformSourceFile(node) {
|
|
110507
110621
|
if (node.isDeclarationFile) {
|
|
@@ -112626,17 +112740,18 @@ function isProcessedComponent(node) {
|
|
|
112626
112740
|
// src/compiler/transformer.ts
|
|
112627
112741
|
function getModuleTransformer(moduleKind) {
|
|
112628
112742
|
switch (moduleKind) {
|
|
112743
|
+
case 200 /* Preserve */:
|
|
112744
|
+
return transformECMAScriptModule;
|
|
112629
112745
|
case 99 /* ESNext */:
|
|
112630
112746
|
case 7 /* ES2022 */:
|
|
112631
112747
|
case 6 /* ES2020 */:
|
|
112632
112748
|
case 5 /* ES2015 */:
|
|
112633
|
-
case 200 /* Preserve */:
|
|
112634
|
-
return transformECMAScriptModule;
|
|
112635
|
-
case 4 /* System */:
|
|
112636
|
-
return transformSystemModule;
|
|
112637
112749
|
case 100 /* Node16 */:
|
|
112638
112750
|
case 199 /* NodeNext */:
|
|
112639
|
-
|
|
112751
|
+
case 1 /* CommonJS */:
|
|
112752
|
+
return transformImpliedNodeFormatDependentModule;
|
|
112753
|
+
case 4 /* System */:
|
|
112754
|
+
return transformSystemModule;
|
|
112640
112755
|
default:
|
|
112641
112756
|
return transformModule;
|
|
112642
112757
|
}
|
|
@@ -113353,6 +113468,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113353
113468
|
newLine: compilerOptions.newLine,
|
|
113354
113469
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
113355
113470
|
module: getEmitModuleKind(compilerOptions),
|
|
113471
|
+
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
113356
113472
|
target: getEmitScriptTarget(compilerOptions),
|
|
113357
113473
|
sourceMap: compilerOptions.sourceMap,
|
|
113358
113474
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -113415,8 +113531,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113415
113531
|
newLine: compilerOptions.newLine,
|
|
113416
113532
|
noEmitHelpers: true,
|
|
113417
113533
|
module: compilerOptions.module,
|
|
113534
|
+
moduleResolution: compilerOptions.moduleResolution,
|
|
113418
113535
|
target: compilerOptions.target,
|
|
113419
|
-
sourceMap:
|
|
113536
|
+
sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
|
|
113420
113537
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
113421
113538
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
113422
113539
|
onlyPrintJsDocStyle: true,
|
|
@@ -118877,9 +118994,6 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
118877
118994
|
function getModeForFileReference(ref, containingFileMode) {
|
|
118878
118995
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
118879
118996
|
}
|
|
118880
|
-
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
118881
|
-
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
118882
|
-
}
|
|
118883
118997
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
118884
118998
|
var _a;
|
|
118885
118999
|
if (isExportDeclaration(decl)) {
|
|
@@ -118894,7 +119008,6 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
118894
119008
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
118895
119009
|
}
|
|
118896
119010
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
118897
|
-
var _a;
|
|
118898
119011
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
|
|
118899
119012
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
118900
119013
|
if (isTypeOnly) {
|
|
@@ -118910,19 +119023,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
118910
119023
|
return override;
|
|
118911
119024
|
}
|
|
118912
119025
|
}
|
|
118913
|
-
if (compilerOptions &&
|
|
118914
|
-
return usage
|
|
118915
|
-
usage.parent,
|
|
118916
|
-
/*requireStringLiteralLikeArgument*/
|
|
118917
|
-
false
|
|
118918
|
-
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
119026
|
+
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
119027
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
|
|
118919
119028
|
}
|
|
118920
|
-
|
|
118921
|
-
|
|
118922
|
-
|
|
119029
|
+
}
|
|
119030
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
|
|
119031
|
+
var _a;
|
|
119032
|
+
if (!compilerOptions) {
|
|
119033
|
+
return void 0;
|
|
118923
119034
|
}
|
|
118924
119035
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
118925
|
-
|
|
119036
|
+
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
119037
|
+
usage.parent,
|
|
119038
|
+
/*requireStringLiteralLikeArgument*/
|
|
119039
|
+
false
|
|
119040
|
+
)) {
|
|
119041
|
+
return 1 /* CommonJS */;
|
|
119042
|
+
}
|
|
119043
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
|
|
119044
|
+
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
119045
|
+
}
|
|
119046
|
+
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
119047
|
+
return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
|
|
118926
119048
|
}
|
|
118927
119049
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
118928
119050
|
if (!node) return void 0;
|
|
@@ -118979,7 +119101,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
118979
119101
|
}
|
|
118980
119102
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
118981
119103
|
getName: getTypeReferenceResolutionName,
|
|
118982
|
-
getMode: (entry, file) => getModeForFileReference(entry, file
|
|
119104
|
+
getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
|
|
118983
119105
|
};
|
|
118984
119106
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
118985
119107
|
return {
|
|
@@ -119161,7 +119283,7 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
|
|
|
119161
119283
|
const packageJsonLocations = [];
|
|
119162
119284
|
state.failedLookupLocations = packageJsonLocations;
|
|
119163
119285
|
state.affectingLocations = packageJsonLocations;
|
|
119164
|
-
const packageJsonScope = getPackageScopeForPath(fileName, state);
|
|
119286
|
+
const packageJsonScope = getPackageScopeForPath(getDirectoryPath(fileName), state);
|
|
119165
119287
|
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
119166
119288
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
119167
119289
|
}
|
|
@@ -119615,7 +119737,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119615
119737
|
isSourceFileFromExternalLibrary,
|
|
119616
119738
|
isSourceFileDefaultLibrary,
|
|
119617
119739
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
119618
|
-
|
|
119740
|
+
getEmitSyntaxForUsageLocation,
|
|
119741
|
+
getModeForResolutionAtIndex,
|
|
119619
119742
|
getSourceFileFromReference,
|
|
119620
119743
|
getLibFileFromReference,
|
|
119621
119744
|
sourceFileToPackageName,
|
|
@@ -119643,6 +119766,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119643
119766
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
119644
119767
|
isSourceOfProjectReferenceRedirect,
|
|
119645
119768
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
119769
|
+
getCompilerOptionsForFile,
|
|
119770
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
119771
|
+
getEmitModuleFormatOfFile,
|
|
119772
|
+
getImpliedNodeFormatForEmit,
|
|
119773
|
+
shouldTransformImportCall,
|
|
119646
119774
|
emitBuildInfo,
|
|
119647
119775
|
fileExists,
|
|
119648
119776
|
readFile,
|
|
@@ -120197,6 +120325,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120197
120325
|
getSymlinkCache,
|
|
120198
120326
|
writeFile: writeFileCallback || writeFile2,
|
|
120199
120327
|
isEmitBlocked,
|
|
120328
|
+
shouldTransformImportCall,
|
|
120329
|
+
getEmitModuleFormatOfFile,
|
|
120330
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
120331
|
+
getModeForResolutionAtIndex,
|
|
120200
120332
|
readFile: (f) => host.readFile(f),
|
|
120201
120333
|
fileExists: (f) => {
|
|
120202
120334
|
const path = toPath3(f);
|
|
@@ -121276,10 +121408,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121276
121408
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
121277
121409
|
const fileName = ref.fileName;
|
|
121278
121410
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
121279
|
-
const mode = ref.resolutionMode || file
|
|
121411
|
+
const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
|
|
121280
121412
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
121281
121413
|
}
|
|
121282
121414
|
}
|
|
121415
|
+
function getCompilerOptionsForFile(file) {
|
|
121416
|
+
var _a2;
|
|
121417
|
+
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
121418
|
+
}
|
|
121283
121419
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
121284
121420
|
var _a2, _b2;
|
|
121285
121421
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
|
|
@@ -121380,13 +121516,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121380
121516
|
return host.getCanonicalFileName(fileName);
|
|
121381
121517
|
}
|
|
121382
121518
|
function processImportedModules(file) {
|
|
121383
|
-
var _a2;
|
|
121384
121519
|
collectExternalModuleReferences(file);
|
|
121385
121520
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
121386
121521
|
const moduleNames = getModuleNames(file);
|
|
121387
121522
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
121388
121523
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
121389
|
-
const optionsForFile = (
|
|
121524
|
+
const optionsForFile = getCompilerOptionsForFile(file);
|
|
121390
121525
|
const resolutionsInFile = createModeAwareCache();
|
|
121391
121526
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
121392
121527
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -121935,7 +122070,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121935
122070
|
redirectInfo = cachedChain.redirectInfo;
|
|
121936
122071
|
} else {
|
|
121937
122072
|
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
121938
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
122073
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
|
121939
122074
|
}
|
|
121940
122075
|
if (fileProcessingReason) processReason(fileProcessingReason);
|
|
121941
122076
|
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
@@ -122293,13 +122428,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122293
122428
|
return symlinks;
|
|
122294
122429
|
}
|
|
122295
122430
|
function getModeForUsageLocation2(file, usage) {
|
|
122296
|
-
|
|
122297
|
-
|
|
122298
|
-
|
|
122431
|
+
return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
122432
|
+
}
|
|
122433
|
+
function getEmitSyntaxForUsageLocation(file, usage) {
|
|
122434
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
122299
122435
|
}
|
|
122300
|
-
function
|
|
122436
|
+
function getModeForResolutionAtIndex(file, index) {
|
|
122301
122437
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
122302
122438
|
}
|
|
122439
|
+
function getDefaultResolutionModeForFile2(sourceFile) {
|
|
122440
|
+
return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122441
|
+
}
|
|
122442
|
+
function getImpliedNodeFormatForEmit(sourceFile) {
|
|
122443
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122444
|
+
}
|
|
122445
|
+
function getEmitModuleFormatOfFile(sourceFile) {
|
|
122446
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122447
|
+
}
|
|
122448
|
+
function shouldTransformImportCall(sourceFile) {
|
|
122449
|
+
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122450
|
+
}
|
|
122451
|
+
}
|
|
122452
|
+
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
122453
|
+
const moduleKind = getEmitModuleKind(options);
|
|
122454
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
|
|
122455
|
+
return false;
|
|
122456
|
+
}
|
|
122457
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
|
|
122458
|
+
}
|
|
122459
|
+
function getEmitModuleFormatOfFileWorker(sourceFile, options) {
|
|
122460
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
|
|
122461
|
+
}
|
|
122462
|
+
function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
|
|
122463
|
+
var _a, _b;
|
|
122464
|
+
const moduleKind = getEmitModuleKind(options);
|
|
122465
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
122466
|
+
return sourceFile.impliedNodeFormat;
|
|
122467
|
+
}
|
|
122468
|
+
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
|
|
122469
|
+
return 1 /* CommonJS */;
|
|
122470
|
+
}
|
|
122471
|
+
if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
|
|
122472
|
+
return 99 /* ESNext */;
|
|
122473
|
+
}
|
|
122474
|
+
return void 0;
|
|
122475
|
+
}
|
|
122476
|
+
function getDefaultResolutionModeForFileWorker(sourceFile, options) {
|
|
122477
|
+
return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
|
|
122303
122478
|
}
|
|
122304
122479
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
122305
122480
|
let setOfDeclarationDirectories;
|
|
@@ -122754,8 +122929,7 @@ var BuilderState;
|
|
|
122754
122929
|
);
|
|
122755
122930
|
},
|
|
122756
122931
|
cancellationToken,
|
|
122757
|
-
/*
|
|
122758
|
-
true,
|
|
122932
|
+
2 /* BuilderSignature */,
|
|
122759
122933
|
/*customTransformers*/
|
|
122760
122934
|
void 0,
|
|
122761
122935
|
/*forceDtsEmit*/
|
|
@@ -123076,7 +123250,12 @@ function repopulateDiagnostics(diagnostics, newProgram) {
|
|
|
123076
123250
|
}
|
|
123077
123251
|
function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
|
|
123078
123252
|
const info = repopulateInfo(chain);
|
|
123079
|
-
if (info) {
|
|
123253
|
+
if (info === true) {
|
|
123254
|
+
return {
|
|
123255
|
+
...createModeMismatchDetails(sourceFile),
|
|
123256
|
+
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
123257
|
+
};
|
|
123258
|
+
} else if (info) {
|
|
123080
123259
|
return {
|
|
123081
123260
|
...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
|
|
123082
123261
|
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
@@ -124807,7 +124986,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124807
124986
|
cleanupLibResolutionWatching(newProgram);
|
|
124808
124987
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
124809
124988
|
var _a;
|
|
124810
|
-
const expected =
|
|
124989
|
+
const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
|
|
124811
124990
|
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
|
|
124812
124991
|
for (let i = existing.length; i < expected; i++) {
|
|
124813
124992
|
createFileWatcherOfAffectingLocation(
|
|
@@ -125699,10 +125878,10 @@ function explainFiles(program, write) {
|
|
|
125699
125878
|
for (const file of program.getSourceFiles()) {
|
|
125700
125879
|
write(`${toFileName(file, relativeFileName)}`);
|
|
125701
125880
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
125702
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
125881
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
125703
125882
|
}
|
|
125704
125883
|
}
|
|
125705
|
-
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
125884
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
|
|
125706
125885
|
var _a;
|
|
125707
125886
|
let result;
|
|
125708
125887
|
if (file.path !== file.resolvedPath) {
|
|
@@ -125722,7 +125901,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
|
125722
125901
|
));
|
|
125723
125902
|
}
|
|
125724
125903
|
if (isExternalOrCommonJsModule(file)) {
|
|
125725
|
-
switch (file
|
|
125904
|
+
switch (getImpliedNodeFormatForEmitWorker(file, options)) {
|
|
125726
125905
|
case 99 /* ESNext */:
|
|
125727
125906
|
if (file.packageJsonScope) {
|
|
125728
125907
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|