typescript 4.7.0-dev.20220506 → 4.8.0-dev.20220509

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.
@@ -290,11 +290,11 @@ var ts;
290
290
  (function (ts) {
291
291
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
292
292
  // If changing the text in this section, be sure to test `configurePrerelease` too.
293
- ts.versionMajorMinor = "4.7";
293
+ ts.versionMajorMinor = "4.8";
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220506";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220509";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -9194,6 +9194,7 @@ var ts;
9194
9194
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
9195
9195
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
9196
9196
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
9197
+ Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts.DiagnosticCategory.Error, "Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
9197
9198
  The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
9198
9199
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
9199
9200
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -18200,6 +18201,10 @@ var ts;
18200
18201
  return indentStrings[1].length;
18201
18202
  }
18202
18203
  ts.getIndentSize = getIndentSize;
18204
+ function isNightly() {
18205
+ return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
18206
+ }
18207
+ ts.isNightly = isNightly;
18203
18208
  function createTextWriter(newLine) {
18204
18209
  var output;
18205
18210
  var indent;
@@ -33047,6 +33052,7 @@ var ts;
33047
33052
  var startPos = scanner.getStartPos();
33048
33053
  var result = parseListElement(kind, parseElement);
33049
33054
  if (!result) {
33055
+ parsingContext = saveParsingContext;
33050
33056
  return undefined;
33051
33057
  }
33052
33058
  list.push(result);
@@ -85189,6 +85195,9 @@ var ts;
85189
85195
  var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
85190
85196
  var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
85191
85197
  if (validForTypeAssertions && override) {
85198
+ if (!ts.isNightly()) {
85199
+ grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
85200
+ }
85192
85201
  if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
85193
85202
  return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
85194
85203
  }
@@ -108587,34 +108596,44 @@ var ts;
108587
108596
  if (!decl.importClause) {
108588
108597
  // import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
108589
108598
  return factory.updateImportDeclaration(decl,
108590
- /*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108599
+ /*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108591
108600
  }
108592
108601
  // The `importClause` visibility corresponds to the default's visibility.
108593
108602
  var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
108594
108603
  if (!decl.importClause.namedBindings) {
108595
108604
  // No named bindings (either namespace or list), meaning the import is just default or should be elided
108596
108605
  return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
108597
- /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108606
+ /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108598
108607
  }
108599
108608
  if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
108600
108609
  // Namespace import (optionally with visible default)
108601
108610
  var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
108602
- return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined) : undefined;
108611
+ return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
108603
108612
  }
108604
108613
  // Named imports (optionally with visible default)
108605
108614
  var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
108606
108615
  if ((bindingList && bindingList.length) || visibleDefaultBinding) {
108607
108616
  return factory.updateImportDeclaration(decl,
108608
- /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108617
+ /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108609
108618
  }
108610
108619
  // Augmentation of export depends on import
108611
108620
  if (resolver.isImportRequiredByAugmentation(decl)) {
108612
108621
  return factory.updateImportDeclaration(decl,
108613
108622
  /*decorators*/ undefined, decl.modifiers,
108614
- /*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108623
+ /*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108615
108624
  }
108616
108625
  // Nothing visible
108617
108626
  }
108627
+ function getResolutionModeOverrideForClauseInNightly(assertClause) {
108628
+ var mode = ts.getResolutionModeOverrideForClause(assertClause);
108629
+ if (mode !== undefined) {
108630
+ if (!ts.isNightly()) {
108631
+ context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
108632
+ }
108633
+ return assertClause;
108634
+ }
108635
+ return undefined;
108636
+ }
108618
108637
  function transformAndReplaceLatePaintedStatements(statements) {
108619
108638
  // This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
108620
108639
  // error handling which must now be included in the output and themselves checked for errors.
@@ -121922,14 +121941,14 @@ var ts;
121922
121941
  if (options === void 0) { options = {}; }
121923
121942
  var info = getInfo(importingSourceFile.path, host);
121924
121943
  var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
121925
- return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
121944
+ return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
121926
121945
  }
121927
121946
  moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
121928
121947
  function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
121929
121948
  if (options === void 0) { options = {}; }
121930
121949
  var info = getInfo(importingSourceFileName, host);
121931
121950
  var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
121932
- return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
121951
+ return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
121933
121952
  getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
121934
121953
  }
121935
121954
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
@@ -122005,7 +122024,7 @@ var ts;
122005
122024
  var relativeSpecifiers;
122006
122025
  for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
122007
122026
  var modulePath = modulePaths_1[_i];
122008
- var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
122027
+ var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
122009
122028
  nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
122010
122029
  if (specifier && modulePath.isRedirect) {
122011
122030
  // If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
@@ -122398,7 +122417,7 @@ var ts;
122398
122417
  ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
122399
122418
  : ts.removeFileExtension(relativePath);
122400
122419
  }
122401
- function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
122420
+ function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
122402
122421
  var path = _a.path, isRedirect = _a.isRedirect;
122403
122422
  var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
122404
122423
  if (!host.fileExists || !host.readFile) {
@@ -122412,8 +122431,9 @@ var ts;
122412
122431
  var moduleSpecifier = path;
122413
122432
  var isPackageRootPath = false;
122414
122433
  if (!packageNameOnly) {
122434
+ var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
122415
122435
  var packageRootIndex = parts.packageRootIndex;
122416
- var moduleFileNameForExtensionless = void 0;
122436
+ var moduleFileName = void 0;
122417
122437
  while (true) {
122418
122438
  // If the module could be imported by a directory name, use that directory's name
122419
122439
  var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
@@ -122430,12 +122450,12 @@ var ts;
122430
122450
  isPackageRootPath = true;
122431
122451
  break;
122432
122452
  }
122433
- if (!moduleFileNameForExtensionless)
122434
- moduleFileNameForExtensionless = moduleFileToTry;
122453
+ if (!moduleFileName)
122454
+ moduleFileName = moduleFileToTry;
122435
122455
  // try with next level of directory
122436
122456
  packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
122437
122457
  if (packageRootIndex === -1) {
122438
- moduleSpecifier = getExtensionlessFileName(moduleFileNameForExtensionless);
122458
+ moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
122439
122459
  break;
122440
122460
  }
122441
122461
  }
@@ -122493,7 +122513,7 @@ var ts;
122493
122513
  }
122494
122514
  }
122495
122515
  // If the file is the main module, it can be imported by the package name
122496
- var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
122516
+ var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
122497
122517
  if (ts.isString(mainFileRelative)) {
122498
122518
  var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
122499
122519
  if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
@@ -122501,17 +122521,14 @@ var ts;
122501
122521
  }
122502
122522
  }
122503
122523
  }
122504
- return { moduleFileToTry: moduleFileToTry };
122505
- }
122506
- function getExtensionlessFileName(path) {
122507
- // We still have a file name - remove the extension
122508
- var fullModulePathWithoutExtension = ts.removeFileExtension(path);
122509
- // If the file is /index, it can be imported by its directory name
122510
- // IFF there is not _also_ a file by the same name
122511
- if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
122512
- return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
122524
+ else {
122525
+ // No package.json exists; an index.js will still resolve as the package name
122526
+ var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
122527
+ if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
122528
+ return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
122529
+ }
122513
122530
  }
122514
- return fullModulePathWithoutExtension;
122531
+ return { moduleFileToTry: moduleFileToTry };
122515
122532
  }
122516
122533
  }
122517
122534
  function tryGetAnyFileFromPath(host, path) {
@@ -122533,7 +122550,7 @@ var ts;
122533
122550
  return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
122534
122551
  });
122535
122552
  }
122536
- function removeExtensionAndIndexPostFix(fileName, ending, options) {
122553
+ function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
122537
122554
  if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
122538
122555
  return fileName;
122539
122556
  var noExtension = ts.removeFileExtension(fileName);
@@ -122541,7 +122558,13 @@ var ts;
122541
122558
  return noExtension + getJSExtensionForFile(fileName, options);
122542
122559
  switch (ending) {
122543
122560
  case 0 /* Minimal */:
122544
- return ts.removeSuffix(noExtension, "/index");
122561
+ var withoutIndex = ts.removeSuffix(noExtension, "/index");
122562
+ if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
122563
+ // Can't remove index if there's a file by the same name as the directory.
122564
+ // Probably more callers should pass `host` so we can determine this?
122565
+ return noExtension;
122566
+ }
122567
+ return withoutIndex;
122545
122568
  case 1 /* Index */:
122546
122569
  return noExtension;
122547
122570
  case 2 /* JsExtension */:
@@ -85,11 +85,11 @@ var ts;
85
85
  (function (ts) {
86
86
  // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
87
87
  // If changing the text in this section, be sure to test `configurePrerelease` too.
88
- ts.versionMajorMinor = "4.7";
88
+ ts.versionMajorMinor = "4.8";
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220506";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220509";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8989,6 +8989,7 @@ var ts;
8989
8989
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
8990
8990
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
8991
8991
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
8992
+ Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts.DiagnosticCategory.Error, "Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
8992
8993
  The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
8993
8994
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
8994
8995
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -17995,6 +17996,10 @@ var ts;
17995
17996
  return indentStrings[1].length;
17996
17997
  }
17997
17998
  ts.getIndentSize = getIndentSize;
17999
+ function isNightly() {
18000
+ return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
18001
+ }
18002
+ ts.isNightly = isNightly;
17998
18003
  function createTextWriter(newLine) {
17999
18004
  var output;
18000
18005
  var indent;
@@ -32842,6 +32847,7 @@ var ts;
32842
32847
  var startPos = scanner.getStartPos();
32843
32848
  var result = parseListElement(kind, parseElement);
32844
32849
  if (!result) {
32850
+ parsingContext = saveParsingContext;
32845
32851
  return undefined;
32846
32852
  }
32847
32853
  list.push(result);
@@ -84984,6 +84990,9 @@ var ts;
84984
84990
  var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
84985
84991
  var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
84986
84992
  if (validForTypeAssertions && override) {
84993
+ if (!ts.isNightly()) {
84994
+ grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
84995
+ }
84987
84996
  if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
84988
84997
  return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
84989
84998
  }
@@ -108382,34 +108391,44 @@ var ts;
108382
108391
  if (!decl.importClause) {
108383
108392
  // import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
108384
108393
  return factory.updateImportDeclaration(decl,
108385
- /*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108394
+ /*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108386
108395
  }
108387
108396
  // The `importClause` visibility corresponds to the default's visibility.
108388
108397
  var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
108389
108398
  if (!decl.importClause.namedBindings) {
108390
108399
  // No named bindings (either namespace or list), meaning the import is just default or should be elided
108391
108400
  return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
108392
- /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108401
+ /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108393
108402
  }
108394
108403
  if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
108395
108404
  // Namespace import (optionally with visible default)
108396
108405
  var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
108397
- return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined) : undefined;
108406
+ return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
108398
108407
  }
108399
108408
  // Named imports (optionally with visible default)
108400
108409
  var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
108401
108410
  if ((bindingList && bindingList.length) || visibleDefaultBinding) {
108402
108411
  return factory.updateImportDeclaration(decl,
108403
- /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108412
+ /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108404
108413
  }
108405
108414
  // Augmentation of export depends on import
108406
108415
  if (resolver.isImportRequiredByAugmentation(decl)) {
108407
108416
  return factory.updateImportDeclaration(decl,
108408
108417
  /*decorators*/ undefined, decl.modifiers,
108409
- /*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), ts.getResolutionModeOverrideForClause(decl.assertClause) ? decl.assertClause : undefined);
108418
+ /*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
108410
108419
  }
108411
108420
  // Nothing visible
108412
108421
  }
108422
+ function getResolutionModeOverrideForClauseInNightly(assertClause) {
108423
+ var mode = ts.getResolutionModeOverrideForClause(assertClause);
108424
+ if (mode !== undefined) {
108425
+ if (!ts.isNightly()) {
108426
+ context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
108427
+ }
108428
+ return assertClause;
108429
+ }
108430
+ return undefined;
108431
+ }
108413
108432
  function transformAndReplaceLatePaintedStatements(statements) {
108414
108433
  // This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
108415
108434
  // error handling which must now be included in the output and themselves checked for errors.
@@ -121717,14 +121736,14 @@ var ts;
121717
121736
  if (options === void 0) { options = {}; }
121718
121737
  var info = getInfo(importingSourceFile.path, host);
121719
121738
  var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
121720
- return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
121739
+ return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
121721
121740
  }
121722
121741
  moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
121723
121742
  function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
121724
121743
  if (options === void 0) { options = {}; }
121725
121744
  var info = getInfo(importingSourceFileName, host);
121726
121745
  var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
121727
- return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
121746
+ return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
121728
121747
  getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
121729
121748
  }
121730
121749
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
@@ -121800,7 +121819,7 @@ var ts;
121800
121819
  var relativeSpecifiers;
121801
121820
  for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
121802
121821
  var modulePath = modulePaths_1[_i];
121803
- var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
121822
+ var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
121804
121823
  nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
121805
121824
  if (specifier && modulePath.isRedirect) {
121806
121825
  // If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
@@ -122193,7 +122212,7 @@ var ts;
122193
122212
  ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
122194
122213
  : ts.removeFileExtension(relativePath);
122195
122214
  }
122196
- function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
122215
+ function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
122197
122216
  var path = _a.path, isRedirect = _a.isRedirect;
122198
122217
  var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
122199
122218
  if (!host.fileExists || !host.readFile) {
@@ -122207,8 +122226,9 @@ var ts;
122207
122226
  var moduleSpecifier = path;
122208
122227
  var isPackageRootPath = false;
122209
122228
  if (!packageNameOnly) {
122229
+ var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
122210
122230
  var packageRootIndex = parts.packageRootIndex;
122211
- var moduleFileNameForExtensionless = void 0;
122231
+ var moduleFileName = void 0;
122212
122232
  while (true) {
122213
122233
  // If the module could be imported by a directory name, use that directory's name
122214
122234
  var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
@@ -122225,12 +122245,12 @@ var ts;
122225
122245
  isPackageRootPath = true;
122226
122246
  break;
122227
122247
  }
122228
- if (!moduleFileNameForExtensionless)
122229
- moduleFileNameForExtensionless = moduleFileToTry;
122248
+ if (!moduleFileName)
122249
+ moduleFileName = moduleFileToTry;
122230
122250
  // try with next level of directory
122231
122251
  packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
122232
122252
  if (packageRootIndex === -1) {
122233
- moduleSpecifier = getExtensionlessFileName(moduleFileNameForExtensionless);
122253
+ moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
122234
122254
  break;
122235
122255
  }
122236
122256
  }
@@ -122288,7 +122308,7 @@ var ts;
122288
122308
  }
122289
122309
  }
122290
122310
  // If the file is the main module, it can be imported by the package name
122291
- var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
122311
+ var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
122292
122312
  if (ts.isString(mainFileRelative)) {
122293
122313
  var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
122294
122314
  if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
@@ -122296,17 +122316,14 @@ var ts;
122296
122316
  }
122297
122317
  }
122298
122318
  }
122299
- return { moduleFileToTry: moduleFileToTry };
122300
- }
122301
- function getExtensionlessFileName(path) {
122302
- // We still have a file name - remove the extension
122303
- var fullModulePathWithoutExtension = ts.removeFileExtension(path);
122304
- // If the file is /index, it can be imported by its directory name
122305
- // IFF there is not _also_ a file by the same name
122306
- if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
122307
- return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
122319
+ else {
122320
+ // No package.json exists; an index.js will still resolve as the package name
122321
+ var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
122322
+ if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
122323
+ return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
122324
+ }
122308
122325
  }
122309
- return fullModulePathWithoutExtension;
122326
+ return { moduleFileToTry: moduleFileToTry };
122310
122327
  }
122311
122328
  }
122312
122329
  function tryGetAnyFileFromPath(host, path) {
@@ -122328,7 +122345,7 @@ var ts;
122328
122345
  return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
122329
122346
  });
122330
122347
  }
122331
- function removeExtensionAndIndexPostFix(fileName, ending, options) {
122348
+ function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
122332
122349
  if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
122333
122350
  return fileName;
122334
122351
  var noExtension = ts.removeFileExtension(fileName);
@@ -122336,7 +122353,13 @@ var ts;
122336
122353
  return noExtension + getJSExtensionForFile(fileName, options);
122337
122354
  switch (ending) {
122338
122355
  case 0 /* Minimal */:
122339
- return ts.removeSuffix(noExtension, "/index");
122356
+ var withoutIndex = ts.removeSuffix(noExtension, "/index");
122357
+ if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
122358
+ // Can't remove index if there's a file by the same name as the directory.
122359
+ // Probably more callers should pass `host` so we can determine this?
122360
+ return noExtension;
122361
+ }
122362
+ return withoutIndex;
122340
122363
  case 1 /* Index */:
122341
122364
  return noExtension;
122342
122365
  case 2 /* JsExtension */:
@@ -575,9 +575,9 @@
575
575
  "Duplicate_label_0_1114": "标签“{0}”重复。",
576
576
  "Duplicate_property_0_2718": "重复的属性 \"{0}\"。",
577
577
  "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036": "动态导入的说明符类型必须是 \"string\",但此处类型是 \"{0}\"。",
578
- "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323": "仅当 '--module' 标志设置为 'es2020'、'es2022'、'esnext'、 'commonjs'、'amd'、'system'、'umd'、'node12' 或 'nodenext' 时,才支持动态导入。",
578
+ "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323": "仅在将 “--module” 标记设置为 “es2020”、“es2022”、“esnext”、“commonjs”、“amd”、“system”、“umd”、“node16” 或 “nodenext” 时,才支持动态导入。",
579
579
  "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450": "动态导入只能接受模块说明符和可选断言作为参数",
580
- "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext_1324": "只有当 “--module” 选项设置为 “esnext” 或 “nodenext” 时,动态导入才支持第二个参数。",
580
+ "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324": "只有当 “--module” 选项设置为 “esnext”、 “node16” 或 “nodenext” 时,动态导入才支持第二个参数。",
581
581
  "Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_2762": "联合类型 \"{0}\" 的每个成员都有构造签名,但这些签名都不能互相兼容。",
582
582
  "Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_2758": "联合类型 \"{0}\" 的每个成员都有签名,但这些签名都不能互相兼容。",
583
583
  "Editor_Support_6249": "编辑器支持",
@@ -856,7 +856,6 @@
856
856
  "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021": "JSDoc \"@typedef\" 标记应具有类型注释,或其后跟有 \"@property\" 或 \"@member\" 标记。",
857
857
  "JSDoc_types_can_only_be_used_inside_documentation_comments_8020": "JSDoc 类型只能在文档注释内部使用。",
858
858
  "JSDoc_types_may_be_moved_to_TypeScript_types_80004": "JSDoc 类型可能会移到 TypeScript 类型。",
859
- "JSON_imports_are_experimental_in_ES_module_mode_imports_7062": "JSON 导入在 ES 模块模式导入中是实验性的。",
860
859
  "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000": "只能为 JSX 属性分配非空“表达式”。",
861
860
  "JSX_element_0_has_no_corresponding_closing_tag_17008": "JSX 元素“{0}”没有相应的结束标记。",
862
861
  "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607": "JSX 元素类不支持特性,因为它不具有“{0}”属性。",
@@ -1160,8 +1159,8 @@
1160
1159
  "Referenced_project_0_may_not_disable_emit_6310": "引用的项目“{0}”可能不会禁用发出。",
1161
1160
  "Referenced_project_0_must_have_setting_composite_Colon_true_6306": "引用的项目“{0}”必须拥有设置 \"composite\": true。",
1162
1161
  "Referenced_via_0_from_file_1_1400": "通过 \"{0}\" 从文件 \"{1}\" 引用",
1163
- "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834": "当 “--moduleResolution” 为 “node12” 或 “nodenext” 时,相对导入路径需要 EcmaScript 导入中的显式文件扩展名。请考虑将扩展名添加到导入路径中。",
1164
- "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835": "当 “--moduleResolution” 为 “node12” 或 “nodenext” 时,相对导入路径需要 EcmaScript 导入中的显式文件扩展名。你是否指的是“{0}”?",
1162
+ "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834": "当 “--moduleResolution” 为 “node16” 或 “nodenext” 时,相对导入路径需要 EcmaScript 导入中的显式文件扩展名。请考虑将扩展名添加到导入路径中。",
1163
+ "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835": "当 “--moduleResolution” 为 “node16” 或 “nodenext” 时,相对导入路径需要 EcmaScript 导入中的显式文件扩展名。你是否指的是“{0}”?",
1165
1164
  "Remove_a_list_of_directories_from_the_watch_process_6628": "从监视进程中删除目录列表。",
1166
1165
  "Remove_a_list_of_files_from_the_watch_mode_s_processing_6629": "从监视模式的处理中删除文件列表。",
1167
1166
  "Remove_all_unnecessary_override_modifiers_95163": "删除所有不必要的 \"override\" 修饰符",
@@ -1200,7 +1199,7 @@
1200
1199
  "Required_type_parameters_may_not_follow_optional_type_parameters_2706": "所需的类型参数可能不遵循可选类型参数。",
1201
1200
  "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "在位置“{1}”的缓存中找到模块“{0}”的解析。",
1202
1201
  "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "在位置“{1}”的缓存中找到类型引用指令“{0}”的解析。",
1203
- "Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext_1452": "仅当“moduleResolution”为“node12”或“nodenext”时才支持解析模式。",
1202
+ "Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452": "仅当 `moduleResolution` 为 `node16` 或 `nodenext` 时才支持解析模式。",
1204
1203
  "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "只将 \"keyof\" 解析为字符串值的属性名称(不含数字或符号)。",
1205
1204
  "Resolving_module_0_from_1_6086": "======== 正在从“{1}”解析模块“{0}”。========",
1206
1205
  "Resolving_module_name_0_relative_to_base_url_1_2_6094": "正在相对于基 URL“{1}”-“{2}”解析模块名“{0}”。",
@@ -1370,6 +1369,7 @@
1370
1369
  "The_character_set_of_the_input_files_6163": "输入文件的字符集。",
1371
1370
  "The_containing_arrow_function_captures_the_global_value_of_this_7041": "包含箭头函数捕获 \"this\" 的全局值。",
1372
1371
  "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "包含函数或模块体对于控制流分析而言太大。",
1372
+ "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "当前文件是 CommonJS 模块,因此不能在顶级使用 “await”。",
1373
1373
  "The_current_host_does_not_support_the_0_option_5001": "当前主机不支持“{0}”选项。",
1374
1374
  "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "你可能打算使用的 \"{0}\" 的声明在此处定义",
1375
1375
  "The_declaration_was_marked_as_deprecated_here_2798": "该声明曾在此处标记为已弃用。",
@@ -1384,7 +1384,7 @@
1384
1384
  "The_global_type_JSX_0_may_not_have_more_than_one_property_2608": "全局类型 \"JSX.{0}\" 不可具有多个属性。",
1385
1385
  "The_implementation_signature_is_declared_here_2750": "在此处声明实现签名。",
1386
1386
  "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470": "将生成到 CommonJS 输出的文件中不允许 'import.meta' 元属性。",
1387
- "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343": "仅当 '--module' 选项为 'es2020'、'es2022'、'esnext'、 'system'、'node12' 或 'nodenext' 时,才允许 'import.meta' 元属性。",
1387
+ "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343": "仅当 “--module” 选项为 “es2020”、“es2022”、“esnext”、“system”、“node16” 或 “nodenext” 时,才允许使用 “import.meta” 元属性。",
1388
1388
  "The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_a_2742": "如果没有引用 \"{1}\",则无法命名 \"{0}\" 的推断类型。这很可能不可移植。需要类型注释。",
1389
1389
  "The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088": "推断类型“{0}”引用的类型具有无法简单序列化的循环结构。必须具有类型注释。",
1390
1390
  "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527": "“{0}”的推断类型引用不可访问的“{1}”类型。需要类型批注。",
@@ -1418,6 +1418,8 @@
1418
1418
  "The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access_2777": "增量或减量运算符的操作数不能是可选属性访问。",
1419
1419
  "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357": "递增或递减运算符的操作数必须是变量或属性访问。",
1420
1420
  "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007": "分析器预期在此处找到与“{0}”标记匹配的“{1}”。",
1421
+ "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209": "项目根不明确,但需要解析文件“{1}”中的导出映射项“{0}”。提供 `rootDir` 编译器选项以消除歧义。",
1422
+ "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210": "项目根不明确,但仍需要解析文件“{1}”中的导入映射项“{0}”。提供 `rootDir` 编译器选项以消除歧义。",
1421
1423
  "The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_priv_18014": "无法在此类中的类型 \"{1}\" 上访问属性 \"{0}\",因为具有相同拼写的另一个专用标识符隐藏了它。",
1422
1424
  "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380": "\"Get\" 访问器的返回类型必须可分配给其 \"Set\" 访问器类型",
1423
1425
  "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237": "参数修饰器函数的返回类型必须为 \"void\" 或 \"any\"。",
@@ -1483,11 +1485,10 @@
1483
1485
  "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354": "此语法需要一个导入的帮助程序,但找不到模块“{0}”。",
1484
1486
  "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343": "此语法需要名为 \"{1}\" 的导入帮助器,\"{0}\" 中不存在该帮助器。请考虑升级 \"{0}\" 的版本。",
1485
1487
  "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "此语法需要一个名为 \"{1}\" 且包含 {2} 参数的导入帮助程序,该帮助程序与 \"{0}\" 中的相应帮助程序不兼容。请考虑升级 \"{0}\" 的版本。",
1486
- "This_type_parameter_probably_needs_an_extends_object_constraint_2208": "此类型参数可能需要 \"extends object\" 约束。",
1487
1488
  "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "“import” 的这种用法无效。可以写入 “import()” 调用,但它们必须具有括号,并且不能带有类型参数。",
1488
- "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378": "仅当 'module' 选项设置为 'es2022'、'esnext'、'system' 或 'nodenext',且 'target' 选项设置为 'es2017' 或更高版本时,才允许顶级 'await' 表达式。",
1489
+ "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "仅当 “module” 选项设置为 “es2022”、“esnext”、“system”、“node16” 或 “nodenext”,且 “target” 选项设置为 “es2017” 或更高版本时,才允许使用顶级 “await” 表达式。",
1489
1490
  "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts 文件中的顶级声明必须以 \"declare\" 或 \"export\" 修饰符开头。",
1490
- "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432": "仅当 'module' 选项设置为 'es2022'、'esnext'、'system' 或 'nodenext',且 'target' 选项设置为 'es2017' 或更高版本时,才允许顶级 'for await' 循环。",
1491
+ "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "仅当 “module” 选项设置为 “es2022”、“esnext”、“system”、“node16” 或 “nodenext”,且 “target” 选项设置为 “es2017” 或更高版本时,才允许使用顶级 “for await” 循环。",
1491
1492
  "Trailing_comma_not_allowed_1009": "不允许使用尾随逗号。",
1492
1493
  "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153": "将每个文件转换为单独的模块(类似 \"ts.transpileModule\")。",
1493
1494
  "Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare__7035": "尝试使用 `npm i --save-dev @types/{1}` (如果存在),或者添加一个包含 `declare module '{0}';` 的新声明(.d.ts)文件",
@@ -1727,7 +1728,7 @@
1727
1728
  "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "\"abstract\" 修饰符仅可出现在类、方法或属性声明中。",
1728
1729
  "and_here_6204": "并在这里。",
1729
1730
  "arguments_cannot_be_referenced_in_property_initializers_2815": "无法在属性初始化表达式中引用 \"arguments\"。",
1730
- "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "“auto”: 将导入、导出、import.meta、jsx (带有 jsx: react-jsx)或 esm 格式(带模块: node12+)的文件视为模块。",
1731
+ "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "“auto”: 将带有导入、导出、import.meta、jsx (带有 jsx: react-jsx)或 esm 格式(带模块: node16+)的文件视为模块。",
1731
1732
  "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375": "仅当文件是模块时,才允许在该文件的顶层使用 \"await\" 表达式,但此文件没有导入或导出。请考虑添加空的 \"export {}\" 以将此文件变为模块。",
1732
1733
  "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308": "仅允许在异步函数和模块顶级使用 \"await\" 表达式。",
1733
1734
  "await_expressions_cannot_be_used_in_a_parameter_initializer_2524": "不能在参数初始化表达式中使用 \"await\" 表达式。",