typescript 5.6.0-dev.20240730 → 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.20240730`;
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);
@@ -83757,6 +83767,13 @@ function createTypeChecker(host) {
83757
83767
  } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
83758
83768
  error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
83759
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
+ }
83760
83777
  }
83761
83778
  if (isImportSpecifier(node)) {
83762
83779
  const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
package/lib/typescript.js CHANGED
@@ -2260,7 +2260,7 @@ module.exports = __toCommonJS(typescript_exports);
2260
2260
 
2261
2261
  // src/compiler/corePublic.ts
2262
2262
  var versionMajorMinor = "5.6";
2263
- var version = `${versionMajorMinor}.0-dev.20240730`;
2263
+ var version = `${versionMajorMinor}.0-dev.20240731`;
2264
2264
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2265
2265
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2266
2266
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -83424,7 +83424,17 @@ function createTypeChecker(host) {
83424
83424
  if (!ok) {
83425
83425
  error2(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);
83426
83426
  }
83427
- if (getIsolatedModules(compilerOptions)) {
83427
+ if (compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax && ok && !resolveName(
83428
+ node,
83429
+ getFirstIdentifier(node),
83430
+ 2097152 /* Alias */,
83431
+ /*nameNotFoundMessage*/
83432
+ void 0,
83433
+ /*isUse*/
83434
+ false,
83435
+ /*excludeGlobals*/
83436
+ true
83437
+ )) {
83428
83438
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
83429
83439
  const constEnumDeclaration = type.symbol.valueDeclaration;
83430
83440
  const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
@@ -88376,6 +88386,13 @@ function createTypeChecker(host) {
88376
88386
  } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
88377
88387
  error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
88378
88388
  }
88389
+ if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
88390
+ const constEnumDeclaration = target.valueDeclaration;
88391
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
88392
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
88393
+ error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
88394
+ }
88395
+ }
88379
88396
  }
88380
88397
  if (isImportSpecifier(node)) {
88381
88398
  const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);