typescript 4.6.0-dev.20220118 → 4.6.0-dev.20220119
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.dom.d.ts +145 -59
- package/lib/lib.dom.iterable.d.ts +7 -0
- package/lib/lib.es2015.iterable.d.ts +2 -1
- package/lib/lib.es2020.intl.d.ts +4 -0
- package/lib/lib.es5.d.ts +0 -2
- package/lib/lib.webworker.d.ts +80 -17
- package/lib/lib.webworker.iterable.d.ts +7 -0
- package/lib/protocol.d.ts +1 -0
- package/lib/tsc.js +37 -14
- package/lib/tsserver.js +74 -45
- package/lib/tsserverlibrary.d.ts +2 -0
- package/lib/tsserverlibrary.js +74 -45
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +60 -43
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +60 -43
- package/lib/typingsInstaller.js +41 -15
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220119";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -44691,7 +44691,7 @@ var ts;
|
|
|
44691
44691
|
maybeBindExpressionFlowIfCall(node.expression);
|
|
44692
44692
|
}
|
|
44693
44693
|
function maybeBindExpressionFlowIfCall(node) {
|
|
44694
|
-
// A top level or
|
|
44694
|
+
// A top level or comma expression call expression with a dotted function name and at least one argument
|
|
44695
44695
|
// is potentially an assertion and is therefore included in the control flow.
|
|
44696
44696
|
if (node.kind === 207 /* CallExpression */) {
|
|
44697
44697
|
var call = node;
|
|
@@ -44859,22 +44859,27 @@ var ts;
|
|
|
44859
44859
|
}
|
|
44860
44860
|
return state;
|
|
44861
44861
|
}
|
|
44862
|
-
function onLeft(left, state,
|
|
44862
|
+
function onLeft(left, state, node) {
|
|
44863
44863
|
if (!state.skip) {
|
|
44864
|
-
|
|
44864
|
+
var maybeBound = maybeBind(left);
|
|
44865
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44866
|
+
maybeBindExpressionFlowIfCall(left);
|
|
44867
|
+
}
|
|
44868
|
+
return maybeBound;
|
|
44865
44869
|
}
|
|
44866
44870
|
}
|
|
44867
|
-
function onOperator(operatorToken, state,
|
|
44871
|
+
function onOperator(operatorToken, state, _node) {
|
|
44868
44872
|
if (!state.skip) {
|
|
44869
|
-
if (operatorToken.kind === 27 /* CommaToken */) {
|
|
44870
|
-
maybeBindExpressionFlowIfCall(node.left);
|
|
44871
|
-
}
|
|
44872
44873
|
bind(operatorToken);
|
|
44873
44874
|
}
|
|
44874
44875
|
}
|
|
44875
|
-
function onRight(right, state,
|
|
44876
|
+
function onRight(right, state, node) {
|
|
44876
44877
|
if (!state.skip) {
|
|
44877
|
-
|
|
44878
|
+
var maybeBound = maybeBind(right);
|
|
44879
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44880
|
+
maybeBindExpressionFlowIfCall(right);
|
|
44881
|
+
}
|
|
44882
|
+
return maybeBound;
|
|
44878
44883
|
}
|
|
44879
44884
|
}
|
|
44880
44885
|
function onExit(node, state) {
|
|
@@ -51151,6 +51156,7 @@ var ts;
|
|
|
51151
51156
|
getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
|
|
51152
51157
|
getCurrentDirectory: function () { return host.getCurrentDirectory(); },
|
|
51153
51158
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
|
|
51159
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host); },
|
|
51154
51160
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
51155
51161
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
51156
51162
|
getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
|
|
@@ -95723,10 +95729,19 @@ var ts;
|
|
|
95723
95729
|
var _a;
|
|
95724
95730
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95725
95731
|
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
95726
|
-
var args = [tagName, objectProperties
|
|
95732
|
+
var args = [tagName, objectProperties];
|
|
95733
|
+
// function jsx(type, config, maybeKey) {}
|
|
95734
|
+
// "maybeKey" is optional. It is acceptable to use "_jsx" without a third argument
|
|
95735
|
+
if (keyAttr) {
|
|
95736
|
+
args.push(transformJsxAttributeInitializer(keyAttr.initializer));
|
|
95737
|
+
}
|
|
95727
95738
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
95728
95739
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
95729
95740
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
95741
|
+
// "maybeKey" has to be replaced with "void 0" to not break the jsxDEV signature
|
|
95742
|
+
if (keyAttr === undefined) {
|
|
95743
|
+
args.push(factory.createVoidZero());
|
|
95744
|
+
}
|
|
95730
95745
|
// isStaticChildren development flag
|
|
95731
95746
|
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
95732
95747
|
// __source development flag
|
|
@@ -119591,11 +119606,12 @@ var ts;
|
|
|
119591
119606
|
};
|
|
119592
119607
|
}
|
|
119593
119608
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
119609
|
+
var _a;
|
|
119594
119610
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
|
|
119595
119611
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
119596
119612
|
return false;
|
|
119597
119613
|
}
|
|
119598
|
-
return ts.getImpliedNodeFormatForFile(importingSourceFileName,
|
|
119614
|
+
return ts.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
|
|
119599
119615
|
}
|
|
119600
119616
|
function getModuleResolutionHost(host) {
|
|
119601
119617
|
var _a;
|
|
@@ -120155,11 +120171,13 @@ var ts;
|
|
|
120155
120171
|
// For classic resolution, only allow importing from node_modules/@types, not other node_modules
|
|
120156
120172
|
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
|
|
120157
120173
|
function tryDirectoryWithPackageJson(packageRootIndex) {
|
|
120174
|
+
var _a, _b;
|
|
120158
120175
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
120159
120176
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
120160
120177
|
var moduleFileToTry = path;
|
|
120161
|
-
|
|
120162
|
-
|
|
120178
|
+
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
120179
|
+
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
120180
|
+
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
120163
120181
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
120164
120182
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
120165
120183
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
@@ -120998,6 +121016,7 @@ var ts;
|
|
|
120998
121016
|
var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
|
|
120999
121017
|
var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
|
|
121000
121018
|
var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
|
|
121019
|
+
var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
|
|
121001
121020
|
var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
|
|
121002
121021
|
var missingFilePathsRequestedForRelease; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
|
|
121003
121022
|
var hasChangedCompilerOptions = false; // True if the compiler options have changed between compilations
|
|
@@ -121160,14 +121179,21 @@ var ts;
|
|
|
121160
121179
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
|
|
121161
121180
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
121162
121181
|
if (hasChangedConfigFileParsingErrors) {
|
|
121182
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121183
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121184
|
+
}
|
|
121163
121185
|
builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
121164
121186
|
hasChangedConfigFileParsingErrors = false;
|
|
121165
121187
|
}
|
|
121166
121188
|
}
|
|
121167
121189
|
else {
|
|
121190
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121191
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121192
|
+
}
|
|
121168
121193
|
createNewProgram(hasInvalidatedResolution);
|
|
121169
121194
|
}
|
|
121170
121195
|
changesAffectResolution = false; // reset for next sync
|
|
121196
|
+
reportFileChangeDetectedOnCreateProgram = false;
|
|
121171
121197
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
121172
121198
|
host.afterProgramCreate(builderProgram);
|
|
121173
121199
|
}
|
|
@@ -121369,7 +121395,7 @@ var ts;
|
|
|
121369
121395
|
}
|
|
121370
121396
|
function updateProgramWithWatchStatus() {
|
|
121371
121397
|
timerToUpdateProgram = undefined;
|
|
121372
|
-
|
|
121398
|
+
reportFileChangeDetectedOnCreateProgram = true;
|
|
121373
121399
|
updateProgram();
|
|
121374
121400
|
}
|
|
121375
121401
|
function updateProgram() {
|
|
@@ -123893,6 +123919,7 @@ var ts;
|
|
|
123893
123919
|
ScriptElementKind["externalModuleName"] = "external module name";
|
|
123894
123920
|
/**
|
|
123895
123921
|
* <JsxTagName attribute1 attribute2={0} />
|
|
123922
|
+
* @deprecated
|
|
123896
123923
|
*/
|
|
123897
123924
|
ScriptElementKind["jsxAttribute"] = "JSX attribute";
|
|
123898
123925
|
/** String literal */
|
|
@@ -125784,6 +125811,7 @@ var ts;
|
|
|
125784
125811
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
125785
125812
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
|
|
125786
125813
|
getModuleSpecifierCache: ts.maybeBind(host, host.getModuleSpecifierCache),
|
|
125814
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); },
|
|
125787
125815
|
getGlobalTypingsCacheLocation: ts.maybeBind(host, host.getGlobalTypingsCacheLocation),
|
|
125788
125816
|
redirectTargetsMap: program.redirectTargetsMap,
|
|
125789
125817
|
getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
|
|
@@ -129528,6 +129556,7 @@ var ts;
|
|
|
129528
129556
|
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
|
|
129529
129557
|
var _a, _b, _c;
|
|
129530
129558
|
var start = ts.timestamp();
|
|
129559
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
129531
129560
|
var resolutionLimitExceeded = false;
|
|
129532
129561
|
var ambientCount = 0;
|
|
129533
129562
|
var resolvedCount = 0;
|
|
@@ -129550,7 +129579,7 @@ var ts;
|
|
|
129550
129579
|
var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
129551
129580
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
129552
129581
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
129553
|
-
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, shouldGetModuleSpecifierFromCache)
|
|
129582
|
+
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
129554
129583
|
: undefined;
|
|
129555
129584
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
129556
129585
|
resolutionLimitExceeded = true;
|
|
@@ -130948,9 +130977,7 @@ var ts;
|
|
|
130948
130977
|
// GH#39946. Pulling on the type of a node inside of a function with a contextual `this` parameter can result in a circularity
|
|
130949
130978
|
// if the `node` is part of the exprssion of a `yield` or `return`. This circularity doesn't exist at compile time because
|
|
130950
130979
|
// we will check (and cache) the type of `this` *before* checking the type of the node.
|
|
130951
|
-
|
|
130952
|
-
if (!ts.isSourceFile(container) && container.parent)
|
|
130953
|
-
typeChecker.getTypeAtLocation(container);
|
|
130980
|
+
typeChecker.tryGetThisTypeAt(node, /*includeGlobalThis*/ false);
|
|
130954
130981
|
var type = typeChecker.getTypeAtLocation(node).getNonOptionalType();
|
|
130955
130982
|
var insertQuestionDot = false;
|
|
130956
130983
|
if (type.isNullableType()) {
|
|
@@ -141820,18 +141847,7 @@ var ts;
|
|
|
141820
141847
|
}
|
|
141821
141848
|
return unionPropertyKind;
|
|
141822
141849
|
}
|
|
141823
|
-
|
|
141824
|
-
switch (location.parent && location.parent.kind) {
|
|
141825
|
-
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
|
|
141826
|
-
case 279 /* JsxOpeningElement */:
|
|
141827
|
-
case 277 /* JsxElement */:
|
|
141828
|
-
case 278 /* JsxSelfClosingElement */:
|
|
141829
|
-
return location.kind === 79 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
|
|
141830
|
-
case 284 /* JsxAttribute */:
|
|
141831
|
-
return "JSX attribute" /* jsxAttribute */;
|
|
141832
|
-
default:
|
|
141833
|
-
return "property" /* memberVariableElement */;
|
|
141834
|
-
}
|
|
141850
|
+
return "property" /* memberVariableElement */;
|
|
141835
141851
|
}
|
|
141836
141852
|
return "" /* unknown */;
|
|
141837
141853
|
}
|
|
@@ -149823,7 +149839,8 @@ var ts;
|
|
|
149823
149839
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
149824
149840
|
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
149825
149841
|
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
|
|
149826
|
-
|
|
149842
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
149843
|
+
return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter);
|
|
149827
149844
|
}
|
|
149828
149845
|
function codeFixActionToCodeAction(_a) {
|
|
149829
149846
|
var description = _a.description, changes = _a.changes, commands = _a.commands;
|
|
@@ -149878,12 +149895,12 @@ var ts;
|
|
|
149878
149895
|
return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
|
|
149879
149896
|
}
|
|
149880
149897
|
}
|
|
149881
|
-
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, fromCacheOnly) {
|
|
149898
|
+
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
149882
149899
|
var _a = getNewImportFixes(program, importingFile,
|
|
149883
149900
|
/*position*/ undefined,
|
|
149884
149901
|
/*isValidTypeOnlyUseSite*/ false,
|
|
149885
149902
|
/*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
149886
|
-
var result = getBestFix(fixes, importingFile, program,
|
|
149903
|
+
var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host));
|
|
149887
149904
|
return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
|
|
149888
149905
|
}
|
|
149889
149906
|
codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
|
|
@@ -150103,23 +150120,22 @@ var ts;
|
|
|
150103
150120
|
var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
|
|
150104
150121
|
? getFixesInfoForUMDImport(context, symbolToken)
|
|
150105
150122
|
: ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
|
|
150106
|
-
|
|
150123
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
150124
|
+
return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
|
|
150107
150125
|
}
|
|
150108
|
-
function sortFixes(fixes, sourceFile, program,
|
|
150109
|
-
|
|
150110
|
-
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, allowsImportingSpecifier); });
|
|
150126
|
+
function sortFixes(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
150127
|
+
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier); });
|
|
150111
150128
|
}
|
|
150112
|
-
function getBestFix(fixes, sourceFile, program,
|
|
150129
|
+
function getBestFix(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
150113
150130
|
if (!ts.some(fixes))
|
|
150114
150131
|
return;
|
|
150115
150132
|
// These will always be placed first if available, and are better than other kinds
|
|
150116
150133
|
if (fixes[0].kind === 0 /* UseNamespace */ || fixes[0].kind === 2 /* AddToExisting */) {
|
|
150117
150134
|
return fixes[0];
|
|
150118
150135
|
}
|
|
150119
|
-
var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
|
|
150120
150136
|
return fixes.reduce(function (best, fix) {
|
|
150121
150137
|
// Takes true branch of conditional if `fix` is better than `best`
|
|
150122
|
-
return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
150138
|
+
return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
150123
150139
|
});
|
|
150124
150140
|
}
|
|
150125
150141
|
/** @returns `Comparison.LessThan` if `a` is better than `b`. */
|
|
@@ -152971,7 +152987,7 @@ var ts;
|
|
|
152971
152987
|
});
|
|
152972
152988
|
var name = declaration && ts.getNameOfDeclaration(declaration);
|
|
152973
152989
|
return !name || changes.length === 0 ? undefined
|
|
152974
|
-
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token),
|
|
152990
|
+
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getTextOfNode(name)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
|
152975
152991
|
},
|
|
152976
152992
|
fixIds: [fixId],
|
|
152977
152993
|
getAllCodeActions: function (context) {
|
|
@@ -153049,7 +153065,7 @@ var ts;
|
|
|
153049
153065
|
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
|
153050
153066
|
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
|
153051
153067
|
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
|
153052
|
-
annotateVariableDeclaration(changes, importAdder,
|
|
153068
|
+
annotateVariableDeclaration(changes, importAdder, ts.getSourceFileOfNode(symbol.valueDeclaration), symbol.valueDeclaration, program, host, cancellationToken);
|
|
153053
153069
|
importAdder.writeFixes(changes);
|
|
153054
153070
|
return symbol.valueDeclaration;
|
|
153055
153071
|
}
|
|
@@ -161328,6 +161344,7 @@ var ts;
|
|
|
161328
161344
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
161329
161345
|
trace: parseConfigHost.trace,
|
|
161330
161346
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
161347
|
+
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
161331
161348
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
161332
161349
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
161333
161350
|
getParsedCommandLine: getParsedCommandLine,
|
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220119";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -44691,7 +44691,7 @@ var ts;
|
|
|
44691
44691
|
maybeBindExpressionFlowIfCall(node.expression);
|
|
44692
44692
|
}
|
|
44693
44693
|
function maybeBindExpressionFlowIfCall(node) {
|
|
44694
|
-
// A top level or
|
|
44694
|
+
// A top level or comma expression call expression with a dotted function name and at least one argument
|
|
44695
44695
|
// is potentially an assertion and is therefore included in the control flow.
|
|
44696
44696
|
if (node.kind === 207 /* CallExpression */) {
|
|
44697
44697
|
var call = node;
|
|
@@ -44859,22 +44859,27 @@ var ts;
|
|
|
44859
44859
|
}
|
|
44860
44860
|
return state;
|
|
44861
44861
|
}
|
|
44862
|
-
function onLeft(left, state,
|
|
44862
|
+
function onLeft(left, state, node) {
|
|
44863
44863
|
if (!state.skip) {
|
|
44864
|
-
|
|
44864
|
+
var maybeBound = maybeBind(left);
|
|
44865
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44866
|
+
maybeBindExpressionFlowIfCall(left);
|
|
44867
|
+
}
|
|
44868
|
+
return maybeBound;
|
|
44865
44869
|
}
|
|
44866
44870
|
}
|
|
44867
|
-
function onOperator(operatorToken, state,
|
|
44871
|
+
function onOperator(operatorToken, state, _node) {
|
|
44868
44872
|
if (!state.skip) {
|
|
44869
|
-
if (operatorToken.kind === 27 /* CommaToken */) {
|
|
44870
|
-
maybeBindExpressionFlowIfCall(node.left);
|
|
44871
|
-
}
|
|
44872
44873
|
bind(operatorToken);
|
|
44873
44874
|
}
|
|
44874
44875
|
}
|
|
44875
|
-
function onRight(right, state,
|
|
44876
|
+
function onRight(right, state, node) {
|
|
44876
44877
|
if (!state.skip) {
|
|
44877
|
-
|
|
44878
|
+
var maybeBound = maybeBind(right);
|
|
44879
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44880
|
+
maybeBindExpressionFlowIfCall(right);
|
|
44881
|
+
}
|
|
44882
|
+
return maybeBound;
|
|
44878
44883
|
}
|
|
44879
44884
|
}
|
|
44880
44885
|
function onExit(node, state) {
|
|
@@ -51151,6 +51156,7 @@ var ts;
|
|
|
51151
51156
|
getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
|
|
51152
51157
|
getCurrentDirectory: function () { return host.getCurrentDirectory(); },
|
|
51153
51158
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
|
|
51159
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host); },
|
|
51154
51160
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
51155
51161
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
51156
51162
|
getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
|
|
@@ -95723,10 +95729,19 @@ var ts;
|
|
|
95723
95729
|
var _a;
|
|
95724
95730
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95725
95731
|
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
95726
|
-
var args = [tagName, objectProperties
|
|
95732
|
+
var args = [tagName, objectProperties];
|
|
95733
|
+
// function jsx(type, config, maybeKey) {}
|
|
95734
|
+
// "maybeKey" is optional. It is acceptable to use "_jsx" without a third argument
|
|
95735
|
+
if (keyAttr) {
|
|
95736
|
+
args.push(transformJsxAttributeInitializer(keyAttr.initializer));
|
|
95737
|
+
}
|
|
95727
95738
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
95728
95739
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
95729
95740
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
95741
|
+
// "maybeKey" has to be replaced with "void 0" to not break the jsxDEV signature
|
|
95742
|
+
if (keyAttr === undefined) {
|
|
95743
|
+
args.push(factory.createVoidZero());
|
|
95744
|
+
}
|
|
95730
95745
|
// isStaticChildren development flag
|
|
95731
95746
|
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
95732
95747
|
// __source development flag
|
|
@@ -119591,11 +119606,12 @@ var ts;
|
|
|
119591
119606
|
};
|
|
119592
119607
|
}
|
|
119593
119608
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
119609
|
+
var _a;
|
|
119594
119610
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
|
|
119595
119611
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
119596
119612
|
return false;
|
|
119597
119613
|
}
|
|
119598
|
-
return ts.getImpliedNodeFormatForFile(importingSourceFileName,
|
|
119614
|
+
return ts.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
|
|
119599
119615
|
}
|
|
119600
119616
|
function getModuleResolutionHost(host) {
|
|
119601
119617
|
var _a;
|
|
@@ -120155,11 +120171,13 @@ var ts;
|
|
|
120155
120171
|
// For classic resolution, only allow importing from node_modules/@types, not other node_modules
|
|
120156
120172
|
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
|
|
120157
120173
|
function tryDirectoryWithPackageJson(packageRootIndex) {
|
|
120174
|
+
var _a, _b;
|
|
120158
120175
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
120159
120176
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
120160
120177
|
var moduleFileToTry = path;
|
|
120161
|
-
|
|
120162
|
-
|
|
120178
|
+
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
120179
|
+
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
120180
|
+
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
120163
120181
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
120164
120182
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
120165
120183
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
@@ -120998,6 +121016,7 @@ var ts;
|
|
|
120998
121016
|
var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
|
|
120999
121017
|
var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
|
|
121000
121018
|
var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
|
|
121019
|
+
var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
|
|
121001
121020
|
var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
|
|
121002
121021
|
var missingFilePathsRequestedForRelease; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
|
|
121003
121022
|
var hasChangedCompilerOptions = false; // True if the compiler options have changed between compilations
|
|
@@ -121160,14 +121179,21 @@ var ts;
|
|
|
121160
121179
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
|
|
121161
121180
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
121162
121181
|
if (hasChangedConfigFileParsingErrors) {
|
|
121182
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121183
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121184
|
+
}
|
|
121163
121185
|
builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
121164
121186
|
hasChangedConfigFileParsingErrors = false;
|
|
121165
121187
|
}
|
|
121166
121188
|
}
|
|
121167
121189
|
else {
|
|
121190
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121191
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121192
|
+
}
|
|
121168
121193
|
createNewProgram(hasInvalidatedResolution);
|
|
121169
121194
|
}
|
|
121170
121195
|
changesAffectResolution = false; // reset for next sync
|
|
121196
|
+
reportFileChangeDetectedOnCreateProgram = false;
|
|
121171
121197
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
121172
121198
|
host.afterProgramCreate(builderProgram);
|
|
121173
121199
|
}
|
|
@@ -121369,7 +121395,7 @@ var ts;
|
|
|
121369
121395
|
}
|
|
121370
121396
|
function updateProgramWithWatchStatus() {
|
|
121371
121397
|
timerToUpdateProgram = undefined;
|
|
121372
|
-
|
|
121398
|
+
reportFileChangeDetectedOnCreateProgram = true;
|
|
121373
121399
|
updateProgram();
|
|
121374
121400
|
}
|
|
121375
121401
|
function updateProgram() {
|
|
@@ -123893,6 +123919,7 @@ var ts;
|
|
|
123893
123919
|
ScriptElementKind["externalModuleName"] = "external module name";
|
|
123894
123920
|
/**
|
|
123895
123921
|
* <JsxTagName attribute1 attribute2={0} />
|
|
123922
|
+
* @deprecated
|
|
123896
123923
|
*/
|
|
123897
123924
|
ScriptElementKind["jsxAttribute"] = "JSX attribute";
|
|
123898
123925
|
/** String literal */
|
|
@@ -125784,6 +125811,7 @@ var ts;
|
|
|
125784
125811
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
125785
125812
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
|
|
125786
125813
|
getModuleSpecifierCache: ts.maybeBind(host, host.getModuleSpecifierCache),
|
|
125814
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); },
|
|
125787
125815
|
getGlobalTypingsCacheLocation: ts.maybeBind(host, host.getGlobalTypingsCacheLocation),
|
|
125788
125816
|
redirectTargetsMap: program.redirectTargetsMap,
|
|
125789
125817
|
getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
|
|
@@ -129528,6 +129556,7 @@ var ts;
|
|
|
129528
129556
|
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
|
|
129529
129557
|
var _a, _b, _c;
|
|
129530
129558
|
var start = ts.timestamp();
|
|
129559
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
129531
129560
|
var resolutionLimitExceeded = false;
|
|
129532
129561
|
var ambientCount = 0;
|
|
129533
129562
|
var resolvedCount = 0;
|
|
@@ -129550,7 +129579,7 @@ var ts;
|
|
|
129550
129579
|
var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
129551
129580
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
129552
129581
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
129553
|
-
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, shouldGetModuleSpecifierFromCache)
|
|
129582
|
+
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
129554
129583
|
: undefined;
|
|
129555
129584
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
129556
129585
|
resolutionLimitExceeded = true;
|
|
@@ -130948,9 +130977,7 @@ var ts;
|
|
|
130948
130977
|
// GH#39946. Pulling on the type of a node inside of a function with a contextual `this` parameter can result in a circularity
|
|
130949
130978
|
// if the `node` is part of the exprssion of a `yield` or `return`. This circularity doesn't exist at compile time because
|
|
130950
130979
|
// we will check (and cache) the type of `this` *before* checking the type of the node.
|
|
130951
|
-
|
|
130952
|
-
if (!ts.isSourceFile(container) && container.parent)
|
|
130953
|
-
typeChecker.getTypeAtLocation(container);
|
|
130980
|
+
typeChecker.tryGetThisTypeAt(node, /*includeGlobalThis*/ false);
|
|
130954
130981
|
var type = typeChecker.getTypeAtLocation(node).getNonOptionalType();
|
|
130955
130982
|
var insertQuestionDot = false;
|
|
130956
130983
|
if (type.isNullableType()) {
|
|
@@ -141820,18 +141847,7 @@ var ts;
|
|
|
141820
141847
|
}
|
|
141821
141848
|
return unionPropertyKind;
|
|
141822
141849
|
}
|
|
141823
|
-
|
|
141824
|
-
switch (location.parent && location.parent.kind) {
|
|
141825
|
-
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
|
|
141826
|
-
case 279 /* JsxOpeningElement */:
|
|
141827
|
-
case 277 /* JsxElement */:
|
|
141828
|
-
case 278 /* JsxSelfClosingElement */:
|
|
141829
|
-
return location.kind === 79 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
|
|
141830
|
-
case 284 /* JsxAttribute */:
|
|
141831
|
-
return "JSX attribute" /* jsxAttribute */;
|
|
141832
|
-
default:
|
|
141833
|
-
return "property" /* memberVariableElement */;
|
|
141834
|
-
}
|
|
141850
|
+
return "property" /* memberVariableElement */;
|
|
141835
141851
|
}
|
|
141836
141852
|
return "" /* unknown */;
|
|
141837
141853
|
}
|
|
@@ -149823,7 +149839,8 @@ var ts;
|
|
|
149823
149839
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
149824
149840
|
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
149825
149841
|
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
|
|
149826
|
-
|
|
149842
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
149843
|
+
return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter);
|
|
149827
149844
|
}
|
|
149828
149845
|
function codeFixActionToCodeAction(_a) {
|
|
149829
149846
|
var description = _a.description, changes = _a.changes, commands = _a.commands;
|
|
@@ -149878,12 +149895,12 @@ var ts;
|
|
|
149878
149895
|
return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
|
|
149879
149896
|
}
|
|
149880
149897
|
}
|
|
149881
|
-
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, fromCacheOnly) {
|
|
149898
|
+
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
149882
149899
|
var _a = getNewImportFixes(program, importingFile,
|
|
149883
149900
|
/*position*/ undefined,
|
|
149884
149901
|
/*isValidTypeOnlyUseSite*/ false,
|
|
149885
149902
|
/*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
149886
|
-
var result = getBestFix(fixes, importingFile, program,
|
|
149903
|
+
var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host));
|
|
149887
149904
|
return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
|
|
149888
149905
|
}
|
|
149889
149906
|
codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
|
|
@@ -150103,23 +150120,22 @@ var ts;
|
|
|
150103
150120
|
var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
|
|
150104
150121
|
? getFixesInfoForUMDImport(context, symbolToken)
|
|
150105
150122
|
: ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
|
|
150106
|
-
|
|
150123
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
150124
|
+
return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
|
|
150107
150125
|
}
|
|
150108
|
-
function sortFixes(fixes, sourceFile, program,
|
|
150109
|
-
|
|
150110
|
-
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, allowsImportingSpecifier); });
|
|
150126
|
+
function sortFixes(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
150127
|
+
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier); });
|
|
150111
150128
|
}
|
|
150112
|
-
function getBestFix(fixes, sourceFile, program,
|
|
150129
|
+
function getBestFix(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
150113
150130
|
if (!ts.some(fixes))
|
|
150114
150131
|
return;
|
|
150115
150132
|
// These will always be placed first if available, and are better than other kinds
|
|
150116
150133
|
if (fixes[0].kind === 0 /* UseNamespace */ || fixes[0].kind === 2 /* AddToExisting */) {
|
|
150117
150134
|
return fixes[0];
|
|
150118
150135
|
}
|
|
150119
|
-
var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
|
|
150120
150136
|
return fixes.reduce(function (best, fix) {
|
|
150121
150137
|
// Takes true branch of conditional if `fix` is better than `best`
|
|
150122
|
-
return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
150138
|
+
return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
150123
150139
|
});
|
|
150124
150140
|
}
|
|
150125
150141
|
/** @returns `Comparison.LessThan` if `a` is better than `b`. */
|
|
@@ -152971,7 +152987,7 @@ var ts;
|
|
|
152971
152987
|
});
|
|
152972
152988
|
var name = declaration && ts.getNameOfDeclaration(declaration);
|
|
152973
152989
|
return !name || changes.length === 0 ? undefined
|
|
152974
|
-
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token),
|
|
152990
|
+
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getTextOfNode(name)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
|
152975
152991
|
},
|
|
152976
152992
|
fixIds: [fixId],
|
|
152977
152993
|
getAllCodeActions: function (context) {
|
|
@@ -153049,7 +153065,7 @@ var ts;
|
|
|
153049
153065
|
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
|
153050
153066
|
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
|
153051
153067
|
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
|
153052
|
-
annotateVariableDeclaration(changes, importAdder,
|
|
153068
|
+
annotateVariableDeclaration(changes, importAdder, ts.getSourceFileOfNode(symbol.valueDeclaration), symbol.valueDeclaration, program, host, cancellationToken);
|
|
153053
153069
|
importAdder.writeFixes(changes);
|
|
153054
153070
|
return symbol.valueDeclaration;
|
|
153055
153071
|
}
|
|
@@ -161328,6 +161344,7 @@ var ts;
|
|
|
161328
161344
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
161329
161345
|
trace: parseConfigHost.trace,
|
|
161330
161346
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
161347
|
+
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
161331
161348
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
161332
161349
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
161333
161350
|
getParsedCommandLine: getParsedCommandLine,
|