@typescript-deploys/pr-build 4.9.0-pr-50306-2 → 4.9.0-pr-50309-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
@@ -1005,6 +1005,10 @@ var ts;
1005
1005
  : undefined;
1006
1006
  }
1007
1007
  ts.singleOrUndefined = singleOrUndefined;
1008
+ function single(array) {
1009
+ return ts.Debug.checkDefined(singleOrUndefined(array));
1010
+ }
1011
+ ts.single = single;
1008
1012
  function singleOrMany(array) {
1009
1013
  return array && array.length === 1
1010
1014
  ? array[0]
@@ -4456,6 +4460,7 @@ var ts;
4456
4460
  ts.sys = (function () {
4457
4461
  var byteOrderMarkIndicator = "\uFEFF";
4458
4462
  function getNodeSystem() {
4463
+ var _a;
4459
4464
  var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
4460
4465
  var _fs = require("fs");
4461
4466
  var _path = require("path");
@@ -4464,7 +4469,7 @@ var ts;
4464
4469
  try {
4465
4470
  _crypto = require("crypto");
4466
4471
  }
4467
- catch (_a) {
4472
+ catch (_b) {
4468
4473
  _crypto = undefined;
4469
4474
  }
4470
4475
  var activeSession;
@@ -4475,10 +4480,10 @@ var ts;
4475
4480
  var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4476
4481
  var platform = _os.platform();
4477
4482
  var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
4478
- var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
4483
+ var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
4479
4484
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
4480
4485
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
4481
- var _b = createSystemWatchFunctions({
4486
+ var _c = createSystemWatchFunctions({
4482
4487
  pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
4483
4488
  getModifiedTime: getModifiedTime,
4484
4489
  setTimeout: setTimeout,
@@ -4496,7 +4501,7 @@ var ts;
4496
4501
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
4497
4502
  inodeWatching: isLinuxOrMacOs,
4498
4503
  sysLog: sysLog,
4499
- }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
4504
+ }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
4500
4505
  var nodeSystem = {
4501
4506
  args: process.argv.slice(2),
4502
4507
  newLine: _os.EOL,
@@ -4846,12 +4851,9 @@ var ts;
4846
4851
  function getDirectories(path) {
4847
4852
  return getAccessibleFileSystemEntries(path).directories.slice();
4848
4853
  }
4849
- function fsRealPathHandlingLongPath(path) {
4850
- return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
4851
- }
4852
4854
  function realpath(path) {
4853
4855
  try {
4854
- return fsRealpath(path);
4856
+ return realpathSync(path);
4855
4857
  }
4856
4858
  catch (_a) {
4857
4859
  return path;
@@ -6059,7 +6061,7 @@ var ts;
6059
6061
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."),
6060
6062
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."),
6061
6063
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."),
6062
- This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
6064
+ This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594", "This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag."),
6063
6065
  _0_can_only_be_imported_by_using_a_default_import: diag(2595, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_default_import_2595", "'{0}' can only be imported by using a default import."),
6064
6066
  _0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2596, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596", "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."),
6065
6067
  _0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import: diag(2597, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597", "'{0}' can only be imported by using a 'require' call or by using a default import."),
@@ -14167,7 +14169,7 @@ var ts;
14167
14169
  }
14168
14170
  diagnostics = nonFileDiagnostics;
14169
14171
  }
14170
- ts.insertSorted(diagnostics, diagnostic, compareDiagnostics);
14172
+ ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation);
14171
14173
  }
14172
14174
  function getGlobalDiagnostics() {
14173
14175
  hasReadNonFileDiagnostics = true;
@@ -41939,7 +41941,7 @@ var ts;
41939
41941
  var exportAssignment = exportEqualsSymbol.valueDeclaration;
41940
41942
  var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
41941
41943
  if (exportAssignment) {
41942
- ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
41944
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
41943
41945
  }
41944
41946
  }
41945
41947
  else {
package/lib/tsserver.js CHANGED
@@ -1163,6 +1163,13 @@ var ts;
1163
1163
  : undefined;
1164
1164
  }
1165
1165
  ts.singleOrUndefined = singleOrUndefined;
1166
+ /**
1167
+ * Returns the only element of an array if it contains only one element; throws otherwise.
1168
+ */
1169
+ function single(array) {
1170
+ return ts.Debug.checkDefined(singleOrUndefined(array));
1171
+ }
1172
+ ts.single = single;
1166
1173
  function singleOrMany(array) {
1167
1174
  return array && array.length === 1
1168
1175
  ? array[0]
@@ -7030,6 +7037,7 @@ var ts;
7030
7037
  // not actually work.
7031
7038
  var byteOrderMarkIndicator = "\uFEFF";
7032
7039
  function getNodeSystem() {
7040
+ var _a;
7033
7041
  var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
7034
7042
  var _fs = require("fs");
7035
7043
  var _path = require("path");
@@ -7039,7 +7047,7 @@ var ts;
7039
7047
  try {
7040
7048
  _crypto = require("crypto");
7041
7049
  }
7042
- catch (_a) {
7050
+ catch (_b) {
7043
7051
  _crypto = undefined;
7044
7052
  }
7045
7053
  var activeSession;
@@ -7050,10 +7058,10 @@ var ts;
7050
7058
  var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
7051
7059
  var platform = _os.platform();
7052
7060
  var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
7053
- var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
7061
+ var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
7054
7062
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7055
7063
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7056
- var _b = createSystemWatchFunctions({
7064
+ var _c = createSystemWatchFunctions({
7057
7065
  pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7058
7066
  getModifiedTime: getModifiedTime,
7059
7067
  setTimeout: setTimeout,
@@ -7073,7 +7081,7 @@ var ts;
7073
7081
  defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
7074
7082
  inodeWatching: isLinuxOrMacOs,
7075
7083
  sysLog: sysLog,
7076
- }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
7084
+ }), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
7077
7085
  var nodeSystem = {
7078
7086
  args: process.argv.slice(2),
7079
7087
  newLine: _os.EOL,
@@ -7466,12 +7474,9 @@ var ts;
7466
7474
  function getDirectories(path) {
7467
7475
  return getAccessibleFileSystemEntries(path).directories.slice();
7468
7476
  }
7469
- function fsRealPathHandlingLongPath(path) {
7470
- return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
7471
- }
7472
7477
  function realpath(path) {
7473
7478
  try {
7474
- return fsRealpath(path);
7479
+ return realpathSync(path);
7475
7480
  }
7476
7481
  catch (_a) {
7477
7482
  return path;
@@ -8901,7 +8906,7 @@ var ts;
8901
8906
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."),
8902
8907
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."),
8903
8908
  Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."),
8904
- This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
8909
+ This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594", "This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag."),
8905
8910
  _0_can_only_be_imported_by_using_a_default_import: diag(2595, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_default_import_2595", "'{0}' can only be imported by using a default import."),
8906
8911
  _0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2596, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596", "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."),
8907
8912
  _0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import: diag(2597, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597", "'{0}' can only be imported by using a 'require' call or by using a default import."),
@@ -18128,7 +18133,7 @@ var ts;
18128
18133
  }
18129
18134
  diagnostics = nonFileDiagnostics;
18130
18135
  }
18131
- ts.insertSorted(diagnostics, diagnostic, compareDiagnostics);
18136
+ ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation);
18132
18137
  }
18133
18138
  function getGlobalDiagnostics() {
18134
18139
  hasReadNonFileDiagnostics = true;
@@ -51055,7 +51060,7 @@ var ts;
51055
51060
  var exportAssignment = exportEqualsSymbol.valueDeclaration;
51056
51061
  var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
51057
51062
  if (exportAssignment) {
51058
- ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
51063
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
51059
51064
  }
51060
51065
  }
51061
51066
  else {
@@ -138495,6 +138500,8 @@ var ts;
138495
138500
  // Similarly, skip past the symbol for 'export ='
138496
138501
  if (importedSymbol.escapedName === "export=") {
138497
138502
  importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker);
138503
+ if (importedSymbol === undefined)
138504
+ return undefined;
138498
138505
  }
138499
138506
  // If the import has a different name than the export, do not continue searching.
138500
138507
  // If `importedName` is undefined, do continue searching as the export is anonymous.
@@ -138516,19 +138523,19 @@ var ts;
138516
138523
  FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol;
138517
138524
  function getExportEqualsLocalSymbol(importedSymbol, checker) {
138518
138525
  if (importedSymbol.flags & 2097152 /* Alias */) {
138519
- return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol));
138526
+ return checker.getImmediateAliasedSymbol(importedSymbol);
138520
138527
  }
138521
138528
  var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration);
138522
138529
  if (ts.isExportAssignment(decl)) { // `export = class {}`
138523
- return ts.Debug.checkDefined(decl.expression.symbol);
138530
+ return decl.expression.symbol;
138524
138531
  }
138525
138532
  else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}`
138526
- return ts.Debug.checkDefined(decl.right.symbol);
138533
+ return decl.right.symbol;
138527
138534
  }
138528
138535
  else if (ts.isSourceFile(decl)) { // json module
138529
- return ts.Debug.checkDefined(decl.symbol);
138536
+ return decl.symbol;
138530
138537
  }
138531
- return ts.Debug.fail();
138538
+ return undefined;
138532
138539
  }
138533
138540
  // If a reference is a class expression, the exported node would be its parent.
138534
138541
  // If a reference is a variable declaration, the exported node would be the variable statement.
@@ -154805,13 +154812,15 @@ var ts;
154805
154812
  errorCodes: errorCodes,
154806
154813
  getCodeActions: function (context) {
154807
154814
  var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program;
154808
- var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true);
154815
+ var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true);
154809
154816
  if (!info)
154810
154817
  return undefined;
154811
- var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText;
154812
154818
  var quotePreference = ts.getQuotePreference(sourceFile, preferences);
154813
- return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix,
154814
- /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); });
154819
+ return info.map(function (_a) {
154820
+ var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText;
154821
+ return codeActionForFix(context, sourceFile, symbolName, fix,
154822
+ /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions());
154823
+ });
154815
154824
  },
154816
154825
  fixIds: [importFixId],
154817
154826
  getAllCodeActions: function (context) {
@@ -154836,10 +154845,10 @@ var ts;
154836
154845
  var newImports = new ts.Map();
154837
154846
  return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
154838
154847
  function addImportFromDiagnostic(diagnostic, context) {
154839
- var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
154840
- if (!info || !info.fixes.length)
154848
+ var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
154849
+ if (!info || !info.length)
154841
154850
  return;
154842
- addImport(info);
154851
+ addImport(ts.first(info));
154843
154852
  }
154844
154853
  function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) {
154845
154854
  var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent);
@@ -154850,13 +154859,12 @@ var ts;
154850
154859
  var useRequire = shouldUseRequire(sourceFile, program);
154851
154860
  var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
154852
154861
  if (fix) {
154853
- addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
154862
+ addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined });
154854
154863
  }
154855
154864
  }
154856
154865
  function addImport(info) {
154857
154866
  var _a, _b;
154858
- var fixes = info.fixes, symbolName = info.symbolName;
154859
- var fix = ts.first(fixes);
154867
+ var fix = info.fix, symbolName = info.symbolName;
154860
154868
  switch (fix.kind) {
154861
154869
  case 0 /* UseNamespace */:
154862
154870
  addToNamespace.push(fix);
@@ -155040,7 +155048,7 @@ var ts;
155040
155048
  codefix.getImportCompletionAction = getImportCompletionAction;
155041
155049
  function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
155042
155050
  var compilerOptions = program.getCompilerOptions();
155043
- var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions);
155051
+ var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
155044
155052
  var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
155045
155053
  var includeSymbolNameInDescription = symbolName !== symbolToken.text;
155046
155054
  return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
@@ -155345,7 +155353,7 @@ var ts;
155345
155353
  return { kind: 3 /* AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire };
155346
155354
  }
155347
155355
  }
155348
- function getFixesInfo(context, errorCode, pos, useAutoImportProvider) {
155356
+ function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
155349
155357
  var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
155350
155358
  var info;
155351
155359
  if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
@@ -155355,19 +155363,23 @@ var ts;
155355
155363
  return undefined;
155356
155364
  }
155357
155365
  else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
155358
- var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions());
155366
+ var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()));
155359
155367
  var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
155360
- return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text };
155368
+ return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }];
155361
155369
  }
155362
155370
  else {
155363
155371
  info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
155364
155372
  }
155365
155373
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
155366
- return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) });
155374
+ return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
155367
155375
  }
155368
- function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) {
155376
+ function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) {
155369
155377
  var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); };
155370
- return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); });
155378
+ return ts.sort(fixes, function (a, b) {
155379
+ return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) ||
155380
+ ts.compareValues(a.fix.kind, b.fix.kind) ||
155381
+ compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath);
155382
+ });
155371
155383
  }
155372
155384
  function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
155373
155385
  if (!ts.some(fixes))
@@ -155418,7 +155430,6 @@ var ts;
155418
155430
  return 0 /* EqualTo */;
155419
155431
  }
155420
155432
  function getFixesInfoForUMDImport(_a, token) {
155421
- var _b;
155422
155433
  var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences;
155423
155434
  var checker = program.getTypeChecker();
155424
155435
  var umdSymbol = getUmdSymbol(token, checker);
@@ -155430,7 +155441,7 @@ var ts;
155430
155441
  var useRequire = shouldUseRequire(sourceFile, program);
155431
155442
  var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
155432
155443
  var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
155433
- return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
155444
+ return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); });
155434
155445
  }
155435
155446
  function getUmdSymbol(token, checker) {
155436
155447
  // try the identifier to see if it is the umd symbol
@@ -155491,19 +155502,20 @@ var ts;
155491
155502
  var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences;
155492
155503
  var checker = program.getTypeChecker();
155493
155504
  var compilerOptions = program.getCompilerOptions();
155494
- var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions);
155495
- // "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
155496
- if (symbolName === "default" /* Default */) {
155497
- return undefined;
155498
- }
155499
- var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
155500
- var useRequire = shouldUseRequire(sourceFile, program);
155501
- var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
155502
- var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
155503
- var _ = _a[0], exportInfos = _a[1];
155504
- return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
155505
- }));
155506
- return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text };
155505
+ return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) {
155506
+ // "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
155507
+ if (symbolName === "default" /* Default */) {
155508
+ return undefined;
155509
+ }
155510
+ var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
155511
+ var useRequire = shouldUseRequire(sourceFile, program);
155512
+ var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
155513
+ var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
155514
+ var _ = _a[0], exportInfos = _a[1];
155515
+ return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
155516
+ }));
155517
+ return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); });
155518
+ });
155507
155519
  }
155508
155520
  function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
155509
155521
  var checker = program.getTypeChecker();
@@ -155515,15 +155527,16 @@ var ts;
155515
155527
  return undefined;
155516
155528
  return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
155517
155529
  }
155518
- function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) {
155530
+ function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) {
155519
155531
  var parent = symbolToken.parent;
155520
155532
  if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
155521
155533
  var jsxNamespace = checker.getJsxNamespace(sourceFile);
155522
155534
  if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
155523
- return jsxNamespace;
155535
+ var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* Value */, /*excludeGlobals*/ false);
155536
+ return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace];
155524
155537
  }
155525
155538
  }
155526
- return symbolToken.text;
155539
+ return [symbolToken.text];
155527
155540
  }
155528
155541
  function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
155529
155542
  if (ts.isIntrinsicJsxName(symbolToken.text))