typescript 5.0.0-dev.20230109 → 5.0.0-dev.20230110

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
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230109`;
26
+ var version = `${versionMajorMinor}.0-dev.20230110`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -7134,6 +7134,9 @@ var Diagnostics = {
7134
7134
  Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
7135
7135
  Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
7136
7136
  Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
7137
+ File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
7138
+ Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
7139
+ Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
7137
7140
  Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
7138
7141
  Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
7139
7142
  Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
@@ -14253,13 +14256,13 @@ function getDeclarationEmitOutputFilePathWorker(fileName, options, currentDirect
14253
14256
  return removeFileExtension(path) + declarationExtension;
14254
14257
  }
14255
14258
  function getDeclarationEmitExtensionForPath(path) {
14256
- return fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ : fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ : fileExtensionIsOneOf(path, [".json" /* Json */]) ? `.json.d.ts` : (
14259
+ return fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ : fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ : fileExtensionIsOneOf(path, [".json" /* Json */]) ? `.d.json.ts` : (
14257
14260
  // Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well
14258
14261
  ".d.ts" /* Dts */
14259
14262
  );
14260
14263
  }
14261
14264
  function getPossibleOriginalInputExtensionForExtension(path) {
14262
- return fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path, [`.json.d.ts`]) ? [".json" /* Json */] : [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
14265
+ return fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path, [`.d.json.ts`]) ? [".json" /* Json */] : [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
14263
14266
  }
14264
14267
  function outFile(options) {
14265
14268
  return options.outFile || options.out;
@@ -16132,7 +16135,7 @@ function positionIsSynthesized(pos) {
16132
16135
  return !(pos >= 0);
16133
16136
  }
16134
16137
  function extensionIsTS(ext) {
16135
- return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */ || ext === ".cts" /* Cts */ || ext === ".mts" /* Mts */ || ext === ".d.mts" /* Dmts */ || ext === ".d.cts" /* Dcts */;
16138
+ return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */ || ext === ".cts" /* Cts */ || ext === ".mts" /* Mts */ || ext === ".d.mts" /* Dmts */ || ext === ".d.cts" /* Dcts */ || startsWith(ext, ".d.") && endsWith(ext, ".ts");
16136
16139
  }
16137
16140
  function resolutionExtensionIsTSOrJson(ext) {
16138
16141
  return extensionIsTS(ext) || ext === ".json" /* Json */;
@@ -23212,6 +23215,9 @@ function isTypeOfExpression(node) {
23212
23215
  function isVoidExpression(node) {
23213
23216
  return node.kind === 219 /* VoidExpression */;
23214
23217
  }
23218
+ function isAwaitExpression(node) {
23219
+ return node.kind === 220 /* AwaitExpression */;
23220
+ }
23215
23221
  function isPrefixUnaryExpression(node) {
23216
23222
  return node.kind === 221 /* PrefixUnaryExpression */;
23217
23223
  }
@@ -28360,7 +28366,7 @@ var Parser;
28360
28366
  const pos = getNodePos();
28361
28367
  return finishNode(factory2.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos);
28362
28368
  }
28363
- function isAwaitExpression() {
28369
+ function isAwaitExpression2() {
28364
28370
  if (token() === 133 /* AwaitKeyword */) {
28365
28371
  if (inAwaitContext()) {
28366
28372
  return true;
@@ -28408,7 +28414,7 @@ var Parser;
28408
28414
  case 29 /* LessThanToken */:
28409
28415
  return parseTypeAssertion();
28410
28416
  case 133 /* AwaitKeyword */:
28411
- if (isAwaitExpression()) {
28417
+ if (isAwaitExpression2()) {
28412
28418
  return parseAwaitExpression();
28413
28419
  }
28414
28420
  default:
@@ -32071,7 +32077,7 @@ var IncrementalParser;
32071
32077
  })(InvalidPosition || (InvalidPosition = {}));
32072
32078
  })(IncrementalParser || (IncrementalParser = {}));
32073
32079
  function isDeclarationFileName(fileName) {
32074
- return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions);
32080
+ return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) && stringContains(getBaseFileName(fileName), ".d.");
32075
32081
  }
32076
32082
  function parseResolutionMode(mode, pos, end, reportDiagnostic) {
32077
32083
  if (!mode) {
@@ -33329,6 +33335,14 @@ var commandOptionsWithoutBuild = [
33329
33335
  description: Diagnostics.Enable_importing_json_files,
33330
33336
  defaultValueDescription: false
33331
33337
  },
33338
+ {
33339
+ name: "allowArbitraryExtensions",
33340
+ type: "boolean",
33341
+ affectsModuleResolution: true,
33342
+ category: Diagnostics.Modules,
33343
+ description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
33344
+ defaultValueDescription: false
33345
+ },
33332
33346
  {
33333
33347
  name: "out",
33334
33348
  type: "string",
@@ -36772,14 +36786,19 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
36772
36786
  }
36773
36787
  }
36774
36788
  function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
36775
- if (hasJSFileExtension(candidate) || extensions & 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */) || extensions & (1 /* TypeScript */ | 4 /* Declaration */) && moduleResolutionSupportsResolvingTsExtensions(state.compilerOptions) && fileExtensionIsOneOf(candidate, supportedTSExtensionsFlat)) {
36776
- const extensionless = removeFileExtension(candidate);
36777
- const extension = candidate.substring(extensionless.length);
36778
- if (state.traceEnabled) {
36779
- trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
36780
- }
36781
- return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
36789
+ const filename = getBaseFileName(candidate);
36790
+ if (filename.indexOf(".") === -1) {
36791
+ return void 0;
36792
+ }
36793
+ let extensionless = removeFileExtension(candidate);
36794
+ if (extensionless === candidate) {
36795
+ extensionless = candidate.substring(0, candidate.lastIndexOf("."));
36782
36796
  }
36797
+ const extension = candidate.substring(extensionless.length);
36798
+ if (state.traceEnabled) {
36799
+ trace(state.host, Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
36800
+ }
36801
+ return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
36783
36802
  }
36784
36803
  function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
36785
36804
  if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
@@ -36803,38 +36822,23 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
36803
36822
  case ".mjs" /* Mjs */:
36804
36823
  case ".mts" /* Mts */:
36805
36824
  case ".d.mts" /* Dmts */:
36806
- return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
36825
+ return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */, originalExtension === ".mts" /* Mts */ || originalExtension === ".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
36807
36826
  case ".cjs" /* Cjs */:
36808
36827
  case ".cts" /* Cts */:
36809
36828
  case ".d.cts" /* Dcts */:
36810
- return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
36829
+ return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */, originalExtension === ".cts" /* Cts */ || originalExtension === ".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
36811
36830
  case ".json" /* Json */:
36812
- const originalCandidate = candidate;
36813
- if (extensions & 4 /* Declaration */) {
36814
- candidate += ".json" /* Json */;
36815
- const result = tryExtension(".d.ts" /* Dts */);
36816
- if (result)
36817
- return result;
36818
- }
36819
- if (extensions & 8 /* Json */) {
36820
- candidate = originalCandidate;
36821
- const result = tryExtension(".json" /* Json */);
36822
- if (result)
36823
- return result;
36824
- }
36825
- return void 0;
36826
- case ".ts" /* Ts */:
36831
+ return extensions & 4 /* Declaration */ && tryExtension(".d.json.ts") || extensions & 8 /* Json */ && tryExtension(".json" /* Json */) || void 0;
36827
36832
  case ".tsx" /* Tsx */:
36833
+ case ".jsx" /* Jsx */:
36834
+ return extensions & 1 /* TypeScript */ && (tryExtension(".tsx" /* Tsx */, originalExtension === ".tsx" /* Tsx */) || tryExtension(".ts" /* Ts */, originalExtension === ".tsx" /* Tsx */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".tsx" /* Tsx */) || extensions & 2 /* JavaScript */ && (tryExtension(".jsx" /* Jsx */) || tryExtension(".js" /* Js */)) || void 0;
36835
+ case ".ts" /* Ts */:
36828
36836
  case ".d.ts" /* Dts */:
36829
- if (moduleResolutionSupportsResolvingTsExtensions(state.compilerOptions) && extensionIsOk(extensions, originalExtension)) {
36830
- return tryExtension(
36831
- originalExtension,
36832
- /*resolvedUsingTsExtension*/
36833
- true
36834
- );
36835
- }
36837
+ case ".js" /* Js */:
36838
+ case "":
36839
+ return extensions & 1 /* TypeScript */ && (tryExtension(".ts" /* Ts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || tryExtension(".tsx" /* Tsx */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */, originalExtension === ".ts" /* Ts */ || originalExtension === ".d.ts" /* Dts */) || extensions & 2 /* JavaScript */ && (tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */)) || state.isConfigLookup && tryExtension(".json" /* Json */) || void 0;
36836
36840
  default:
36837
- return extensions & 1 /* TypeScript */ && (tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */) || extensions & 2 /* JavaScript */ && (tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */)) || state.isConfigLookup && tryExtension(".json" /* Json */) || void 0;
36841
+ return extensions & 4 /* Declaration */ && !isDeclarationFileName(candidate + originalExtension) && tryExtension(`.d${originalExtension}.ts`) || void 0;
36838
36842
  }
36839
36843
  function tryExtension(ext, resolvedUsingTsExtension) {
36840
36844
  const path = tryFile(candidate + ext, onlyRecordFailures, state);
@@ -37773,11 +37777,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
37773
37777
  }
37774
37778
  }
37775
37779
  }
37776
- function moduleResolutionSupportsResolvingTsExtensions(compilerOptions) {
37777
- return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
37778
- }
37779
37780
  function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
37780
- return moduleResolutionSupportsResolvingTsExtensions(compilerOptions) && (!!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName));
37781
+ return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && (!!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName));
37781
37782
  }
37782
37783
  function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
37783
37784
  const traceEnabled = isTraceEnabled(compilerOptions, host);
@@ -41467,6 +41468,8 @@ function processEnding(fileName, allowedEndings, options, host) {
41467
41468
  }
41468
41469
  if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
41469
41470
  return noExtension + getJSExtensionForFile(fileName, options);
41471
+ } else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && stringContains(fileName, ".d.")) {
41472
+ return tryGetRealFileNameForNonJsDeclarationFileName(fileName);
41470
41473
  }
41471
41474
  switch (allowedEndings[0]) {
41472
41475
  case 0 /* Minimal */:
@@ -41490,6 +41493,14 @@ function processEnding(fileName, allowedEndings, options, host) {
41490
41493
  return Debug.assertNever(allowedEndings[0]);
41491
41494
  }
41492
41495
  }
41496
+ function tryGetRealFileNameForNonJsDeclarationFileName(fileName) {
41497
+ const baseName = getBaseFileName(fileName);
41498
+ if (!endsWith(fileName, ".ts" /* Ts */) || !stringContains(baseName, ".d.") || fileExtensionIsOneOf(baseName, [".d.ts" /* Dts */]))
41499
+ return void 0;
41500
+ const noExtension = removeExtension(fileName, ".ts" /* Ts */);
41501
+ const ext = noExtension.substring(noExtension.lastIndexOf("."));
41502
+ return noExtension.substring(0, noExtension.indexOf(".d.")) + ext;
41503
+ }
41493
41504
  function getJSExtensionForFile(fileName, options) {
41494
41505
  var _a2;
41495
41506
  return (_a2 = tryGetJSExtensionForFile(fileName, options)) != null ? _a2 : Debug.fail(`Extension ${extensionFromPath(fileName)} is unsupported:: FileName:: ${fileName}`);
@@ -43915,7 +43926,7 @@ function createTypeChecker(host) {
43915
43926
  const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
43916
43927
  const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
43917
43928
  if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
43918
- if (hasExportAssignmentSymbol(moduleSymbol)) {
43929
+ if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
43919
43930
  const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
43920
43931
  const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
43921
43932
  const exportAssignment = exportEqualsSymbol.valueDeclaration;
@@ -44710,7 +44721,7 @@ function createTypeChecker(host) {
44710
44721
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
44711
44722
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
44712
44723
  const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
44713
- const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule);
44724
+ const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
44714
44725
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
44715
44726
  if (sourceFile) {
44716
44727
  if (resolutionDiagnostic) {
@@ -48664,7 +48675,9 @@ function createTypeChecker(host) {
48664
48675
  case 267 /* NamespaceExportDeclaration */:
48665
48676
  addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */);
48666
48677
  break;
48667
- case 270 /* ImportClause */:
48678
+ case 270 /* ImportClause */: {
48679
+ const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
48680
+ const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
48668
48681
  addResult(factory.createImportDeclaration(
48669
48682
  /*modifiers*/
48670
48683
  void 0,
@@ -48675,15 +48688,14 @@ function createTypeChecker(host) {
48675
48688
  /*namedBindings*/
48676
48689
  void 0
48677
48690
  ),
48678
- // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned
48679
- // And then made into a default by the `esModuleInterop` or `allowSyntheticDefaultImports` flag
48680
- // In such cases, the `target` refers to the module itself already
48681
- factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)),
48682
- /*assertClause*/
48683
- void 0
48691
+ specifier2,
48692
+ node.parent.assertClause
48684
48693
  ), 0 /* None */);
48685
48694
  break;
48686
- case 271 /* NamespaceImport */:
48695
+ }
48696
+ case 271 /* NamespaceImport */: {
48697
+ const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
48698
+ const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
48687
48699
  addResult(factory.createImportDeclaration(
48688
48700
  /*modifiers*/
48689
48701
  void 0,
@@ -48694,11 +48706,11 @@ function createTypeChecker(host) {
48694
48706
  void 0,
48695
48707
  factory.createNamespaceImport(factory.createIdentifier(localName))
48696
48708
  ),
48697
- factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)),
48698
- /*assertClause*/
48699
- void 0
48709
+ specifier2,
48710
+ node.parent.parent.assertClause
48700
48711
  ), 0 /* None */);
48701
48712
  break;
48713
+ }
48702
48714
  case 277 /* NamespaceExport */:
48703
48715
  addResult(factory.createExportDeclaration(
48704
48716
  /*modifiers*/
@@ -48709,7 +48721,9 @@ function createTypeChecker(host) {
48709
48721
  factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
48710
48722
  ), 0 /* None */);
48711
48723
  break;
48712
- case 273 /* ImportSpecifier */:
48724
+ case 273 /* ImportSpecifier */: {
48725
+ const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
48726
+ const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
48713
48727
  addResult(factory.createImportDeclaration(
48714
48728
  /*modifiers*/
48715
48729
  void 0,
@@ -48727,11 +48741,11 @@ function createTypeChecker(host) {
48727
48741
  )
48728
48742
  ])
48729
48743
  ),
48730
- factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)),
48731
- /*assertClause*/
48732
- void 0
48744
+ specifier2,
48745
+ node.parent.parent.parent.assertClause
48733
48746
  ), 0 /* None */);
48734
48747
  break;
48748
+ }
48735
48749
  case 278 /* ExportSpecifier */:
48736
48750
  const specifier = node.parent.parent.moduleSpecifier;
48737
48751
  serializeExportSpecifier(
@@ -71385,7 +71399,7 @@ function createTypeChecker(host) {
71385
71399
  return getRegularTypeOfObjectLiteral(rightType);
71386
71400
  }
71387
71401
  case 27 /* CommaToken */:
71388
- if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) {
71402
+ if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
71389
71403
  const sf = getSourceFileOfNode(left);
71390
71404
  const sourceText = sf.text;
71391
71405
  const start = skipTrivia(sourceText, left.pos);
@@ -71427,8 +71441,8 @@ function createTypeChecker(host) {
71427
71441
  }
71428
71442
  }
71429
71443
  }
71430
- function isEvalNode(node) {
71431
- return node.kind === 79 /* Identifier */ && node.escapedText === "eval";
71444
+ function isIndirectCall(node) {
71445
+ return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) && (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
71432
71446
  }
71433
71447
  function checkForDisallowedESSymbolOperand(operator2) {
71434
71448
  const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
@@ -71992,15 +72006,16 @@ function createTypeChecker(host) {
71992
72006
  }
71993
72007
  }
71994
72008
  expr = skipParentheses(node);
72009
+ if (isAwaitExpression(expr)) {
72010
+ const type = getQuickTypeOfExpression(expr.expression);
72011
+ return type ? getAwaitedType(type) : void 0;
72012
+ }
71995
72013
  if (isCallExpression(expr) && expr.expression.kind !== 106 /* SuperKeyword */ && !isRequireCall(
71996
72014
  expr,
71997
72015
  /*checkArgumentIsStringLiteralLike*/
71998
72016
  true
71999
72017
  ) && !isSymbolOrSymbolForCall(expr)) {
72000
- const type = isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
72001
- if (type) {
72002
- return type;
72003
- }
72018
+ return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
72004
72019
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
72005
72020
  return getTypeFromTypeNode(expr.type);
72006
72021
  } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
@@ -77167,12 +77182,12 @@ function createTypeChecker(host) {
77167
77182
  if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) {
77168
77183
  grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
77169
77184
  }
77170
- if (node.isExportEquals && !(node.flags & 16777216 /* Ambient */)) {
77171
- if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */) {
77185
+ if (node.isExportEquals) {
77186
+ if (moduleKind >= 5 /* ES2015 */ && (node.flags & 16777216 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 16777216 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
77172
77187
  grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
77173
- } else if (moduleKind === 4 /* System */) {
77188
+ } else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
77174
77189
  grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
77175
- } else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
77190
+ } else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
77176
77191
  grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
77177
77192
  }
77178
77193
  }
@@ -110690,7 +110705,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
110690
110705
  currentNodeModulesDepth++;
110691
110706
  }
110692
110707
  const elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
110693
- const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
110708
+ const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution, file) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */));
110694
110709
  if (elideImport) {
110695
110710
  modulesWithElidedImports.set(file.path, true);
110696
110711
  } else if (shouldAddFile) {
@@ -111033,7 +111048,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
111033
111048
  if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
111034
111049
  createOptionValueDiagnostic("importsNotUsedAsValues", Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later);
111035
111050
  }
111036
- if (options.allowImportingTsExtensions && !(moduleResolutionSupportsResolvingTsExtensions(options) && (options.noEmit || options.emitDeclarationOnly))) {
111051
+ if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
111037
111052
  createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_either_noEmit_or_emitDeclarationOnly_is_set);
111038
111053
  }
111039
111054
  const moduleResolution = getEmitModuleResolutionKind(options);
@@ -111685,19 +111700,27 @@ function resolveProjectReferencePath(hostOrRef, ref) {
111685
111700
  const passedInRef = ref ? ref : hostOrRef;
111686
111701
  return resolveConfigFileProjectName(passedInRef.path);
111687
111702
  }
111688
- function getResolutionDiagnostic(options, { extension }) {
111703
+ function getResolutionDiagnostic(options, { extension }, { isDeclarationFile }) {
111689
111704
  switch (extension) {
111690
111705
  case ".ts" /* Ts */:
111691
111706
  case ".d.ts" /* Dts */:
111707
+ case ".mts" /* Mts */:
111708
+ case ".d.mts" /* Dmts */:
111709
+ case ".cts" /* Cts */:
111710
+ case ".d.cts" /* Dcts */:
111692
111711
  return void 0;
111693
111712
  case ".tsx" /* Tsx */:
111694
111713
  return needJsx();
111695
111714
  case ".jsx" /* Jsx */:
111696
111715
  return needJsx() || needAllowJs();
111697
111716
  case ".js" /* Js */:
111717
+ case ".mjs" /* Mjs */:
111718
+ case ".cjs" /* Cjs */:
111698
111719
  return needAllowJs();
111699
111720
  case ".json" /* Json */:
111700
111721
  return needResolveJsonModule();
111722
+ default:
111723
+ return needAllowArbitraryExtensions();
111701
111724
  }
111702
111725
  function needJsx() {
111703
111726
  return options.jsx ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set;
@@ -111708,6 +111731,9 @@ function getResolutionDiagnostic(options, { extension }) {
111708
111731
  function needResolveJsonModule() {
111709
111732
  return getResolveJsonModule(options) ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used;
111710
111733
  }
111734
+ function needAllowArbitraryExtensions() {
111735
+ return isDeclarationFile || options.allowArbitraryExtensions ? void 0 : Diagnostics.Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set;
111736
+ }
111711
111737
  }
111712
111738
  function getModuleNames({ imports, moduleAugmentations }) {
111713
111739
  const res = imports.map((i) => i);