typescript 4.9.0-dev.20220815 → 4.9.0-dev.20220816
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/lib.es5.d.ts +4 -6
- package/lib/tsc.js +20 -13
- package/lib/tsserver.js +95 -62
- package/lib/tsserverlibrary.js +95 -62
- package/lib/typescript.js +95 -62
- package/lib/typescriptServices.js +95 -62
- package/lib/typingsInstaller.js +23 -13
- package/package.json +2 -1
package/lib/lib.es5.d.ts
CHANGED
|
@@ -214,12 +214,6 @@ interface ObjectConstructor {
|
|
|
214
214
|
*/
|
|
215
215
|
seal<T>(o: T): T;
|
|
216
216
|
|
|
217
|
-
/**
|
|
218
|
-
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
|
219
|
-
* @param a Object on which to lock the attributes.
|
|
220
|
-
*/
|
|
221
|
-
freeze<T>(a: T[]): readonly T[];
|
|
222
|
-
|
|
223
217
|
/**
|
|
224
218
|
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
|
|
225
219
|
* @param f Object on which to lock the attributes.
|
|
@@ -951,6 +945,10 @@ interface RegExpMatchArray extends Array<string> {
|
|
|
951
945
|
* A copy of the search string.
|
|
952
946
|
*/
|
|
953
947
|
input?: string;
|
|
948
|
+
/**
|
|
949
|
+
* The first match. This will always be present because `null` will be returned if there are no matches.
|
|
950
|
+
*/
|
|
951
|
+
0: string;
|
|
954
952
|
}
|
|
955
953
|
|
|
956
954
|
interface RegExpExecArray extends Array<string> {
|
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.9";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220816";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -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,7 +4460,6 @@ var ts;
|
|
|
4456
4460
|
ts.sys = (function () {
|
|
4457
4461
|
var byteOrderMarkIndicator = "\uFEFF";
|
|
4458
4462
|
function getNodeSystem() {
|
|
4459
|
-
var _a;
|
|
4460
4463
|
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
4461
4464
|
var _fs = require("fs");
|
|
4462
4465
|
var _path = require("path");
|
|
@@ -4465,7 +4468,7 @@ var ts;
|
|
|
4465
4468
|
try {
|
|
4466
4469
|
_crypto = require("crypto");
|
|
4467
4470
|
}
|
|
4468
|
-
catch (
|
|
4471
|
+
catch (_a) {
|
|
4469
4472
|
_crypto = undefined;
|
|
4470
4473
|
}
|
|
4471
4474
|
var activeSession;
|
|
@@ -4476,10 +4479,10 @@ var ts;
|
|
|
4476
4479
|
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
4477
4480
|
var platform = _os.platform();
|
|
4478
4481
|
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
4479
|
-
var
|
|
4482
|
+
var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
4480
4483
|
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
|
4481
4484
|
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
|
4482
|
-
var
|
|
4485
|
+
var _b = createSystemWatchFunctions({
|
|
4483
4486
|
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
|
4484
4487
|
getModifiedTime: getModifiedTime,
|
|
4485
4488
|
setTimeout: setTimeout,
|
|
@@ -4497,7 +4500,7 @@ var ts;
|
|
|
4497
4500
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
4498
4501
|
inodeWatching: isLinuxOrMacOs,
|
|
4499
4502
|
sysLog: sysLog,
|
|
4500
|
-
}), watchFile =
|
|
4503
|
+
}), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
|
|
4501
4504
|
var nodeSystem = {
|
|
4502
4505
|
args: process.argv.slice(2),
|
|
4503
4506
|
newLine: _os.EOL,
|
|
@@ -4847,9 +4850,12 @@ var ts;
|
|
|
4847
4850
|
function getDirectories(path) {
|
|
4848
4851
|
return getAccessibleFileSystemEntries(path).directories.slice();
|
|
4849
4852
|
}
|
|
4853
|
+
function fsRealPathHandlingLongPath(path) {
|
|
4854
|
+
return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
|
|
4855
|
+
}
|
|
4850
4856
|
function realpath(path) {
|
|
4851
4857
|
try {
|
|
4852
|
-
return
|
|
4858
|
+
return fsRealpath(path);
|
|
4853
4859
|
}
|
|
4854
4860
|
catch (_a) {
|
|
4855
4861
|
return path;
|
|
@@ -6057,7 +6063,7 @@ var ts;
|
|
|
6057
6063
|
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."),
|
|
6058
6064
|
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."),
|
|
6059
6065
|
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."),
|
|
6060
|
-
|
|
6066
|
+
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."),
|
|
6061
6067
|
_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."),
|
|
6062
6068
|
_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."),
|
|
6063
6069
|
_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."),
|
|
@@ -14165,7 +14171,7 @@ var ts;
|
|
|
14165
14171
|
}
|
|
14166
14172
|
diagnostics = nonFileDiagnostics;
|
|
14167
14173
|
}
|
|
14168
|
-
ts.insertSorted(diagnostics, diagnostic,
|
|
14174
|
+
ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation);
|
|
14169
14175
|
}
|
|
14170
14176
|
function getGlobalDiagnostics() {
|
|
14171
14177
|
hasReadNonFileDiagnostics = true;
|
|
@@ -41937,7 +41943,7 @@ var ts;
|
|
|
41937
41943
|
var exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
41938
41944
|
var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
41939
41945
|
if (exportAssignment) {
|
|
41940
|
-
ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.
|
|
41946
|
+
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));
|
|
41941
41947
|
}
|
|
41942
41948
|
}
|
|
41943
41949
|
else {
|
|
@@ -54827,7 +54833,8 @@ var ts;
|
|
|
54827
54833
|
return 0;
|
|
54828
54834
|
}
|
|
54829
54835
|
}
|
|
54830
|
-
var isPerformingCommonPropertyChecks = relation !== comparableRelation &&
|
|
54836
|
+
var isPerformingCommonPropertyChecks = (relation !== comparableRelation || relation === comparableRelation && isLiteralType(source)) &&
|
|
54837
|
+
!(intersectionState & 2) &&
|
|
54831
54838
|
source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
|
|
54832
54839
|
target.flags & (524288 | 2097152) && isWeakType(target) &&
|
|
54833
54840
|
(getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
|
|
@@ -55474,7 +55481,7 @@ var ts;
|
|
|
55474
55481
|
if (reportErrors && originalErrorInfo) {
|
|
55475
55482
|
resetErrorInfo(saveErrorInfo);
|
|
55476
55483
|
}
|
|
55477
|
-
if (result = isRelatedTo(source, constraint, 2, reportErrors)) {
|
|
55484
|
+
if (result = isRelatedTo(source, constraint, 2, reportErrors, undefined, intersectionState)) {
|
|
55478
55485
|
return result;
|
|
55479
55486
|
}
|
|
55480
55487
|
if (reportErrors && originalErrorInfo && errorInfo) {
|
|
@@ -56923,7 +56930,7 @@ var ts;
|
|
|
56923
56930
|
if (!isLiteralOfContextualType(type, contextualType)) {
|
|
56924
56931
|
type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type));
|
|
56925
56932
|
}
|
|
56926
|
-
return type;
|
|
56933
|
+
return getRegularTypeOfLiteralType(type);
|
|
56927
56934
|
}
|
|
56928
56935
|
function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) {
|
|
56929
56936
|
if (type && isUnitType(type)) {
|
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220816";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -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,7 +7037,6 @@ var ts;
|
|
|
7030
7037
|
// not actually work.
|
|
7031
7038
|
var byteOrderMarkIndicator = "\uFEFF";
|
|
7032
7039
|
function getNodeSystem() {
|
|
7033
|
-
var _a;
|
|
7034
7040
|
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
7035
7041
|
var _fs = require("fs");
|
|
7036
7042
|
var _path = require("path");
|
|
@@ -7040,7 +7046,7 @@ var ts;
|
|
|
7040
7046
|
try {
|
|
7041
7047
|
_crypto = require("crypto");
|
|
7042
7048
|
}
|
|
7043
|
-
catch (
|
|
7049
|
+
catch (_a) {
|
|
7044
7050
|
_crypto = undefined;
|
|
7045
7051
|
}
|
|
7046
7052
|
var activeSession;
|
|
@@ -7051,10 +7057,10 @@ var ts;
|
|
|
7051
7057
|
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
7052
7058
|
var platform = _os.platform();
|
|
7053
7059
|
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
7054
|
-
var
|
|
7060
|
+
var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
7055
7061
|
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
|
7056
7062
|
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
|
7057
|
-
var
|
|
7063
|
+
var _b = createSystemWatchFunctions({
|
|
7058
7064
|
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
|
7059
7065
|
getModifiedTime: getModifiedTime,
|
|
7060
7066
|
setTimeout: setTimeout,
|
|
@@ -7074,7 +7080,7 @@ var ts;
|
|
|
7074
7080
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
7075
7081
|
inodeWatching: isLinuxOrMacOs,
|
|
7076
7082
|
sysLog: sysLog,
|
|
7077
|
-
}), watchFile =
|
|
7083
|
+
}), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
|
|
7078
7084
|
var nodeSystem = {
|
|
7079
7085
|
args: process.argv.slice(2),
|
|
7080
7086
|
newLine: _os.EOL,
|
|
@@ -7467,9 +7473,12 @@ var ts;
|
|
|
7467
7473
|
function getDirectories(path) {
|
|
7468
7474
|
return getAccessibleFileSystemEntries(path).directories.slice();
|
|
7469
7475
|
}
|
|
7476
|
+
function fsRealPathHandlingLongPath(path) {
|
|
7477
|
+
return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
|
|
7478
|
+
}
|
|
7470
7479
|
function realpath(path) {
|
|
7471
7480
|
try {
|
|
7472
|
-
return
|
|
7481
|
+
return fsRealpath(path);
|
|
7473
7482
|
}
|
|
7474
7483
|
catch (_a) {
|
|
7475
7484
|
return path;
|
|
@@ -8899,7 +8908,7 @@ var ts;
|
|
|
8899
8908
|
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."),
|
|
8900
8909
|
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."),
|
|
8901
8910
|
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."),
|
|
8902
|
-
|
|
8911
|
+
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."),
|
|
8903
8912
|
_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."),
|
|
8904
8913
|
_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."),
|
|
8905
8914
|
_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."),
|
|
@@ -18126,7 +18135,7 @@ var ts;
|
|
|
18126
18135
|
}
|
|
18127
18136
|
diagnostics = nonFileDiagnostics;
|
|
18128
18137
|
}
|
|
18129
|
-
ts.insertSorted(diagnostics, diagnostic,
|
|
18138
|
+
ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation);
|
|
18130
18139
|
}
|
|
18131
18140
|
function getGlobalDiagnostics() {
|
|
18132
18141
|
hasReadNonFileDiagnostics = true;
|
|
@@ -51053,7 +51062,7 @@ var ts;
|
|
|
51053
51062
|
var exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
51054
51063
|
var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
51055
51064
|
if (exportAssignment) {
|
|
51056
|
-
ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.
|
|
51065
|
+
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));
|
|
51057
51066
|
}
|
|
51058
51067
|
}
|
|
51059
51068
|
else {
|
|
@@ -65726,7 +65735,8 @@ var ts;
|
|
|
65726
65735
|
return 0 /* False */;
|
|
65727
65736
|
}
|
|
65728
65737
|
}
|
|
65729
|
-
var isPerformingCommonPropertyChecks = relation !== comparableRelation
|
|
65738
|
+
var isPerformingCommonPropertyChecks = (relation !== comparableRelation || relation === comparableRelation && isLiteralType(source)) &&
|
|
65739
|
+
!(intersectionState & 2 /* Target */) &&
|
|
65730
65740
|
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
|
|
65731
65741
|
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
|
|
65732
65742
|
(getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
|
|
@@ -66503,7 +66513,7 @@ var ts;
|
|
|
66503
66513
|
// create a new chain for the constraint error
|
|
66504
66514
|
resetErrorInfo(saveErrorInfo);
|
|
66505
66515
|
}
|
|
66506
|
-
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors)) {
|
|
66516
|
+
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
|
|
66507
66517
|
return result;
|
|
66508
66518
|
}
|
|
66509
66519
|
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
|
|
@@ -68209,7 +68219,7 @@ var ts;
|
|
|
68209
68219
|
if (!isLiteralOfContextualType(type, contextualType)) {
|
|
68210
68220
|
type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type));
|
|
68211
68221
|
}
|
|
68212
|
-
return type;
|
|
68222
|
+
return getRegularTypeOfLiteralType(type);
|
|
68213
68223
|
}
|
|
68214
68224
|
function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) {
|
|
68215
68225
|
if (type && isUnitType(type)) {
|
|
@@ -138493,6 +138503,8 @@ var ts;
|
|
|
138493
138503
|
// Similarly, skip past the symbol for 'export ='
|
|
138494
138504
|
if (importedSymbol.escapedName === "export=") {
|
|
138495
138505
|
importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker);
|
|
138506
|
+
if (importedSymbol === undefined)
|
|
138507
|
+
return undefined;
|
|
138496
138508
|
}
|
|
138497
138509
|
// If the import has a different name than the export, do not continue searching.
|
|
138498
138510
|
// If `importedName` is undefined, do continue searching as the export is anonymous.
|
|
@@ -138514,19 +138526,19 @@ var ts;
|
|
|
138514
138526
|
FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol;
|
|
138515
138527
|
function getExportEqualsLocalSymbol(importedSymbol, checker) {
|
|
138516
138528
|
if (importedSymbol.flags & 2097152 /* Alias */) {
|
|
138517
|
-
return
|
|
138529
|
+
return checker.getImmediateAliasedSymbol(importedSymbol);
|
|
138518
138530
|
}
|
|
138519
138531
|
var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration);
|
|
138520
138532
|
if (ts.isExportAssignment(decl)) { // `export = class {}`
|
|
138521
|
-
return
|
|
138533
|
+
return decl.expression.symbol;
|
|
138522
138534
|
}
|
|
138523
138535
|
else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}`
|
|
138524
|
-
return
|
|
138536
|
+
return decl.right.symbol;
|
|
138525
138537
|
}
|
|
138526
138538
|
else if (ts.isSourceFile(decl)) { // json module
|
|
138527
|
-
return
|
|
138539
|
+
return decl.symbol;
|
|
138528
138540
|
}
|
|
138529
|
-
return
|
|
138541
|
+
return undefined;
|
|
138530
138542
|
}
|
|
138531
138543
|
// If a reference is a class expression, the exported node would be its parent.
|
|
138532
138544
|
// If a reference is a variable declaration, the exported node would be the variable statement.
|
|
@@ -154803,13 +154815,15 @@ var ts;
|
|
|
154803
154815
|
errorCodes: errorCodes,
|
|
154804
154816
|
getCodeActions: function (context) {
|
|
154805
154817
|
var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
154806
|
-
var info =
|
|
154818
|
+
var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true);
|
|
154807
154819
|
if (!info)
|
|
154808
154820
|
return undefined;
|
|
154809
|
-
var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText;
|
|
154810
154821
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
154811
|
-
return
|
|
154812
|
-
|
|
154822
|
+
return info.map(function (_a) {
|
|
154823
|
+
var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText;
|
|
154824
|
+
return codeActionForFix(context, sourceFile, symbolName, fix,
|
|
154825
|
+
/*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions());
|
|
154826
|
+
});
|
|
154813
154827
|
},
|
|
154814
154828
|
fixIds: [importFixId],
|
|
154815
154829
|
getAllCodeActions: function (context) {
|
|
@@ -154834,10 +154848,10 @@ var ts;
|
|
|
154834
154848
|
var newImports = new ts.Map();
|
|
154835
154849
|
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
154836
154850
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
154837
|
-
var info =
|
|
154838
|
-
if (!info || !info.
|
|
154851
|
+
var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
154852
|
+
if (!info || !info.length)
|
|
154839
154853
|
return;
|
|
154840
|
-
addImport(info);
|
|
154854
|
+
addImport(ts.first(info));
|
|
154841
154855
|
}
|
|
154842
154856
|
function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) {
|
|
154843
154857
|
var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent);
|
|
@@ -154848,13 +154862,12 @@ var ts;
|
|
|
154848
154862
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
154849
154863
|
var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
|
|
154850
154864
|
if (fix) {
|
|
154851
|
-
addImport({
|
|
154865
|
+
addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined });
|
|
154852
154866
|
}
|
|
154853
154867
|
}
|
|
154854
154868
|
function addImport(info) {
|
|
154855
154869
|
var _a, _b;
|
|
154856
|
-
var
|
|
154857
|
-
var fix = ts.first(fixes);
|
|
154870
|
+
var fix = info.fix, symbolName = info.symbolName;
|
|
154858
154871
|
switch (fix.kind) {
|
|
154859
154872
|
case 0 /* UseNamespace */:
|
|
154860
154873
|
addToNamespace.push(fix);
|
|
@@ -155038,7 +155051,7 @@ var ts;
|
|
|
155038
155051
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
155039
155052
|
function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) {
|
|
155040
155053
|
var compilerOptions = program.getCompilerOptions();
|
|
155041
|
-
var symbolName =
|
|
155054
|
+
var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
|
|
155042
155055
|
var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program);
|
|
155043
155056
|
var includeSymbolNameInDescription = symbolName !== symbolToken.text;
|
|
155044
155057
|
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
|
|
@@ -155343,7 +155356,7 @@ var ts;
|
|
|
155343
155356
|
return { kind: 3 /* AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire };
|
|
155344
155357
|
}
|
|
155345
155358
|
}
|
|
155346
|
-
function
|
|
155359
|
+
function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
|
|
155347
155360
|
var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos);
|
|
155348
155361
|
var info;
|
|
155349
155362
|
if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) {
|
|
@@ -155353,19 +155366,23 @@ var ts;
|
|
|
155353
155366
|
return undefined;
|
|
155354
155367
|
}
|
|
155355
155368
|
else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) {
|
|
155356
|
-
var symbolName_1 =
|
|
155369
|
+
var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()));
|
|
155357
155370
|
var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program);
|
|
155358
|
-
return fix && {
|
|
155371
|
+
return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }];
|
|
155359
155372
|
}
|
|
155360
155373
|
else {
|
|
155361
155374
|
info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
|
|
155362
155375
|
}
|
|
155363
155376
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
155364
|
-
return info &&
|
|
155377
|
+
return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
|
|
155365
155378
|
}
|
|
155366
|
-
function
|
|
155379
|
+
function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) {
|
|
155367
155380
|
var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); };
|
|
155368
|
-
return ts.sort(fixes, function (a, b) {
|
|
155381
|
+
return ts.sort(fixes, function (a, b) {
|
|
155382
|
+
return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) ||
|
|
155383
|
+
ts.compareValues(a.fix.kind, b.fix.kind) ||
|
|
155384
|
+
compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath);
|
|
155385
|
+
});
|
|
155369
155386
|
}
|
|
155370
155387
|
function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
|
|
155371
155388
|
if (!ts.some(fixes))
|
|
@@ -155416,7 +155433,6 @@ var ts;
|
|
|
155416
155433
|
return 0 /* EqualTo */;
|
|
155417
155434
|
}
|
|
155418
155435
|
function getFixesInfoForUMDImport(_a, token) {
|
|
155419
|
-
var _b;
|
|
155420
155436
|
var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences;
|
|
155421
155437
|
var checker = program.getTypeChecker();
|
|
155422
155438
|
var umdSymbol = getUmdSymbol(token, checker);
|
|
@@ -155428,7 +155444,7 @@ var ts;
|
|
|
155428
155444
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155429
155445
|
var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
|
|
155430
155446
|
var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
|
|
155431
|
-
return {
|
|
155447
|
+
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 }); });
|
|
155432
155448
|
}
|
|
155433
155449
|
function getUmdSymbol(token, checker) {
|
|
155434
155450
|
// try the identifier to see if it is the umd symbol
|
|
@@ -155489,19 +155505,20 @@ var ts;
|
|
|
155489
155505
|
var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences;
|
|
155490
155506
|
var checker = program.getTypeChecker();
|
|
155491
155507
|
var compilerOptions = program.getCompilerOptions();
|
|
155492
|
-
|
|
155493
|
-
|
|
155494
|
-
|
|
155495
|
-
|
|
155496
|
-
|
|
155497
|
-
|
|
155498
|
-
|
|
155499
|
-
|
|
155500
|
-
|
|
155501
|
-
|
|
155502
|
-
|
|
155503
|
-
|
|
155504
|
-
|
|
155508
|
+
return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) {
|
|
155509
|
+
// "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
|
|
155510
|
+
if (symbolName === "default" /* Default */) {
|
|
155511
|
+
return undefined;
|
|
155512
|
+
}
|
|
155513
|
+
var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
|
|
155514
|
+
var useRequire = shouldUseRequire(sourceFile, program);
|
|
155515
|
+
var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
|
|
155516
|
+
var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
|
|
155517
|
+
var _ = _a[0], exportInfos = _a[1];
|
|
155518
|
+
return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
|
|
155519
|
+
}));
|
|
155520
|
+
return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); });
|
|
155521
|
+
});
|
|
155505
155522
|
}
|
|
155506
155523
|
function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) {
|
|
155507
155524
|
var checker = program.getTypeChecker();
|
|
@@ -155513,15 +155530,16 @@ var ts;
|
|
|
155513
155530
|
return undefined;
|
|
155514
155531
|
return { kind: 4 /* PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration };
|
|
155515
155532
|
}
|
|
155516
|
-
function
|
|
155533
|
+
function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) {
|
|
155517
155534
|
var parent = symbolToken.parent;
|
|
155518
155535
|
if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) {
|
|
155519
155536
|
var jsxNamespace = checker.getJsxNamespace(sourceFile);
|
|
155520
155537
|
if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) {
|
|
155521
|
-
|
|
155538
|
+
var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* Value */, /*excludeGlobals*/ false);
|
|
155539
|
+
return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace];
|
|
155522
155540
|
}
|
|
155523
155541
|
}
|
|
155524
|
-
return symbolToken.text;
|
|
155542
|
+
return [symbolToken.text];
|
|
155525
155543
|
}
|
|
155526
155544
|
function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) {
|
|
155527
155545
|
if (ts.isIntrinsicJsxName(symbolToken.text))
|
|
@@ -159730,23 +159748,36 @@ var ts;
|
|
|
159730
159748
|
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
159731
159749
|
*/
|
|
159732
159750
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) {
|
|
159751
|
+
var _a;
|
|
159733
159752
|
if (preserveOptional === void 0) { preserveOptional = 3 /* All */; }
|
|
159734
159753
|
if (isAmbient === void 0) { isAmbient = false; }
|
|
159735
159754
|
var declarations = symbol.getDeclarations();
|
|
159736
|
-
|
|
159737
|
-
return undefined;
|
|
159738
|
-
}
|
|
159755
|
+
var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0];
|
|
159739
159756
|
var checker = context.program.getTypeChecker();
|
|
159740
159757
|
var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions());
|
|
159741
|
-
|
|
159758
|
+
/**
|
|
159759
|
+
* (#49811)
|
|
159760
|
+
* Note that there are cases in which the symbol declaration is not present. For example, in the code below both
|
|
159761
|
+
* `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type
|
|
159762
|
+
* parent):
|
|
159763
|
+
*
|
|
159764
|
+
* >>> ```ts
|
|
159765
|
+
* >>> type Base = { ax: number; ay: string };
|
|
159766
|
+
* >>> type BaseKeys = keyof Base;
|
|
159767
|
+
* >>> type MappedIndirect = { [K in BaseKeys]: boolean };
|
|
159768
|
+
* >>> ```
|
|
159769
|
+
*
|
|
159770
|
+
* In such cases, we assume the declaration to be a `PropertySignature`.
|
|
159771
|
+
*/
|
|
159772
|
+
var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 166 /* PropertySignature */;
|
|
159742
159773
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
159743
|
-
var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration));
|
|
159774
|
+
var visibilityModifier = createVisibilityModifier(declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* None */);
|
|
159744
159775
|
var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
|
|
159745
159776
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
159746
159777
|
var optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
159747
159778
|
var ambient = !!(enclosingDeclaration.flags & 16777216 /* Ambient */) || isAmbient;
|
|
159748
159779
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
159749
|
-
switch (
|
|
159780
|
+
switch (kind) {
|
|
159750
159781
|
case 166 /* PropertySignature */:
|
|
159751
159782
|
case 167 /* PropertyDeclaration */:
|
|
159752
159783
|
var flags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : undefined;
|
|
@@ -159758,11 +159789,12 @@ var ts;
|
|
|
159758
159789
|
importSymbols(importAdder, importableReference.symbols);
|
|
159759
159790
|
}
|
|
159760
159791
|
}
|
|
159761
|
-
addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
159792
|
+
addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? name : symbol.getName(), optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
159762
159793
|
/*initializer*/ undefined));
|
|
159763
159794
|
break;
|
|
159764
159795
|
case 172 /* GetAccessor */:
|
|
159765
159796
|
case 173 /* SetAccessor */: {
|
|
159797
|
+
ts.Debug.assertIsDefined(declarations);
|
|
159766
159798
|
var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
|
159767
159799
|
var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
|
|
159768
159800
|
var orderedAccessors = allAccessors.secondAccessor
|
|
@@ -159798,6 +159830,7 @@ var ts;
|
|
|
159798
159830
|
// If there is more than one overload but no implementation signature
|
|
159799
159831
|
// (eg: an abstract method or interface declaration), there is a 1-1
|
|
159800
159832
|
// correspondence of declarations and signatures.
|
|
159833
|
+
ts.Debug.assertIsDefined(declarations);
|
|
159801
159834
|
var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures();
|
|
159802
159835
|
if (!ts.some(signatures)) {
|
|
159803
159836
|
break;
|
|
@@ -159808,8 +159841,8 @@ var ts;
|
|
|
159808
159841
|
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
|
|
159809
159842
|
break;
|
|
159810
159843
|
}
|
|
159811
|
-
for (var
|
|
159812
|
-
var signature = signatures_1[
|
|
159844
|
+
for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) {
|
|
159845
|
+
var signature = signatures_1[_b];
|
|
159813
159846
|
// Ensure nodes are fresh so they can have different positions when going through formatting.
|
|
159814
159847
|
outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
|
|
159815
159848
|
}
|