@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 +13 -11
- package/lib/tsserver.js +64 -51
- package/lib/tsserverlibrary.js +64 -51
- package/lib/typescript.js +64 -51
- package/lib/typescriptServices.js +64 -51
- package/lib/typingsInstaller.js +16 -11
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -1162,6 +1162,13 @@ var ts;
|
|
|
1162
1162
|
: undefined;
|
|
1163
1163
|
}
|
|
1164
1164
|
ts.singleOrUndefined = singleOrUndefined;
|
|
1165
|
+
/**
|
|
1166
|
+
* Returns the only element of an array if it contains only one element; throws otherwise.
|
|
1167
|
+
*/
|
|
1168
|
+
function single(array) {
|
|
1169
|
+
return ts.Debug.checkDefined(singleOrUndefined(array));
|
|
1170
|
+
}
|
|
1171
|
+
ts.single = single;
|
|
1165
1172
|
function singleOrMany(array) {
|
|
1166
1173
|
return array && array.length === 1
|
|
1167
1174
|
? array[0]
|
|
@@ -7029,6 +7036,7 @@ var ts;
|
|
|
7029
7036
|
// not actually work.
|
|
7030
7037
|
var byteOrderMarkIndicator = "\uFEFF";
|
|
7031
7038
|
function getNodeSystem() {
|
|
7039
|
+
var _a;
|
|
7032
7040
|
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
7033
7041
|
var _fs = require("fs");
|
|
7034
7042
|
var _path = require("path");
|
|
@@ -7038,7 +7046,7 @@ var ts;
|
|
|
7038
7046
|
try {
|
|
7039
7047
|
_crypto = require("crypto");
|
|
7040
7048
|
}
|
|
7041
|
-
catch (
|
|
7049
|
+
catch (_b) {
|
|
7042
7050
|
_crypto = undefined;
|
|
7043
7051
|
}
|
|
7044
7052
|
var activeSession;
|
|
@@ -7049,10 +7057,10 @@ var ts;
|
|
|
7049
7057
|
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
7050
7058
|
var platform = _os.platform();
|
|
7051
7059
|
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
7052
|
-
var
|
|
7060
|
+
var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
|
|
7053
7061
|
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
|
7054
7062
|
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
|
7055
|
-
var
|
|
7063
|
+
var _c = createSystemWatchFunctions({
|
|
7056
7064
|
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
|
7057
7065
|
getModifiedTime: getModifiedTime,
|
|
7058
7066
|
setTimeout: setTimeout,
|
|
@@ -7072,7 +7080,7 @@ var ts;
|
|
|
7072
7080
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
7073
7081
|
inodeWatching: isLinuxOrMacOs,
|
|
7074
7082
|
sysLog: sysLog,
|
|
7075
|
-
}), watchFile =
|
|
7083
|
+
}), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
|
|
7076
7084
|
var nodeSystem = {
|
|
7077
7085
|
args: process.argv.slice(2),
|
|
7078
7086
|
newLine: _os.EOL,
|
|
@@ -7465,12 +7473,9 @@ var ts;
|
|
|
7465
7473
|
function getDirectories(path) {
|
|
7466
7474
|
return getAccessibleFileSystemEntries(path).directories.slice();
|
|
7467
7475
|
}
|
|
7468
|
-
function fsRealPathHandlingLongPath(path) {
|
|
7469
|
-
return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
|
|
7470
|
-
}
|
|
7471
7476
|
function realpath(path) {
|
|
7472
7477
|
try {
|
|
7473
|
-
return
|
|
7478
|
+
return realpathSync(path);
|
|
7474
7479
|
}
|
|
7475
7480
|
catch (_a) {
|
|
7476
7481
|
return path;
|
|
@@ -8900,7 +8905,7 @@ var ts;
|
|
|
8900
8905
|
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."),
|
|
8901
8906
|
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."),
|
|
8902
8907
|
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."),
|
|
8903
|
-
|
|
8908
|
+
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."),
|
|
8904
8909
|
_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."),
|
|
8905
8910
|
_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."),
|
|
8906
8911
|
_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."),
|
|
@@ -18127,7 +18132,7 @@ var ts;
|
|
|
18127
18132
|
}
|
|
18128
18133
|
diagnostics = nonFileDiagnostics;
|
|
18129
18134
|
}
|
|
18130
|
-
ts.insertSorted(diagnostics, diagnostic,
|
|
18135
|
+
ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation);
|
|
18131
18136
|
}
|
|
18132
18137
|
function getGlobalDiagnostics() {
|
|
18133
18138
|
hasReadNonFileDiagnostics = true;
|
|
@@ -51054,7 +51059,7 @@ var ts;
|
|
|
51054
51059
|
var exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
51055
51060
|
var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
51056
51061
|
if (exportAssignment) {
|
|
51057
|
-
ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.
|
|
51062
|
+
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));
|
|
51058
51063
|
}
|
|
51059
51064
|
}
|
|
51060
51065
|
else {
|
|
@@ -138913,6 +138918,8 @@ var ts;
|
|
|
138913
138918
|
// Similarly, skip past the symbol for 'export ='
|
|
138914
138919
|
if (importedSymbol.escapedName === "export=") {
|
|
138915
138920
|
importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker);
|
|
138921
|
+
if (importedSymbol === undefined)
|
|
138922
|
+
return undefined;
|
|
138916
138923
|
}
|
|
138917
138924
|
// If the import has a different name than the export, do not continue searching.
|
|
138918
138925
|
// If `importedName` is undefined, do continue searching as the export is anonymous.
|
|
@@ -138934,19 +138941,19 @@ var ts;
|
|
|
138934
138941
|
FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol;
|
|
138935
138942
|
function getExportEqualsLocalSymbol(importedSymbol, checker) {
|
|
138936
138943
|
if (importedSymbol.flags & 2097152 /* Alias */) {
|
|
138937
|
-
return
|
|
138944
|
+
return checker.getImmediateAliasedSymbol(importedSymbol);
|
|
138938
138945
|
}
|
|
138939
138946
|
var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration);
|
|
138940
138947
|
if (ts.isExportAssignment(decl)) { // `export = class {}`
|
|
138941
|
-
return
|
|
138948
|
+
return decl.expression.symbol;
|
|
138942
138949
|
}
|
|
138943
138950
|
else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}`
|
|
138944
|
-
return
|
|
138951
|
+
return decl.right.symbol;
|
|
138945
138952
|
}
|
|
138946
138953
|
else if (ts.isSourceFile(decl)) { // json module
|
|
138947
|
-
return
|
|
138954
|
+
return decl.symbol;
|
|
138948
138955
|
}
|
|
138949
|
-
return
|
|
138956
|
+
return undefined;
|
|
138950
138957
|
}
|
|
138951
138958
|
// If a reference is a class expression, the exported node would be its parent.
|
|
138952
138959
|
// If a reference is a variable declaration, the exported node would be the variable statement.
|
|
@@ -155223,13 +155230,15 @@ var ts;
|
|
|
155223
155230
|
errorCodes: errorCodes,
|
|
155224
155231
|
getCodeActions: function (context) {
|
|
155225
155232
|
var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
155226
|
-
var info =
|
|
155233
|
+
var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true);
|
|
155227
155234
|
if (!info)
|
|
155228
155235
|
return undefined;
|
|
155229
|
-
var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText;
|
|
155230
155236
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
155231
|
-
return
|
|
155232
|
-
|
|
155237
|
+
return info.map(function (_a) {
|
|
155238
|
+
var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText;
|
|
155239
|
+
return codeActionForFix(context, sourceFile, symbolName, fix,
|
|
155240
|
+
/*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions());
|
|
155241
|
+
});
|
|
155233
155242
|
},
|
|
155234
155243
|
fixIds: [importFixId],
|
|
155235
155244
|
getAllCodeActions: function (context) {
|
|
@@ -155254,10 +155263,10 @@ var ts;
|
|
|
155254
155263
|
var newImports = new ts.Map();
|
|
155255
155264
|
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
155256
155265
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
155257
|
-
var info =
|
|
155258
|
-
if (!info || !info.
|
|
155266
|
+
var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
155267
|
+
if (!info || !info.length)
|
|
155259
155268
|
return;
|
|
155260
|
-
addImport(info);
|
|
155269
|
+
addImport(ts.first(info));
|
|
155261
155270
|
}
|
|
155262
155271
|
function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) {
|
|
155263
155272
|
var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent);
|
|
@@ -155268,13 +155277,12 @@ var ts;
|
|
|
155268
155277
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155269
155278
|
var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
|
|
155270
155279
|
if (fix) {
|
|
155271
|
-
addImport({
|
|
155280
|
+
addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined });
|
|
155272
155281
|
}
|
|
155273
155282
|
}
|
|
155274
155283
|
function addImport(info) {
|
|
155275
155284
|
var _a, _b;
|
|
155276
|
-
var
|
|
155277
|
-
var fix = ts.first(fixes);
|
|
155285
|
+
var fix = info.fix, symbolName = info.symbolName;
|
|
155278
155286
|
switch (fix.kind) {
|
|
155279
155287
|
case 0 /* UseNamespace */:
|
|
155280
155288
|
addToNamespace.push(fix);
|
|
@@ -155458,7 +155466,7 @@ var ts;
|
|
|
155458
155466
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
155459
155467
|
function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
|
|
155460
155468
|
var compilerOptions = program.getCompilerOptions();
|
|
155461
|
-
var symbolName =
|
|
155469
|
+
var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
|
|
155462
155470
|
var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
|
|
155463
155471
|
var includeSymbolNameInDescription = symbolName !== symbolToken.text;
|
|
155464
155472
|
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
|
|
@@ -155763,7 +155771,7 @@ var ts;
|
|
|
155763
155771
|
return { kind: 3 /* AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire };
|
|
155764
155772
|
}
|
|
155765
155773
|
}
|
|
155766
|
-
function
|
|
155774
|
+
function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
|
|
155767
155775
|
var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
|
|
155768
155776
|
var info;
|
|
155769
155777
|
if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
|
|
@@ -155773,19 +155781,23 @@ var ts;
|
|
|
155773
155781
|
return undefined;
|
|
155774
155782
|
}
|
|
155775
155783
|
else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
|
|
155776
|
-
var symbolName_1 =
|
|
155784
|
+
var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()));
|
|
155777
155785
|
var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
|
|
155778
|
-
return fix && {
|
|
155786
|
+
return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }];
|
|
155779
155787
|
}
|
|
155780
155788
|
else {
|
|
155781
155789
|
info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
|
|
155782
155790
|
}
|
|
155783
155791
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
155784
|
-
return info &&
|
|
155792
|
+
return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
|
|
155785
155793
|
}
|
|
155786
|
-
function
|
|
155794
|
+
function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) {
|
|
155787
155795
|
var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); };
|
|
155788
|
-
return ts.sort(fixes, function (a, b) {
|
|
155796
|
+
return ts.sort(fixes, function (a, b) {
|
|
155797
|
+
return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) ||
|
|
155798
|
+
ts.compareValues(a.fix.kind, b.fix.kind) ||
|
|
155799
|
+
compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath);
|
|
155800
|
+
});
|
|
155789
155801
|
}
|
|
155790
155802
|
function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
|
|
155791
155803
|
if (!ts.some(fixes))
|
|
@@ -155836,7 +155848,6 @@ var ts;
|
|
|
155836
155848
|
return 0 /* EqualTo */;
|
|
155837
155849
|
}
|
|
155838
155850
|
function getFixesInfoForUMDImport(_a, token) {
|
|
155839
|
-
var _b;
|
|
155840
155851
|
var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences;
|
|
155841
155852
|
var checker = program.getTypeChecker();
|
|
155842
155853
|
var umdSymbol = getUmdSymbol(token, checker);
|
|
@@ -155848,7 +155859,7 @@ var ts;
|
|
|
155848
155859
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155849
155860
|
var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
|
|
155850
155861
|
var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
|
|
155851
|
-
return {
|
|
155862
|
+
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 }); });
|
|
155852
155863
|
}
|
|
155853
155864
|
function getUmdSymbol(token, checker) {
|
|
155854
155865
|
// try the identifier to see if it is the umd symbol
|
|
@@ -155909,19 +155920,20 @@ var ts;
|
|
|
155909
155920
|
var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences;
|
|
155910
155921
|
var checker = program.getTypeChecker();
|
|
155911
155922
|
var compilerOptions = program.getCompilerOptions();
|
|
155912
|
-
|
|
155913
|
-
|
|
155914
|
-
|
|
155915
|
-
|
|
155916
|
-
|
|
155917
|
-
|
|
155918
|
-
|
|
155919
|
-
|
|
155920
|
-
|
|
155921
|
-
|
|
155922
|
-
|
|
155923
|
-
|
|
155924
|
-
|
|
155923
|
+
return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) {
|
|
155924
|
+
// "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
|
|
155925
|
+
if (symbolName === "default" /* Default */) {
|
|
155926
|
+
return undefined;
|
|
155927
|
+
}
|
|
155928
|
+
var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
|
|
155929
|
+
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155930
|
+
var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
|
|
155931
|
+
var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
|
|
155932
|
+
var _ = _a[0], exportInfos = _a[1];
|
|
155933
|
+
return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
|
|
155934
|
+
}));
|
|
155935
|
+
return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); });
|
|
155936
|
+
});
|
|
155925
155937
|
}
|
|
155926
155938
|
function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
|
|
155927
155939
|
var checker = program.getTypeChecker();
|
|
@@ -155933,15 +155945,16 @@ var ts;
|
|
|
155933
155945
|
return undefined;
|
|
155934
155946
|
return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
|
|
155935
155947
|
}
|
|
155936
|
-
function
|
|
155948
|
+
function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) {
|
|
155937
155949
|
var parent = symbolToken.parent;
|
|
155938
155950
|
if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
|
|
155939
155951
|
var jsxNamespace = checker.getJsxNamespace(sourceFile);
|
|
155940
155952
|
if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
|
|
155941
|
-
|
|
155953
|
+
var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* Value */, /*excludeGlobals*/ false);
|
|
155954
|
+
return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace];
|
|
155942
155955
|
}
|
|
155943
155956
|
}
|
|
155944
|
-
return symbolToken.text;
|
|
155957
|
+
return [symbolToken.text];
|
|
155945
155958
|
}
|
|
155946
155959
|
function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
|
|
155947
155960
|
if (ts.isIntrinsicJsxName(symbolToken.text))
|
package/lib/typescript.js
CHANGED
|
@@ -1153,6 +1153,13 @@ var ts;
|
|
|
1153
1153
|
: undefined;
|
|
1154
1154
|
}
|
|
1155
1155
|
ts.singleOrUndefined = singleOrUndefined;
|
|
1156
|
+
/**
|
|
1157
|
+
* Returns the only element of an array if it contains only one element; throws otherwise.
|
|
1158
|
+
*/
|
|
1159
|
+
function single(array) {
|
|
1160
|
+
return ts.Debug.checkDefined(singleOrUndefined(array));
|
|
1161
|
+
}
|
|
1162
|
+
ts.single = single;
|
|
1156
1163
|
function singleOrMany(array) {
|
|
1157
1164
|
return array && array.length === 1
|
|
1158
1165
|
? array[0]
|
|
@@ -7020,6 +7027,7 @@ var ts;
|
|
|
7020
7027
|
// not actually work.
|
|
7021
7028
|
var byteOrderMarkIndicator = "\uFEFF";
|
|
7022
7029
|
function getNodeSystem() {
|
|
7030
|
+
var _a;
|
|
7023
7031
|
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
7024
7032
|
var _fs = require("fs");
|
|
7025
7033
|
var _path = require("path");
|
|
@@ -7029,7 +7037,7 @@ var ts;
|
|
|
7029
7037
|
try {
|
|
7030
7038
|
_crypto = require("crypto");
|
|
7031
7039
|
}
|
|
7032
|
-
catch (
|
|
7040
|
+
catch (_b) {
|
|
7033
7041
|
_crypto = undefined;
|
|
7034
7042
|
}
|
|
7035
7043
|
var activeSession;
|
|
@@ -7040,10 +7048,10 @@ var ts;
|
|
|
7040
7048
|
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
7041
7049
|
var platform = _os.platform();
|
|
7042
7050
|
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
7043
|
-
var
|
|
7051
|
+
var realpathSync = (_a = _fs.realpathSync.native) !== null && _a !== void 0 ? _a : _fs.realpathSync;
|
|
7044
7052
|
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
|
7045
7053
|
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
|
7046
|
-
var
|
|
7054
|
+
var _c = createSystemWatchFunctions({
|
|
7047
7055
|
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
|
7048
7056
|
getModifiedTime: getModifiedTime,
|
|
7049
7057
|
setTimeout: setTimeout,
|
|
@@ -7063,7 +7071,7 @@ var ts;
|
|
|
7063
7071
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
7064
7072
|
inodeWatching: isLinuxOrMacOs,
|
|
7065
7073
|
sysLog: sysLog,
|
|
7066
|
-
}), watchFile =
|
|
7074
|
+
}), watchFile = _c.watchFile, watchDirectory = _c.watchDirectory;
|
|
7067
7075
|
var nodeSystem = {
|
|
7068
7076
|
args: process.argv.slice(2),
|
|
7069
7077
|
newLine: _os.EOL,
|
|
@@ -7456,12 +7464,9 @@ var ts;
|
|
|
7456
7464
|
function getDirectories(path) {
|
|
7457
7465
|
return getAccessibleFileSystemEntries(path).directories.slice();
|
|
7458
7466
|
}
|
|
7459
|
-
function fsRealPathHandlingLongPath(path) {
|
|
7460
|
-
return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
|
|
7461
|
-
}
|
|
7462
7467
|
function realpath(path) {
|
|
7463
7468
|
try {
|
|
7464
|
-
return
|
|
7469
|
+
return realpathSync(path);
|
|
7465
7470
|
}
|
|
7466
7471
|
catch (_a) {
|
|
7467
7472
|
return path;
|
|
@@ -8891,7 +8896,7 @@ var ts;
|
|
|
8891
8896
|
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."),
|
|
8892
8897
|
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."),
|
|
8893
8898
|
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."),
|
|
8894
|
-
|
|
8899
|
+
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."),
|
|
8895
8900
|
_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."),
|
|
8896
8901
|
_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."),
|
|
8897
8902
|
_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."),
|
|
@@ -18118,7 +18123,7 @@ var ts;
|
|
|
18118
18123
|
}
|
|
18119
18124
|
diagnostics = nonFileDiagnostics;
|
|
18120
18125
|
}
|
|
18121
|
-
ts.insertSorted(diagnostics, diagnostic,
|
|
18126
|
+
ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation);
|
|
18122
18127
|
}
|
|
18123
18128
|
function getGlobalDiagnostics() {
|
|
18124
18129
|
hasReadNonFileDiagnostics = true;
|
|
@@ -51045,7 +51050,7 @@ var ts;
|
|
|
51045
51050
|
var exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
51046
51051
|
var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
51047
51052
|
if (exportAssignment) {
|
|
51048
|
-
ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.
|
|
51053
|
+
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));
|
|
51049
51054
|
}
|
|
51050
51055
|
}
|
|
51051
51056
|
else {
|
|
@@ -138904,6 +138909,8 @@ var ts;
|
|
|
138904
138909
|
// Similarly, skip past the symbol for 'export ='
|
|
138905
138910
|
if (importedSymbol.escapedName === "export=") {
|
|
138906
138911
|
importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker);
|
|
138912
|
+
if (importedSymbol === undefined)
|
|
138913
|
+
return undefined;
|
|
138907
138914
|
}
|
|
138908
138915
|
// If the import has a different name than the export, do not continue searching.
|
|
138909
138916
|
// If `importedName` is undefined, do continue searching as the export is anonymous.
|
|
@@ -138925,19 +138932,19 @@ var ts;
|
|
|
138925
138932
|
FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol;
|
|
138926
138933
|
function getExportEqualsLocalSymbol(importedSymbol, checker) {
|
|
138927
138934
|
if (importedSymbol.flags & 2097152 /* Alias */) {
|
|
138928
|
-
return
|
|
138935
|
+
return checker.getImmediateAliasedSymbol(importedSymbol);
|
|
138929
138936
|
}
|
|
138930
138937
|
var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration);
|
|
138931
138938
|
if (ts.isExportAssignment(decl)) { // `export = class {}`
|
|
138932
|
-
return
|
|
138939
|
+
return decl.expression.symbol;
|
|
138933
138940
|
}
|
|
138934
138941
|
else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}`
|
|
138935
|
-
return
|
|
138942
|
+
return decl.right.symbol;
|
|
138936
138943
|
}
|
|
138937
138944
|
else if (ts.isSourceFile(decl)) { // json module
|
|
138938
|
-
return
|
|
138945
|
+
return decl.symbol;
|
|
138939
138946
|
}
|
|
138940
|
-
return
|
|
138947
|
+
return undefined;
|
|
138941
138948
|
}
|
|
138942
138949
|
// If a reference is a class expression, the exported node would be its parent.
|
|
138943
138950
|
// If a reference is a variable declaration, the exported node would be the variable statement.
|
|
@@ -155214,13 +155221,15 @@ var ts;
|
|
|
155214
155221
|
errorCodes: errorCodes,
|
|
155215
155222
|
getCodeActions: function (context) {
|
|
155216
155223
|
var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
155217
|
-
var info =
|
|
155224
|
+
var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true);
|
|
155218
155225
|
if (!info)
|
|
155219
155226
|
return undefined;
|
|
155220
|
-
var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText;
|
|
155221
155227
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
155222
|
-
return
|
|
155223
|
-
|
|
155228
|
+
return info.map(function (_a) {
|
|
155229
|
+
var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText;
|
|
155230
|
+
return codeActionForFix(context, sourceFile, symbolName, fix,
|
|
155231
|
+
/*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions());
|
|
155232
|
+
});
|
|
155224
155233
|
},
|
|
155225
155234
|
fixIds: [importFixId],
|
|
155226
155235
|
getAllCodeActions: function (context) {
|
|
@@ -155245,10 +155254,10 @@ var ts;
|
|
|
155245
155254
|
var newImports = new ts.Map();
|
|
155246
155255
|
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
155247
155256
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
155248
|
-
var info =
|
|
155249
|
-
if (!info || !info.
|
|
155257
|
+
var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
155258
|
+
if (!info || !info.length)
|
|
155250
155259
|
return;
|
|
155251
|
-
addImport(info);
|
|
155260
|
+
addImport(ts.first(info));
|
|
155252
155261
|
}
|
|
155253
155262
|
function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) {
|
|
155254
155263
|
var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent);
|
|
@@ -155259,13 +155268,12 @@ var ts;
|
|
|
155259
155268
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155260
155269
|
var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
|
|
155261
155270
|
if (fix) {
|
|
155262
|
-
addImport({
|
|
155271
|
+
addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined });
|
|
155263
155272
|
}
|
|
155264
155273
|
}
|
|
155265
155274
|
function addImport(info) {
|
|
155266
155275
|
var _a, _b;
|
|
155267
|
-
var
|
|
155268
|
-
var fix = ts.first(fixes);
|
|
155276
|
+
var fix = info.fix, symbolName = info.symbolName;
|
|
155269
155277
|
switch (fix.kind) {
|
|
155270
155278
|
case 0 /* UseNamespace */:
|
|
155271
155279
|
addToNamespace.push(fix);
|
|
@@ -155449,7 +155457,7 @@ var ts;
|
|
|
155449
155457
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
155450
155458
|
function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
|
|
155451
155459
|
var compilerOptions = program.getCompilerOptions();
|
|
155452
|
-
var symbolName =
|
|
155460
|
+
var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
|
|
155453
155461
|
var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
|
|
155454
155462
|
var includeSymbolNameInDescription = symbolName !== symbolToken.text;
|
|
155455
155463
|
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
|
|
@@ -155754,7 +155762,7 @@ var ts;
|
|
|
155754
155762
|
return { kind: 3 /* AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire };
|
|
155755
155763
|
}
|
|
155756
155764
|
}
|
|
155757
|
-
function
|
|
155765
|
+
function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
|
|
155758
155766
|
var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
|
|
155759
155767
|
var info;
|
|
155760
155768
|
if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
|
|
@@ -155764,19 +155772,23 @@ var ts;
|
|
|
155764
155772
|
return undefined;
|
|
155765
155773
|
}
|
|
155766
155774
|
else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
|
|
155767
|
-
var symbolName_1 =
|
|
155775
|
+
var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()));
|
|
155768
155776
|
var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
|
|
155769
|
-
return fix && {
|
|
155777
|
+
return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }];
|
|
155770
155778
|
}
|
|
155771
155779
|
else {
|
|
155772
155780
|
info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
|
|
155773
155781
|
}
|
|
155774
155782
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
155775
|
-
return info &&
|
|
155783
|
+
return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
|
|
155776
155784
|
}
|
|
155777
|
-
function
|
|
155785
|
+
function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) {
|
|
155778
155786
|
var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); };
|
|
155779
|
-
return ts.sort(fixes, function (a, b) {
|
|
155787
|
+
return ts.sort(fixes, function (a, b) {
|
|
155788
|
+
return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) ||
|
|
155789
|
+
ts.compareValues(a.fix.kind, b.fix.kind) ||
|
|
155790
|
+
compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath);
|
|
155791
|
+
});
|
|
155780
155792
|
}
|
|
155781
155793
|
function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
|
|
155782
155794
|
if (!ts.some(fixes))
|
|
@@ -155827,7 +155839,6 @@ var ts;
|
|
|
155827
155839
|
return 0 /* EqualTo */;
|
|
155828
155840
|
}
|
|
155829
155841
|
function getFixesInfoForUMDImport(_a, token) {
|
|
155830
|
-
var _b;
|
|
155831
155842
|
var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences;
|
|
155832
155843
|
var checker = program.getTypeChecker();
|
|
155833
155844
|
var umdSymbol = getUmdSymbol(token, checker);
|
|
@@ -155839,7 +155850,7 @@ var ts;
|
|
|
155839
155850
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155840
155851
|
var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
|
|
155841
155852
|
var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
|
|
155842
|
-
return {
|
|
155853
|
+
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 }); });
|
|
155843
155854
|
}
|
|
155844
155855
|
function getUmdSymbol(token, checker) {
|
|
155845
155856
|
// try the identifier to see if it is the umd symbol
|
|
@@ -155900,19 +155911,20 @@ var ts;
|
|
|
155900
155911
|
var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences;
|
|
155901
155912
|
var checker = program.getTypeChecker();
|
|
155902
155913
|
var compilerOptions = program.getCompilerOptions();
|
|
155903
|
-
|
|
155904
|
-
|
|
155905
|
-
|
|
155906
|
-
|
|
155907
|
-
|
|
155908
|
-
|
|
155909
|
-
|
|
155910
|
-
|
|
155911
|
-
|
|
155912
|
-
|
|
155913
|
-
|
|
155914
|
-
|
|
155915
|
-
|
|
155914
|
+
return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) {
|
|
155915
|
+
// "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
|
|
155916
|
+
if (symbolName === "default" /* Default */) {
|
|
155917
|
+
return undefined;
|
|
155918
|
+
}
|
|
155919
|
+
var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
|
|
155920
|
+
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155921
|
+
var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
|
|
155922
|
+
var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
|
|
155923
|
+
var _ = _a[0], exportInfos = _a[1];
|
|
155924
|
+
return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
|
|
155925
|
+
}));
|
|
155926
|
+
return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); });
|
|
155927
|
+
});
|
|
155916
155928
|
}
|
|
155917
155929
|
function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
|
|
155918
155930
|
var checker = program.getTypeChecker();
|
|
@@ -155924,15 +155936,16 @@ var ts;
|
|
|
155924
155936
|
return undefined;
|
|
155925
155937
|
return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
|
|
155926
155938
|
}
|
|
155927
|
-
function
|
|
155939
|
+
function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) {
|
|
155928
155940
|
var parent = symbolToken.parent;
|
|
155929
155941
|
if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
|
|
155930
155942
|
var jsxNamespace = checker.getJsxNamespace(sourceFile);
|
|
155931
155943
|
if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
|
|
155932
|
-
|
|
155944
|
+
var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* Value */, /*excludeGlobals*/ false);
|
|
155945
|
+
return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace];
|
|
155933
155946
|
}
|
|
155934
155947
|
}
|
|
155935
|
-
return symbolToken.text;
|
|
155948
|
+
return [symbolToken.text];
|
|
155936
155949
|
}
|
|
155937
155950
|
function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
|
|
155938
155951
|
if (ts.isIntrinsicJsxName(symbolToken.text))
|