@typescript-deploys/pr-build 5.6.0-pr-59436-2 → 5.6.0-pr-59504-2

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-insiders.20240726`;
21
+ var version = `${versionMajorMinor}.0-insiders.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);
@@ -79766,16 +79778,20 @@ function createTypeChecker(host) {
79766
79778
  const someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;
79767
79779
  if (someButNotAllOverloadFlags !== 0) {
79768
79780
  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);
79781
+ group(overloads, (o) => getSourceFileOfNode(o).fileName).forEach((overloadsInFile) => {
79782
+ const canonicalFlagsForFile = getEffectiveDeclarationFlags(getCanonicalOverload(overloadsInFile, implementation), flagsToCheck2);
79783
+ for (const o of overloadsInFile) {
79784
+ const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
79785
+ const deviationInFile = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlagsForFile;
79786
+ if (deviationInFile & 32 /* Export */) {
79787
+ error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
79788
+ } else if (deviationInFile & 128 /* Ambient */) {
79789
+ error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
79790
+ } else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
79791
+ error(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
79792
+ } else if (deviation & 64 /* Abstract */) {
79793
+ error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
79794
+ }
79779
79795
  }
79780
79796
  });
79781
79797
  }
@@ -80910,7 +80926,7 @@ function createTypeChecker(host) {
80910
80926
  if (!wrappingDeclaration.type) {
80911
80927
  addRelatedInfo(
80912
80928
  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))
80929
+ 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
80930
  );
80915
80931
  }
80916
80932
  diagnostics.add(diagnostic);
@@ -83753,6 +83769,13 @@ function createTypeChecker(host) {
83753
83769
  } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
83754
83770
  error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
83755
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
+ }
83756
83779
  }
83757
83780
  if (isImportSpecifier(node)) {
83758
83781
  const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
@@ -103611,7 +103634,7 @@ function transformES2015(context) {
103611
103634
  statement,
103612
103635
  /*outermostLabeledStatement*/
103613
103636
  node
103614
- ) : factory2.restoreEnclosingLabel(Debug.checkDefined(visitNode(statement, visitor, isStatement, factory2.liftToBlock)), node, convertedLoopState && resetLabel);
103637
+ ) : factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), statement), node, convertedLoopState && resetLabel);
103615
103638
  }
103616
103639
  function visitIterationStatement(node, outermostLabeledStatement) {
103617
103640
  switch (node.kind) {
@@ -107917,7 +107940,7 @@ function transformModule(context) {
107917
107940
  return factory2.updateLabeledStatement(
107918
107941
  node,
107919
107942
  node.label,
107920
- visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? factory2.createExpressionStatement(factory2.createIdentifier(""))
107943
+ visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) ?? setTextRange(factory2.createEmptyStatement(), node.statement)
107921
107944
  );
107922
107945
  }
107923
107946
  function visitWithStatement(node) {
@@ -119423,13 +119446,9 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
119423
119446
  return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
119424
119447
  }
119425
119448
  function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
119426
- switch (getEmitModuleResolutionKind(options)) {
119427
- case 3 /* Node16 */:
119428
- case 99 /* NodeNext */:
119429
- 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;
119430
- default:
119431
- return void 0;
119432
- }
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;
119433
119452
  function lookupFromPackageJson() {
119434
119453
  const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
119435
119454
  const packageJsonLocations = [];