typescript 5.7.0-dev.20240822 → 5.7.0-dev.20240824

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.7";
21
- var version = `${versionMajorMinor}.0-dev.20240822`;
21
+ var version = `${versionMajorMinor}.0-dev.20240824`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6139,6 +6139,8 @@ var Diagnostics = {
6139
6139
  /*reportsDeprecated*/
6140
6140
  true
6141
6141
  ),
6142
+ Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1541, 1 /* Error */, "Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribut_1541", "Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
6143
+ Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1542, 1 /* Error */, "Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute_1542", "Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
6142
6144
  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."),
6143
6145
  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."),
6144
6146
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7846,6 +7848,8 @@ var Diagnostics = {
7846
7848
  Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
7847
7849
  Wrap_in_parentheses: diag(95194, 3 /* Message */, "Wrap_in_parentheses_95194", "Wrap in parentheses"),
7848
7850
  Wrap_all_invalid_decorator_expressions_in_parentheses: diag(95195, 3 /* Message */, "Wrap_all_invalid_decorator_expressions_in_parentheses_95195", "Wrap all invalid decorator expressions in parentheses"),
7851
+ Add_resolution_mode_import_attribute: diag(95196, 3 /* Message */, "Add_resolution_mode_import_attribute_95196", "Add 'resolution-mode' import attribute"),
7852
+ Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it: diag(95197, 3 /* Message */, "Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it_95197", "Add 'resolution-mode' import attribute to all type-only imports that need it"),
7849
7853
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
7850
7854
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
7851
7855
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -48455,7 +48459,7 @@ function createTypeChecker(host) {
48455
48459
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
48456
48460
  }
48457
48461
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
48458
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
48462
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
48459
48463
  if (errorNode && startsWith(moduleReference, "@types/")) {
48460
48464
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
48461
48465
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
@@ -48524,14 +48528,11 @@ function createTypeChecker(host) {
48524
48528
  if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
48525
48529
  diagnosticDetails = createModeMismatchDetails(currentSourceFile);
48526
48530
  }
48531
+ const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_j = overrideHost.importClause) == null ? void 0 : _j.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
48527
48532
  diagnostics.add(createDiagnosticForNodeFromMessageChain(
48528
48533
  getSourceFileOfNode(errorNode),
48529
48534
  errorNode,
48530
- chainDiagnosticMessages(
48531
- diagnosticDetails,
48532
- Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead,
48533
- moduleReference
48534
- )
48535
+ chainDiagnosticMessages(diagnosticDetails, message, moduleReference)
48535
48536
  ));
48536
48537
  }
48537
48538
  }
@@ -48590,14 +48591,14 @@ function createTypeChecker(host) {
48590
48591
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
48591
48592
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
48592
48593
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
48593
- const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
48594
+ const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
48594
48595
  if (suggestedExt) {
48595
48596
  error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
48596
48597
  } else {
48597
48598
  error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
48598
48599
  }
48599
48600
  } else {
48600
- if ((_k = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _k.alternateResult) {
48601
+ if ((_l = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _l.alternateResult) {
48601
48602
  const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
48602
48603
  errorOrSuggestion(
48603
48604
  /*isError*/