typescript 4.5.2 → 4.5.3
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 +1 -1
- package/lib/tsc.js +64 -47
- package/lib/tsserver.js +81 -62
- package/lib/tsserverlibrary.js +81 -62
- package/lib/typescript.js +81 -62
- package/lib/typescriptServices.js +81 -62
- package/lib/typingsInstaller.js +81 -62
- package/package.json +2 -2
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1515,7 +1515,7 @@ interface Promise<T> {
|
|
|
1515
1515
|
type Awaited<T> =
|
|
1516
1516
|
T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
|
|
1517
1517
|
T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
|
|
1518
|
-
F extends ((value: infer V) => any) ? // if the argument to `then` is callable, extracts the argument
|
|
1518
|
+
F extends ((value: infer V, ...args: any) => any) ? // if the argument to `then` is callable, extracts the first argument
|
|
1519
1519
|
Awaited<V> : // recursively unwrap the value
|
|
1520
1520
|
never : // the argument to `then` was not callable
|
|
1521
1521
|
T; // non-object or non-thenable
|
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.5";
|
|
72
|
-
ts.version = "4.5.
|
|
72
|
+
ts.version = "4.5.3";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -33801,7 +33801,10 @@ var ts;
|
|
|
33801
33801
|
}
|
|
33802
33802
|
}
|
|
33803
33803
|
var failedLookupLocations = [];
|
|
33804
|
-
var
|
|
33804
|
+
var features = ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 ? NodeResolutionFeatures.Node12Default :
|
|
33805
|
+
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
33806
|
+
NodeResolutionFeatures.None;
|
|
33807
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: ["node", "require", "types"] };
|
|
33805
33808
|
var resolved = primaryLookup();
|
|
33806
33809
|
var primary = true;
|
|
33807
33810
|
if (!resolved) {
|
|
@@ -34354,13 +34357,15 @@ var ts;
|
|
|
34354
34357
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
34355
34358
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
34356
34359
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
34360
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node12Default"] = 14] = "Node12Default";
|
|
34361
|
+
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
34357
34362
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
34358
34363
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
34359
34364
|
function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
34360
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
34365
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node12Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
34361
34366
|
}
|
|
34362
34367
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
34363
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
34368
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
34364
34369
|
}
|
|
34365
34370
|
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
34366
34371
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
@@ -39437,11 +39442,12 @@ var ts;
|
|
|
39437
39442
|
}
|
|
39438
39443
|
}
|
|
39439
39444
|
}
|
|
39440
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
|
|
39445
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
|
|
39441
39446
|
if (excludeGlobals === void 0) { excludeGlobals = false; }
|
|
39442
|
-
|
|
39447
|
+
if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
|
|
39448
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
|
|
39443
39449
|
}
|
|
39444
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
|
|
39450
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
39445
39451
|
var _a, _b, _c;
|
|
39446
39452
|
var originalLocation = location;
|
|
39447
39453
|
var result;
|
|
@@ -39676,7 +39682,7 @@ var ts;
|
|
|
39676
39682
|
}
|
|
39677
39683
|
}
|
|
39678
39684
|
if (!result) {
|
|
39679
|
-
if (nameNotFoundMessage) {
|
|
39685
|
+
if (nameNotFoundMessage && produceDiagnostics) {
|
|
39680
39686
|
if (!errorLocation ||
|
|
39681
39687
|
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
|
|
39682
39688
|
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
|
@@ -39686,7 +39692,7 @@ var ts;
|
|
|
39686
39692
|
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
39687
39693
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
39688
39694
|
var suggestion = void 0;
|
|
39689
|
-
if (suggestionCount < maximumSuggestionCount) {
|
|
39695
|
+
if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
39690
39696
|
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
39691
39697
|
var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
39692
39698
|
if (isGlobalScopeAugmentationDeclaration) {
|
|
@@ -39721,7 +39727,7 @@ var ts;
|
|
|
39721
39727
|
}
|
|
39722
39728
|
return undefined;
|
|
39723
39729
|
}
|
|
39724
|
-
if (nameNotFoundMessage) {
|
|
39730
|
+
if (nameNotFoundMessage && produceDiagnostics) {
|
|
39725
39731
|
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
|
|
39726
39732
|
var propertyName = propertyWithInvalidInitializer.name;
|
|
39727
39733
|
error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
|
|
@@ -48789,7 +48795,7 @@ var ts;
|
|
|
48789
48795
|
return symbol;
|
|
48790
48796
|
}
|
|
48791
48797
|
function getGlobalSymbol(name, meaning, diagnostic) {
|
|
48792
|
-
return resolveName(undefined, name, meaning, diagnostic, name, false);
|
|
48798
|
+
return resolveName(undefined, name, meaning, diagnostic, name, false, false, false);
|
|
48793
48799
|
}
|
|
48794
48800
|
function getGlobalType(name, arity, reportErrors) {
|
|
48795
48801
|
var symbol = getGlobalTypeSymbol(name, reportErrors);
|
|
@@ -52261,7 +52267,7 @@ var ts;
|
|
|
52261
52267
|
return true;
|
|
52262
52268
|
}
|
|
52263
52269
|
if (source.flags & 524288 && target.flags & 524288) {
|
|
52264
|
-
var related = relation.get(getRelationKey(source, target, 0, relation));
|
|
52270
|
+
var related = relation.get(getRelationKey(source, target, 0, relation, false));
|
|
52265
52271
|
if (related !== undefined) {
|
|
52266
52272
|
return !!(related & 1);
|
|
52267
52273
|
}
|
|
@@ -52975,7 +52981,8 @@ var ts;
|
|
|
52975
52981
|
if (overflow) {
|
|
52976
52982
|
return 0;
|
|
52977
52983
|
}
|
|
52978
|
-
var
|
|
52984
|
+
var keyIntersectionState = intersectionState | (inPropertyCheck ? 16 : 0);
|
|
52985
|
+
var id = getRelationKey(source, target, keyIntersectionState, relation, false);
|
|
52979
52986
|
var entry = relation.get(id);
|
|
52980
52987
|
if (entry !== undefined) {
|
|
52981
52988
|
if (reportErrors && entry & 2 && !(entry & 4)) {
|
|
@@ -52999,12 +53006,9 @@ var ts;
|
|
|
52999
53006
|
targetStack = [];
|
|
53000
53007
|
}
|
|
53001
53008
|
else {
|
|
53002
|
-
var broadestEquivalentId = id.
|
|
53003
|
-
var index = ts.length(id.slice(0, offset).match(/[-=]/g) || undefined);
|
|
53004
|
-
return "=".concat(index);
|
|
53005
|
-
}); }).join(",");
|
|
53009
|
+
var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, true) : undefined;
|
|
53006
53010
|
for (var i = 0; i < maybeCount; i++) {
|
|
53007
|
-
if (id === maybeKeys[i] || broadestEquivalentId === maybeKeys[i]) {
|
|
53011
|
+
if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
|
|
53008
53012
|
return 3;
|
|
53009
53013
|
}
|
|
53010
53014
|
}
|
|
@@ -54278,40 +54282,48 @@ var ts;
|
|
|
54278
54282
|
function isTypeReferenceWithGenericArguments(type) {
|
|
54279
54283
|
return isNonDeferredTypeReference(type) && ts.some(getTypeArguments(type), function (t) { return !!(t.flags & 262144) || isTypeReferenceWithGenericArguments(t); });
|
|
54280
54284
|
}
|
|
54281
|
-
function
|
|
54282
|
-
|
|
54283
|
-
var
|
|
54284
|
-
|
|
54285
|
-
|
|
54286
|
-
|
|
54287
|
-
|
|
54288
|
-
|
|
54289
|
-
|
|
54290
|
-
|
|
54285
|
+
function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) {
|
|
54286
|
+
var typeParameters = [];
|
|
54287
|
+
var constraintMarker = "";
|
|
54288
|
+
var sourceId = getTypeReferenceId(source, 0);
|
|
54289
|
+
var targetId = getTypeReferenceId(target, 0);
|
|
54290
|
+
return "".concat(constraintMarker).concat(sourceId, ",").concat(targetId).concat(postFix);
|
|
54291
|
+
function getTypeReferenceId(type, depth) {
|
|
54292
|
+
if (depth === void 0) { depth = 0; }
|
|
54293
|
+
var result = "" + type.target.id;
|
|
54294
|
+
for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) {
|
|
54295
|
+
var t = _a[_i];
|
|
54296
|
+
if (t.flags & 262144) {
|
|
54297
|
+
if (ignoreConstraints || isUnconstrainedTypeParameter(t)) {
|
|
54298
|
+
var index = typeParameters.indexOf(t);
|
|
54299
|
+
if (index < 0) {
|
|
54300
|
+
index = typeParameters.length;
|
|
54301
|
+
typeParameters.push(t);
|
|
54302
|
+
}
|
|
54303
|
+
result += "=" + index;
|
|
54304
|
+
continue;
|
|
54305
|
+
}
|
|
54306
|
+
constraintMarker = "*";
|
|
54307
|
+
}
|
|
54308
|
+
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
54309
|
+
result += "<" + getTypeReferenceId(t, depth + 1) + ">";
|
|
54310
|
+
continue;
|
|
54291
54311
|
}
|
|
54292
|
-
result += "=" + index;
|
|
54293
|
-
}
|
|
54294
|
-
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
54295
|
-
result += "<" + getTypeReferenceId(t, typeParameters, depth + 1) + ">";
|
|
54296
|
-
}
|
|
54297
|
-
else {
|
|
54298
54312
|
result += "-" + t.id;
|
|
54299
54313
|
}
|
|
54314
|
+
return result;
|
|
54300
54315
|
}
|
|
54301
|
-
return result;
|
|
54302
54316
|
}
|
|
54303
|
-
function getRelationKey(source, target, intersectionState, relation) {
|
|
54317
|
+
function getRelationKey(source, target, intersectionState, relation, ignoreConstraints) {
|
|
54304
54318
|
if (relation === identityRelation && source.id > target.id) {
|
|
54305
54319
|
var temp = source;
|
|
54306
54320
|
source = target;
|
|
54307
54321
|
target = temp;
|
|
54308
54322
|
}
|
|
54309
54323
|
var postFix = intersectionState ? ":" + intersectionState : "";
|
|
54310
|
-
|
|
54311
|
-
|
|
54312
|
-
|
|
54313
|
-
}
|
|
54314
|
-
return source.id + "," + target.id + postFix;
|
|
54324
|
+
return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ?
|
|
54325
|
+
getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) :
|
|
54326
|
+
"".concat(source.id, ",").concat(target.id).concat(postFix);
|
|
54315
54327
|
}
|
|
54316
54328
|
function forEachProperty(prop, callback) {
|
|
54317
54329
|
if (ts.getCheckFlags(prop) & 6) {
|
|
@@ -54350,16 +54362,21 @@ var ts;
|
|
|
54350
54362
|
!hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass;
|
|
54351
54363
|
}
|
|
54352
54364
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
54353
|
-
if (maxDepth === void 0) { maxDepth =
|
|
54365
|
+
if (maxDepth === void 0) { maxDepth = 3; }
|
|
54354
54366
|
if (depth >= maxDepth) {
|
|
54355
54367
|
var identity_1 = getRecursionIdentity(type);
|
|
54356
54368
|
var count = 0;
|
|
54369
|
+
var lastTypeId = 0;
|
|
54357
54370
|
for (var i = 0; i < depth; i++) {
|
|
54358
|
-
|
|
54359
|
-
|
|
54360
|
-
if (
|
|
54361
|
-
|
|
54371
|
+
var t = stack[i];
|
|
54372
|
+
if (getRecursionIdentity(t) === identity_1) {
|
|
54373
|
+
if (t.id >= lastTypeId) {
|
|
54374
|
+
count++;
|
|
54375
|
+
if (count >= maxDepth) {
|
|
54376
|
+
return true;
|
|
54377
|
+
}
|
|
54362
54378
|
}
|
|
54379
|
+
lastTypeId = t.id;
|
|
54363
54380
|
}
|
|
54364
54381
|
}
|
|
54365
54382
|
}
|
|
@@ -60884,7 +60901,7 @@ var ts;
|
|
|
60884
60901
|
}
|
|
60885
60902
|
function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
|
|
60886
60903
|
ts.Debug.assert(outerName !== undefined, "outername should always be defined");
|
|
60887
|
-
var result = resolveNameHelper(location, outerName, meaning, undefined, outerName, false, false, function (symbols, name, meaning) {
|
|
60904
|
+
var result = resolveNameHelper(location, outerName, meaning, undefined, outerName, false, false, true, function (symbols, name, meaning) {
|
|
60888
60905
|
ts.Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
60889
60906
|
var symbol = getSymbol(symbols, name, meaning);
|
|
60890
60907
|
if (symbol)
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = "4.5.
|
|
103
|
+
ts.version = "4.5.3";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -41459,7 +41459,10 @@ var ts;
|
|
|
41459
41459
|
}
|
|
41460
41460
|
}
|
|
41461
41461
|
var failedLookupLocations = [];
|
|
41462
|
-
var
|
|
41462
|
+
var features = ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 ? NodeResolutionFeatures.Node12Default :
|
|
41463
|
+
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
41464
|
+
NodeResolutionFeatures.None;
|
|
41465
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: ["node", "require", "types"] };
|
|
41463
41466
|
var resolved = primaryLookup();
|
|
41464
41467
|
var primary = true;
|
|
41465
41468
|
if (!resolved) {
|
|
@@ -42134,13 +42137,15 @@ var ts;
|
|
|
42134
42137
|
// not currently backported to node 12 - https://github.com/nodejs/Release/issues/690
|
|
42135
42138
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
42136
42139
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
42140
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node12Default"] = 14] = "Node12Default";
|
|
42141
|
+
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
42137
42142
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
42138
42143
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
42139
42144
|
function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
42140
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
42145
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node12Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
42141
42146
|
}
|
|
42142
42147
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
42143
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
42148
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
42144
42149
|
}
|
|
42145
42150
|
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
42146
42151
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
@@ -48103,11 +48108,12 @@ var ts;
|
|
|
48103
48108
|
*
|
|
48104
48109
|
* @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
|
|
48105
48110
|
*/
|
|
48106
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
|
|
48111
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
|
|
48107
48112
|
if (excludeGlobals === void 0) { excludeGlobals = false; }
|
|
48108
|
-
|
|
48113
|
+
if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
|
|
48114
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
|
|
48109
48115
|
}
|
|
48110
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
|
|
48116
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
48111
48117
|
var _a, _b, _c;
|
|
48112
48118
|
var originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location
|
|
48113
48119
|
var result;
|
|
@@ -48424,7 +48430,7 @@ var ts;
|
|
|
48424
48430
|
}
|
|
48425
48431
|
}
|
|
48426
48432
|
if (!result) {
|
|
48427
|
-
if (nameNotFoundMessage) {
|
|
48433
|
+
if (nameNotFoundMessage && produceDiagnostics) {
|
|
48428
48434
|
if (!errorLocation ||
|
|
48429
48435
|
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
|
|
48430
48436
|
!checkAndReportErrorForExtendingInterface(errorLocation) &&
|
|
@@ -48434,7 +48440,7 @@ var ts;
|
|
|
48434
48440
|
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
48435
48441
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
48436
48442
|
var suggestion = void 0;
|
|
48437
|
-
if (suggestionCount < maximumSuggestionCount) {
|
|
48443
|
+
if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
48438
48444
|
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
48439
48445
|
var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
48440
48446
|
if (isGlobalScopeAugmentationDeclaration) {
|
|
@@ -48470,7 +48476,7 @@ var ts;
|
|
|
48470
48476
|
return undefined;
|
|
48471
48477
|
}
|
|
48472
48478
|
// Perform extra checks only if error reporting was requested
|
|
48473
|
-
if (nameNotFoundMessage) {
|
|
48479
|
+
if (nameNotFoundMessage && produceDiagnostics) {
|
|
48474
48480
|
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields)) {
|
|
48475
48481
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
48476
48482
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
@@ -58875,7 +58881,7 @@ var ts;
|
|
|
58875
58881
|
}
|
|
58876
58882
|
function getGlobalSymbol(name, meaning, diagnostic) {
|
|
58877
58883
|
// Don't track references for global symbols anyway, so value if `isReference` is arbitrary
|
|
58878
|
-
return resolveName(undefined, name, meaning, diagnostic, name, /*isUse*/ false);
|
|
58884
|
+
return resolveName(undefined, name, meaning, diagnostic, name, /*isUse*/ false, /*excludeGlobals*/ false, /*getSpellingSuggestions*/ false);
|
|
58879
58885
|
}
|
|
58880
58886
|
function getGlobalType(name, arity, reportErrors) {
|
|
58881
58887
|
var symbol = getGlobalTypeSymbol(name, reportErrors);
|
|
@@ -62745,7 +62751,7 @@ var ts;
|
|
|
62745
62751
|
return true;
|
|
62746
62752
|
}
|
|
62747
62753
|
if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
|
|
62748
|
-
var related = relation.get(getRelationKey(source, target, 0 /* None */, relation));
|
|
62754
|
+
var related = relation.get(getRelationKey(source, target, 0 /* None */, relation, /*ignoreConstraints*/ false));
|
|
62749
62755
|
if (related !== undefined) {
|
|
62750
62756
|
return !!(related & 1 /* Succeeded */);
|
|
62751
62757
|
}
|
|
@@ -63594,7 +63600,8 @@ var ts;
|
|
|
63594
63600
|
if (overflow) {
|
|
63595
63601
|
return 0 /* False */;
|
|
63596
63602
|
}
|
|
63597
|
-
var
|
|
63603
|
+
var keyIntersectionState = intersectionState | (inPropertyCheck ? 16 /* InPropertyCheck */ : 0);
|
|
63604
|
+
var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
|
|
63598
63605
|
var entry = relation.get(id);
|
|
63599
63606
|
if (entry !== undefined) {
|
|
63600
63607
|
if (reportErrors && entry & 2 /* Failed */ && !(entry & 4 /* Reported */)) {
|
|
@@ -63621,16 +63628,13 @@ var ts;
|
|
|
63621
63628
|
targetStack = [];
|
|
63622
63629
|
}
|
|
63623
63630
|
else {
|
|
63624
|
-
//
|
|
63625
|
-
//
|
|
63626
|
-
//
|
|
63627
|
-
var broadestEquivalentId = id.
|
|
63628
|
-
var index = ts.length(id.slice(0, offset).match(/[-=]/g) || undefined);
|
|
63629
|
-
return "=".concat(index);
|
|
63630
|
-
}); }).join(",");
|
|
63631
|
+
// A key that starts with "*" is an indication that we have type references that reference constrained
|
|
63632
|
+
// type parameters. For such keys we also check against the key we would have gotten if all type parameters
|
|
63633
|
+
// were unconstrained.
|
|
63634
|
+
var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
|
|
63631
63635
|
for (var i = 0; i < maybeCount; i++) {
|
|
63632
63636
|
// If source and target are already being compared, consider them related with assumptions
|
|
63633
|
-
if (id === maybeKeys[i] || broadestEquivalentId === maybeKeys[i]) {
|
|
63637
|
+
if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
|
|
63634
63638
|
return 3 /* Maybe */;
|
|
63635
63639
|
}
|
|
63636
63640
|
}
|
|
@@ -65137,48 +65141,56 @@ var ts;
|
|
|
65137
65141
|
function isTypeReferenceWithGenericArguments(type) {
|
|
65138
65142
|
return isNonDeferredTypeReference(type) && ts.some(getTypeArguments(type), function (t) { return !!(t.flags & 262144 /* TypeParameter */) || isTypeReferenceWithGenericArguments(t); });
|
|
65139
65143
|
}
|
|
65140
|
-
|
|
65141
|
-
|
|
65142
|
-
|
|
65143
|
-
|
|
65144
|
-
|
|
65145
|
-
|
|
65146
|
-
|
|
65147
|
-
|
|
65148
|
-
|
|
65149
|
-
if (
|
|
65150
|
-
|
|
65151
|
-
|
|
65152
|
-
|
|
65153
|
-
|
|
65144
|
+
function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) {
|
|
65145
|
+
var typeParameters = [];
|
|
65146
|
+
var constraintMarker = "";
|
|
65147
|
+
var sourceId = getTypeReferenceId(source, 0);
|
|
65148
|
+
var targetId = getTypeReferenceId(target, 0);
|
|
65149
|
+
return "".concat(constraintMarker).concat(sourceId, ",").concat(targetId).concat(postFix);
|
|
65150
|
+
// getTypeReferenceId(A<T, number, U>) returns "111=0-12=1"
|
|
65151
|
+
// where A.id=111 and number.id=12
|
|
65152
|
+
function getTypeReferenceId(type, depth) {
|
|
65153
|
+
if (depth === void 0) { depth = 0; }
|
|
65154
|
+
var result = "" + type.target.id;
|
|
65155
|
+
for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) {
|
|
65156
|
+
var t = _a[_i];
|
|
65157
|
+
if (t.flags & 262144 /* TypeParameter */) {
|
|
65158
|
+
if (ignoreConstraints || isUnconstrainedTypeParameter(t)) {
|
|
65159
|
+
var index = typeParameters.indexOf(t);
|
|
65160
|
+
if (index < 0) {
|
|
65161
|
+
index = typeParameters.length;
|
|
65162
|
+
typeParameters.push(t);
|
|
65163
|
+
}
|
|
65164
|
+
result += "=" + index;
|
|
65165
|
+
continue;
|
|
65166
|
+
}
|
|
65167
|
+
// We mark type references that reference constrained type parameters such that we know to obtain
|
|
65168
|
+
// and look for a "broadest equivalent key" in the cache.
|
|
65169
|
+
constraintMarker = "*";
|
|
65170
|
+
}
|
|
65171
|
+
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
65172
|
+
result += "<" + getTypeReferenceId(t, depth + 1) + ">";
|
|
65173
|
+
continue;
|
|
65154
65174
|
}
|
|
65155
|
-
result += "=" + index;
|
|
65156
|
-
}
|
|
65157
|
-
else if (depth < 4 && isTypeReferenceWithGenericArguments(t)) {
|
|
65158
|
-
result += "<" + getTypeReferenceId(t, typeParameters, depth + 1) + ">";
|
|
65159
|
-
}
|
|
65160
|
-
else {
|
|
65161
65175
|
result += "-" + t.id;
|
|
65162
65176
|
}
|
|
65177
|
+
return result;
|
|
65163
65178
|
}
|
|
65164
|
-
return result;
|
|
65165
65179
|
}
|
|
65166
65180
|
/**
|
|
65167
65181
|
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
|
|
65168
65182
|
* For other cases, the types ids are used.
|
|
65169
65183
|
*/
|
|
65170
|
-
function getRelationKey(source, target, intersectionState, relation) {
|
|
65184
|
+
function getRelationKey(source, target, intersectionState, relation, ignoreConstraints) {
|
|
65171
65185
|
if (relation === identityRelation && source.id > target.id) {
|
|
65172
65186
|
var temp = source;
|
|
65173
65187
|
source = target;
|
|
65174
65188
|
target = temp;
|
|
65175
65189
|
}
|
|
65176
65190
|
var postFix = intersectionState ? ":" + intersectionState : "";
|
|
65177
|
-
|
|
65178
|
-
|
|
65179
|
-
|
|
65180
|
-
}
|
|
65181
|
-
return source.id + "," + target.id + postFix;
|
|
65191
|
+
return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ?
|
|
65192
|
+
getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) :
|
|
65193
|
+
"".concat(source.id, ",").concat(target.id).concat(postFix);
|
|
65182
65194
|
}
|
|
65183
65195
|
// Invoke the callback for each underlying property symbol of the given symbol and return the first
|
|
65184
65196
|
// value that isn't undefined.
|
|
@@ -65226,28 +65238,35 @@ var ts;
|
|
|
65226
65238
|
!hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass;
|
|
65227
65239
|
}
|
|
65228
65240
|
// Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons
|
|
65229
|
-
// for
|
|
65241
|
+
// for maxDepth or more occurrences or instantiations of the type have been recorded on the given stack. It is possible,
|
|
65230
65242
|
// though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
|
|
65231
|
-
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least
|
|
65243
|
+
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least maxDepth
|
|
65232
65244
|
// levels, but unequal at some level beyond that.
|
|
65233
|
-
// In addition, this will also detect when an indexed access has been chained off of
|
|
65234
|
-
// the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding
|
|
65235
|
-
// for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
|
65236
|
-
// It also detects when a recursive type reference has expanded
|
|
65245
|
+
// In addition, this will also detect when an indexed access has been chained off of maxDepth more times (which is
|
|
65246
|
+
// essentially the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding
|
|
65247
|
+
// false positives for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
|
65248
|
+
// It also detects when a recursive type reference has expanded maxDepth or more times, e.g. if the true branch of
|
|
65237
65249
|
// `type A<T> = null extends T ? [A<NonNullable<T>>] : [T]`
|
|
65238
|
-
// has expanded into `[A<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>>>>>>]
|
|
65239
|
-
//
|
|
65250
|
+
// has expanded into `[A<NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<T>>>>>>]`. In such cases we need
|
|
65251
|
+
// to terminate the expansion, and we do so here.
|
|
65240
65252
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
65241
|
-
if (maxDepth === void 0) { maxDepth =
|
|
65253
|
+
if (maxDepth === void 0) { maxDepth = 3; }
|
|
65242
65254
|
if (depth >= maxDepth) {
|
|
65243
65255
|
var identity_1 = getRecursionIdentity(type);
|
|
65244
65256
|
var count = 0;
|
|
65257
|
+
var lastTypeId = 0;
|
|
65245
65258
|
for (var i = 0; i < depth; i++) {
|
|
65246
|
-
|
|
65247
|
-
|
|
65248
|
-
|
|
65249
|
-
|
|
65259
|
+
var t = stack[i];
|
|
65260
|
+
if (getRecursionIdentity(t) === identity_1) {
|
|
65261
|
+
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
65262
|
+
// type ids are an indicator of newer instantiations caused by recursion.
|
|
65263
|
+
if (t.id >= lastTypeId) {
|
|
65264
|
+
count++;
|
|
65265
|
+
if (count >= maxDepth) {
|
|
65266
|
+
return true;
|
|
65267
|
+
}
|
|
65250
65268
|
}
|
|
65269
|
+
lastTypeId = t.id;
|
|
65251
65270
|
}
|
|
65252
65271
|
}
|
|
65253
65272
|
}
|
|
@@ -72837,7 +72856,7 @@ var ts;
|
|
|
72837
72856
|
}
|
|
72838
72857
|
function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
|
|
72839
72858
|
ts.Debug.assert(outerName !== undefined, "outername should always be defined");
|
|
72840
|
-
var result = resolveNameHelper(location, outerName, meaning, /*nameNotFoundMessage*/ undefined, outerName, /*isUse*/ false, /*excludeGlobals*/ false, function (symbols, name, meaning) {
|
|
72859
|
+
var result = resolveNameHelper(location, outerName, meaning, /*nameNotFoundMessage*/ undefined, outerName, /*isUse*/ false, /*excludeGlobals*/ false, /*getSpellingSuggestions*/ true, function (symbols, name, meaning) {
|
|
72841
72860
|
ts.Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
72842
72861
|
var symbol = getSymbol(symbols, name, meaning);
|
|
72843
72862
|
// Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function
|