typescript 5.6.0-dev.20240729 → 5.6.0-dev.20240731

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.6";
21
- var version = `${versionMajorMinor}.0-dev.20240729`;
21
+ var version = `${versionMajorMinor}.0-dev.20240731`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -78805,7 +78805,17 @@ function createTypeChecker(host) {
78805
78805
  if (!ok) {
78806
78806
  error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
78807
78807
  }
78808
- if (getIsolatedModules(compilerOptions)) {
78808
+ if (compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax && ok && !resolveName(
78809
+ node,
78810
+ getFirstIdentifier(node),
78811
+ 2097152 /* Alias */,
78812
+ /*nameNotFoundMessage*/
78813
+ void 0,
78814
+ /*isUse*/
78815
+ false,
78816
+ /*excludeGlobals*/
78817
+ true
78818
+ )) {
78809
78819
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
78810
78820
  const constEnumDeclaration = type.symbol.valueDeclaration;
78811
78821
  const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
@@ -79766,16 +79776,20 @@ function createTypeChecker(host) {
79766
79776
  const someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;
79767
79777
  if (someButNotAllOverloadFlags !== 0) {
79768
79778
  const canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck2);
79769
- forEach(overloads, (o) => {
79770
- const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
79771
- if (deviation & 32 /* Export */) {
79772
- error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
79773
- } else if (deviation & 128 /* Ambient */) {
79774
- error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
79775
- } else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
79776
- error(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
79777
- } else if (deviation & 64 /* Abstract */) {
79778
- error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
79779
+ group(overloads, (o) => getSourceFileOfNode(o).fileName).forEach((overloadsInFile) => {
79780
+ const canonicalFlagsForFile = getEffectiveDeclarationFlags(getCanonicalOverload(overloadsInFile, implementation), flagsToCheck2);
79781
+ for (const o of overloadsInFile) {
79782
+ const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
79783
+ const deviationInFile = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlagsForFile;
79784
+ if (deviationInFile & 32 /* Export */) {
79785
+ error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
79786
+ } else if (deviationInFile & 128 /* Ambient */) {
79787
+ error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
79788
+ } else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
79789
+ error(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
79790
+ } else if (deviation & 64 /* Abstract */) {
79791
+ error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
79792
+ }
79779
79793
  }
79780
79794
  });
79781
79795
  }
@@ -80910,7 +80924,7 @@ function createTypeChecker(host) {
80910
80924
  if (!wrappingDeclaration.type) {
80911
80925
  addRelatedInfo(
80912
80926
  diagnostic,
80913
- createFileDiagnostic(getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 1, Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, declarationNameToString(node.propertyName))
80927
+ createFileDiagnostic(getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 0, Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, declarationNameToString(node.propertyName))
80914
80928
  );
80915
80929
  }
80916
80930
  diagnostics.add(diagnostic);
@@ -83753,6 +83767,13 @@ function createTypeChecker(host) {
83753
83767
  } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
83754
83768
  error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
83755
83769
  }
83770
+ if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
83771
+ const constEnumDeclaration = target.valueDeclaration;
83772
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
83773
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
83774
+ error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
83775
+ }
83776
+ }
83756
83777
  }
83757
83778
  if (isImportSpecifier(node)) {
83758
83779
  const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);