typescript 5.6.0-dev.20240730 → 5.6.0-dev.20240801

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.20240801`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -51650,6 +51650,8 @@ function createTypeChecker(host) {
51650
51650
  }
51651
51651
  introducesError = true;
51652
51652
  return { introducesError, node, sym };
51653
+ } else {
51654
+ sym = symAtLocation;
51653
51655
  }
51654
51656
  }
51655
51657
  if (sym) {
@@ -78805,7 +78807,17 @@ function createTypeChecker(host) {
78805
78807
  if (!ok) {
78806
78808
  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
78809
  }
78808
- if (getIsolatedModules(compilerOptions)) {
78810
+ if (compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax && ok && !resolveName(
78811
+ node,
78812
+ getFirstIdentifier(node),
78813
+ 2097152 /* Alias */,
78814
+ /*nameNotFoundMessage*/
78815
+ void 0,
78816
+ /*isUse*/
78817
+ false,
78818
+ /*excludeGlobals*/
78819
+ true
78820
+ )) {
78809
78821
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
78810
78822
  const constEnumDeclaration = type.symbol.valueDeclaration;
78811
78823
  const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
@@ -83757,6 +83769,13 @@ function createTypeChecker(host) {
83757
83769
  } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
83758
83770
  error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
83759
83771
  }
83772
+ if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
83773
+ const constEnumDeclaration = target.valueDeclaration;
83774
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
83775
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
83776
+ error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
83777
+ }
83778
+ }
83760
83779
  }
83761
83780
  if (isImportSpecifier(node)) {
83762
83781
  const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
@@ -119427,13 +119446,9 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
119427
119446
  return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
119428
119447
  }
119429
119448
  function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
119430
- switch (getEmitModuleResolutionKind(options)) {
119431
- case 3 /* Node16 */:
119432
- case 99 /* NodeNext */:
119433
- return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
119434
- default:
119435
- return void 0;
119436
- }
119449
+ const moduleResolution = getEmitModuleResolutionKind(options);
119450
+ const shouldLookupFromPackageJson = 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || pathContainsNodeModules(fileName);
119451
+ return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : shouldLookupFromPackageJson && fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
119437
119452
  function lookupFromPackageJson() {
119438
119453
  const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
119439
119454
  const packageJsonLocations = [];
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.20240801`;
2264
2264
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2265
2265
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2266
2266
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -56269,6 +56269,8 @@ function createTypeChecker(host) {
56269
56269
  }
56270
56270
  introducesError = true;
56271
56271
  return { introducesError, node, sym };
56272
+ } else {
56273
+ sym = symAtLocation;
56272
56274
  }
56273
56275
  }
56274
56276
  if (sym) {
@@ -83424,7 +83426,17 @@ function createTypeChecker(host) {
83424
83426
  if (!ok) {
83425
83427
  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
83428
  }
83427
- if (getIsolatedModules(compilerOptions)) {
83429
+ if (compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax && ok && !resolveName(
83430
+ node,
83431
+ getFirstIdentifier(node),
83432
+ 2097152 /* Alias */,
83433
+ /*nameNotFoundMessage*/
83434
+ void 0,
83435
+ /*isUse*/
83436
+ false,
83437
+ /*excludeGlobals*/
83438
+ true
83439
+ )) {
83428
83440
  Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
83429
83441
  const constEnumDeclaration = type.symbol.valueDeclaration;
83430
83442
  const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
@@ -88376,6 +88388,13 @@ function createTypeChecker(host) {
88376
88388
  } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
88377
88389
  error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
88378
88390
  }
88391
+ if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
88392
+ const constEnumDeclaration = target.valueDeclaration;
88393
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
88394
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
88395
+ error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
88396
+ }
88397
+ }
88379
88398
  }
88380
88399
  if (isImportSpecifier(node)) {
88381
88400
  const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
@@ -124285,13 +124304,9 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
124285
124304
  return typeof result === "object" ? result.impliedNodeFormat : result;
124286
124305
  }
124287
124306
  function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
124288
- switch (getEmitModuleResolutionKind(options)) {
124289
- case 3 /* Node16 */:
124290
- case 99 /* NodeNext */:
124291
- return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
124292
- default:
124293
- return void 0;
124294
- }
124307
+ const moduleResolution = getEmitModuleResolutionKind(options);
124308
+ const shouldLookupFromPackageJson = 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || pathContainsNodeModules(fileName);
124309
+ return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : shouldLookupFromPackageJson && fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
124295
124310
  function lookupFromPackageJson() {
124296
124311
  const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
124297
124312
  const packageJsonLocations = [];